aa-geuthur-react 0.0.0-stage → 1.0.0

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.
Files changed (68) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +234 -2
  3. package/dist/Api/Api.d.ts +9 -0
  4. package/dist/Api/basePaths.d.ts +34 -0
  5. package/dist/Api/calls.d.ts +10 -0
  6. package/dist/Api/index.d.ts +5 -0
  7. package/dist/Api/query.d.ts +6 -0
  8. package/dist/Api/types.d.ts +45 -0
  9. package/dist/Components/Base/BaseHeader.d.ts +7 -0
  10. package/dist/Components/Base/BaseModal/BaseModal.d.ts +11 -0
  11. package/dist/Components/Base/BaseModal/BaseModalProps.d.ts +101 -0
  12. package/dist/Components/Base/BaseModal/BaseModalQuery.d.ts +10 -0
  13. package/dist/Components/Base/BaseModal/index.d.ts +3 -0
  14. package/dist/Components/Base/BaseModal/useModalState.d.ts +7 -0
  15. package/dist/Components/Base/BaseTable/BaseTable.d.ts +63 -0
  16. package/dist/Components/Base/BaseTable/BaseTableFilter.d.ts +25 -0
  17. package/dist/Components/Base/BaseTable/BaseTableForm.d.ts +6 -0
  18. package/dist/Components/Base/BaseTable/BaseTableHeader.d.ts +8 -0
  19. package/dist/Components/Base/BaseTable/BaseTablePages.d.ts +11 -0
  20. package/dist/Components/Base/BaseTable/BaseTableToolbar.d.ts +6 -0
  21. package/dist/Components/Base/BaseTable/index.d.ts +8 -0
  22. package/dist/Components/Base/BaseTable/tableFeatures.d.ts +89 -0
  23. package/dist/Components/Base/BaseTable/tableHelper.d.ts +8 -0
  24. package/dist/Components/Base/Loader/ErrorBoundary.d.ts +9 -0
  25. package/dist/Components/Base/Loader/ErrorLoader.d.ts +11 -0
  26. package/dist/Components/Base/Loader/FetchingLoader.d.ts +10 -0
  27. package/dist/Components/Base/Loader/index.d.ts +4 -0
  28. package/dist/Components/Base/index.d.ts +11 -0
  29. package/dist/Hooks/index.d.ts +3 -0
  30. package/dist/Hooks/useCooldown.d.ts +16 -0
  31. package/dist/Hooks/useFeedback.d.ts +13 -0
  32. package/dist/Hooks/useUserData.d.ts +4 -0
  33. package/dist/Menu/AuthLeftMenu.d.ts +4 -0
  34. package/dist/Menu/AuthLeftMenuAsync.d.ts +3 -0
  35. package/dist/Menu/AuthRightMenu.d.ts +4 -0
  36. package/dist/Menu/AuthRightMenuAsync.d.ts +3 -0
  37. package/dist/Menu/BaseMenu.d.ts +26 -0
  38. package/dist/Menu/Hooks/index.d.ts +1 -0
  39. package/dist/Menu/Hooks/useMenu.d.ts +2 -0
  40. package/dist/Menu/index.d.ts +6 -0
  41. package/dist/Pages/404.d.ts +1 -0
  42. package/dist/Pages/Base.d.ts +13 -0
  43. package/dist/Pages/index.d.ts +3 -0
  44. package/dist/Provider.d.ts +13 -0
  45. package/dist/Utils/bootsTrap.d.ts +14 -0
  46. package/dist/Utils/eveOnline.d.ts +66 -0
  47. package/dist/Utils/format.d.ts +44 -0
  48. package/dist/Utils/general.d.ts +27 -0
  49. package/dist/Utils/index.d.ts +4 -0
  50. package/dist/aa-geuthur-react.css +2 -0
  51. package/dist/i18n.d.ts +4 -0
  52. package/dist/index.d.ts +8 -0
  53. package/dist/index.js +1185 -0
  54. package/dist/index.js.map +1 -0
  55. package/eslint-rules/import-headings.js +167 -0
  56. package/i18n/de/aa-geuthur-react.json +34 -0
  57. package/i18n/en/aa-geuthur-react.json +34 -0
  58. package/i18n/es/aa-geuthur-react.json +35 -0
  59. package/i18n/fr-FR/aa-geuthur-react.json +35 -0
  60. package/i18n/it-IT/aa-geuthur-react.json +35 -0
  61. package/i18n/ja/aa-geuthur-react.json +33 -0
  62. package/i18n/ko-KR/aa-geuthur-react.json +33 -0
  63. package/i18n/nl-NL/aa-geuthur-react.json +34 -0
  64. package/i18n/pl-PL/aa-geuthur-react.json +36 -0
  65. package/i18n/ru/aa-geuthur-react.json +36 -0
  66. package/i18n/uk/aa-geuthur-react.json +36 -0
  67. package/i18n/zh-Hans/aa-geuthur-react.json +33 -0
  68. package/package.json +106 -4
package/dist/index.js ADDED
@@ -0,0 +1,1185 @@
1
+ import e from "js-cookie";
2
+ import t from "openapi-fetch";
3
+ import { Link as n, Outlet as r, useLocation as i } from "react-router-dom";
4
+ import { columnFacetingFeature as a, columnFilteringFeature as o, columnSizingFeature as s, columnVisibilityFeature as c, createColumnHelper as l, createFacetedMinMaxValues as u, createFacetedRowModel as d, createFacetedUniqueValues as f, createFilteredRowModel as p, createPaginatedRowModel as m, createSortedRowModel as h, filterFns as g, flexRender as _, functionalUpdate as v, rowPaginationFeature as y, rowSelectionFeature as b, rowSortingFeature as x, sortFns as S, tableFeatures as C, useTable as ee } from "@tanstack/react-table";
5
+ import { ArrowUpDown as w, ChevronDown as T, ChevronFirst as E, ChevronLast as te, ChevronLeft as ne, ChevronRight as re, ChevronUp as ie, ExternalLink as D, Search as ae, ShieldAlert as O, SlidersHorizontal as oe, X as se } from "lucide-react";
6
+ import { Alert as ce, Button as k, ButtonGroup as A, ButtonToolbar as le, Card as j, Col as M, Dropdown as N, Form as P, Modal as F, Nav as I, OverlayTrigger as L, Popover as ue } from "react-bootstrap";
7
+ import { useTranslation as R, withTranslation as de } from "react-i18next";
8
+ import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
9
+ import { Component as H, createContext as fe, useCallback as U, useContext as pe, useEffect as W, useMemo as me, useRef as he, useState as G } from "react";
10
+ import ge from "react-bootstrap/OverlayTrigger";
11
+ import _e from "react-bootstrap/Tooltip";
12
+ import ve from "i18next";
13
+ import { useMutation as ye, useQuery as be, useQueryClient as xe } from "@tanstack/react-query";
14
+ import { useQueryState as Se } from "nuqs";
15
+ import Ce from "react-dom";
16
+ // src/Api/Api.ts
17
+ function we(n) {
18
+ let r = t({
19
+ baseUrl: "/",
20
+ credentials: "same-origin",
21
+ ...n
22
+ });
23
+ return r.use({ async onRequest({ request: t }) {
24
+ let n = e.get("csrftoken");
25
+ return n && t.headers.set("X-CSRFToken", n), t;
26
+ } }), r;
27
+ }
28
+ // src/Api/calls.ts
29
+ var Te = we();
30
+ async function Ee(e) {
31
+ let { data: t, error: n } = await Te.GET("/{project}/api/menu/", { params: { path: { project: e } } });
32
+ if (n || !t) throw Error("Failed to load menu");
33
+ return t;
34
+ }
35
+ async function De(e) {
36
+ let { data: t, error: n } = await Te.GET("/{project}/api/user/", { params: { path: { project: e } } });
37
+ if (n || !t) throw Error("Failed to load user data");
38
+ return { user: t };
39
+ }
40
+ // src/Api/query.ts
41
+ var K = {
42
+ Menu: ["Menu"],
43
+ User: ["User"],
44
+ UserSettings: ["UserSettings"]
45
+ }, q = "aa-geuthur-react", Oe = "translation", J = "position-relative w-100", Y = "position-absolute top-50 end-0 translate-middle-y me-2 pe-none text-muted", X = ({ onClick: e }) => {
46
+ let { t } = R(q);
47
+ return /* @__PURE__ */ B("button", {
48
+ type: "button",
49
+ className: "aa-table-filter-clear position-absolute top-50 end-0 translate-middle-y me-1 d-flex align-items-center justify-content-center border-0 bg-transparent p-0",
50
+ onClick: e,
51
+ title: t("Clear"),
52
+ children: /* @__PURE__ */ B(se, { size: 12 })
53
+ });
54
+ }, ke = RegExp.prototype.test.bind(/(<([^>]+)>)/i), Ae = ({ column: e }) => {
55
+ let { t } = R(q), n = e.getFilterValue(), r = n?.[0] !== void 0 && n?.[0] !== "" || n?.[1] !== void 0 && n?.[1] !== "", i = /* @__PURE__ */ B(ue, {
56
+ id: "popover-number-range",
57
+ className: "aa-table-filter-popover",
58
+ children: /* @__PURE__ */ B(ue.Body, {
59
+ className: "p-3",
60
+ children: /* @__PURE__ */ V("div", {
61
+ className: "d-flex flex-column gap-2",
62
+ children: [
63
+ /* @__PURE__ */ V("div", { children: [/* @__PURE__ */ B(P.Label, {
64
+ className: "small text-muted mb-1",
65
+ children: t("Min")
66
+ }), /* @__PURE__ */ B(P.Control, {
67
+ size: "sm",
68
+ type: "number",
69
+ value: n?.[0] ?? "",
70
+ onChange: (t) => e.setFilterValue((e) => [t.target.value, e?.[1]]),
71
+ placeholder: t("Min"),
72
+ className: "aa-table-filter-input"
73
+ })] }),
74
+ /* @__PURE__ */ V("div", { children: [/* @__PURE__ */ B(P.Label, {
75
+ className: "small text-muted mb-1",
76
+ children: t("Max")
77
+ }), /* @__PURE__ */ B(P.Control, {
78
+ size: "sm",
79
+ type: "number",
80
+ value: n?.[1] ?? "",
81
+ onChange: (t) => e.setFilterValue((e) => [e?.[0], t.target.value]),
82
+ placeholder: t("Max"),
83
+ className: "aa-table-filter-input"
84
+ })] }),
85
+ /* @__PURE__ */ V("div", {
86
+ className: "d-flex gap-2 mt-2",
87
+ children: [/* @__PURE__ */ B(k, {
88
+ variant: "outline-secondary",
89
+ size: "sm",
90
+ className: "w-50",
91
+ onClick: () => {
92
+ e.setFilterValue(() => [void 0, void 0]), document.body.click();
93
+ },
94
+ children: t("Reset")
95
+ }), /* @__PURE__ */ B(k, {
96
+ variant: "primary",
97
+ size: "sm",
98
+ className: "w-50",
99
+ onClick: () => document.body.click(),
100
+ children: t("Done")
101
+ })]
102
+ })
103
+ ]
104
+ })
105
+ })
106
+ });
107
+ return /* @__PURE__ */ B(L, {
108
+ trigger: "click",
109
+ placement: "bottom",
110
+ rootClose: !0,
111
+ overlay: i,
112
+ children: /* @__PURE__ */ V("div", {
113
+ className: J,
114
+ children: [/* @__PURE__ */ B(P.Control, {
115
+ size: "sm",
116
+ className: "aa-table-filter-input",
117
+ readOnly: !0,
118
+ type: "text",
119
+ placeholder: t("Range…"),
120
+ value: r ? `${n?.[0] || "Min"} → ${n?.[1] || "Max"}` : ""
121
+ }), r ? /* @__PURE__ */ B(X, { onClick: (t) => {
122
+ t.stopPropagation(), e.setFilterValue(() => [void 0, void 0]);
123
+ } }) : /* @__PURE__ */ B(oe, {
124
+ size: 12,
125
+ className: Y
126
+ })]
127
+ })
128
+ });
129
+ }, je = ({ column: e }) => {
130
+ let { t } = R(q), n = e.getFilterValue(), r = n !== void 0;
131
+ return /* @__PURE__ */ B(L, {
132
+ trigger: "click",
133
+ placement: "bottom-start",
134
+ rootClose: !0,
135
+ overlay: /* @__PURE__ */ B(N, {
136
+ show: !0,
137
+ drop: "down-centered",
138
+ children: /* @__PURE__ */ V(N.Menu, {
139
+ className: "aa-table-filter-dropdown overflow-y-auto",
140
+ children: [
141
+ /* @__PURE__ */ B(N.Item, {
142
+ onClick: () => {
143
+ e.setFilterValue(!0), document.body.click();
144
+ },
145
+ children: t("True")
146
+ }),
147
+ /* @__PURE__ */ B(N.Item, {
148
+ onClick: () => {
149
+ e.setFilterValue(!1), document.body.click();
150
+ },
151
+ children: t("False")
152
+ }),
153
+ /* @__PURE__ */ B(N.Divider, {}),
154
+ /* @__PURE__ */ B(N.Item, {
155
+ onClick: () => {
156
+ e.setFilterValue(void 0), document.body.click();
157
+ },
158
+ children: t("All")
159
+ })
160
+ ]
161
+ })
162
+ }),
163
+ children: /* @__PURE__ */ V("div", {
164
+ className: J,
165
+ children: [/* @__PURE__ */ B(P.Control, {
166
+ size: "sm",
167
+ className: "aa-table-filter-input",
168
+ readOnly: !0,
169
+ type: "text",
170
+ placeholder: t("All"),
171
+ value: r ? t(n ? "True" : "False") : ""
172
+ }), r ? /* @__PURE__ */ B(X, { onClick: (t) => {
173
+ t.stopPropagation(), e.setFilterValue(() => void 0);
174
+ } }) : /* @__PURE__ */ B(T, {
175
+ size: 12,
176
+ className: Y
177
+ })]
178
+ })
179
+ });
180
+ }, Me = ({ column: e }) => {
181
+ let { t } = R(q), n = e.getFilterValue() ?? "";
182
+ return /* @__PURE__ */ V("div", {
183
+ className: J,
184
+ children: [/* @__PURE__ */ B(P.Control, {
185
+ size: "sm",
186
+ className: "aa-table-filter-input",
187
+ type: "text",
188
+ placeholder: t("Filter…"),
189
+ value: n,
190
+ onChange: (t) => {
191
+ e.setFilterValue(t.target.value ? t.target.value : "");
192
+ }
193
+ }), n ? /* @__PURE__ */ B(X, { onClick: () => e.setFilterValue("") }) : /* @__PURE__ */ B(ae, {
194
+ size: 12,
195
+ className: Y
196
+ })]
197
+ });
198
+ }, Ne = ({ column: e }) => {
199
+ let { t } = R(q), [n, r] = G(!1), i = Array.from(e.getFacetedUniqueValues().keys()).filter((e) => e != null).sort(), a = e.getFilterValue(), o = ke(i?.[0]) || typeof i?.[0] == "object", s = e.columnDef.meta?.filterOptionLabel ?? ((e) => e?.replaceAll("_", " ") ?? e), c = i.reduce((e, t) => (t != null && (o || (a === void 0 || t?.toLowerCase().includes(a?.toLowerCase())) && e.push({
200
+ value: t,
201
+ label: s(t)
202
+ })), e), []);
203
+ return /* @__PURE__ */ B(L, {
204
+ trigger: "click",
205
+ placement: "bottom-start",
206
+ rootClose: !0,
207
+ overlay: /* @__PURE__ */ B(N, {
208
+ show: !0,
209
+ drop: "down-centered",
210
+ children: /* @__PURE__ */ B(N.Menu, {
211
+ className: "aa-table-filter-dropdown overflow-y-auto",
212
+ children: c.length > 0 ? c.map((t) => /* @__PURE__ */ B(N.Item, {
213
+ className: "text-capitalize",
214
+ onClick: () => {
215
+ e.setFilterValue(t.value ? t.value : ""), document.body.click();
216
+ },
217
+ children: t.label
218
+ }, t.value)) : /* @__PURE__ */ B(N.Item, {
219
+ disabled: !0,
220
+ children: t("No matching options")
221
+ })
222
+ })
223
+ }),
224
+ children: /* @__PURE__ */ V("div", {
225
+ className: J,
226
+ children: [/* @__PURE__ */ B(P.Control, {
227
+ size: "sm",
228
+ className: "aa-table-filter-input",
229
+ type: "text",
230
+ placeholder: t("Filter…"),
231
+ value: a === void 0 ? "" : n ? a : s(a),
232
+ onFocus: (e) => {
233
+ r(!0), e.target.select();
234
+ },
235
+ onBlur: () => r(!1),
236
+ onChange: (t) => {
237
+ e.setFilterValue(t.target.value ? t.target.value : "");
238
+ }
239
+ }), a ? /* @__PURE__ */ B(X, { onClick: (t) => {
240
+ t.stopPropagation(), r(!1), e.setFilterValue(() => void 0);
241
+ } }) : /* @__PURE__ */ B(T, {
242
+ size: 12,
243
+ className: Y
244
+ })]
245
+ })
246
+ });
247
+ }, Pe = ({ column: e, table: t }) => {
248
+ let n = t.getPreFilteredRowModel().flatRows[0]?.getValue(e.id);
249
+ return B(typeof n == "number" ? Ae : typeof n == "boolean" ? je : typeof n == "object" ? Me : Ne, { column: e });
250
+ };
251
+ // src/Components/Base/BaseTable/BaseTableHeader.tsx
252
+ function Fe({ table: e, enableFilters: t = !0 }) {
253
+ return /* @__PURE__ */ B(z, { children: e.getHeaderGroups().map((n) => {
254
+ let r = t !== !1 && n.headers.some((e) => e.column.getCanFilter());
255
+ return /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("tr", { children: n.headers.map((e) => {
256
+ let t = e.column.getCanSort(), n = e.column.getIsSorted(), r = e.column.columnDef.meta?.align === "right";
257
+ return /* @__PURE__ */ B("th", {
258
+ colSpan: e.colSpan,
259
+ onClick: t ? e.column.getToggleSortingHandler() : void 0,
260
+ className: `aa-table-heading-cell ${t ? "aa-table-sortable user-select-none" : ""} ${r ? "text-end" : ""}`,
261
+ children: e.isPlaceholder ? null : /* @__PURE__ */ V("div", {
262
+ className: `d-flex align-items-center gap-2 ${r ? "justify-content-end text-end" : ""}`,
263
+ children: [_(e.column.columnDef.header, e.getContext()), t && /* @__PURE__ */ B("span", { children: n === "asc" ? /* @__PURE__ */ B(ie, { className: "aa-table-sort-icon aa-table-sort-icon-active" }) : n === "desc" ? /* @__PURE__ */ B(T, { className: "aa-table-sort-icon aa-table-sort-icon-active" }) : /* @__PURE__ */ B(w, { className: "aa-table-sort-icon" }) })]
264
+ })
265
+ }, e.id);
266
+ }) }), r && /* @__PURE__ */ B("tr", {
267
+ className: "aa-table-filter-row",
268
+ children: n.headers.map((t) => /* @__PURE__ */ B("th", {
269
+ colSpan: t.colSpan,
270
+ className: "aa-table-filter-cell px-3 py-1",
271
+ children: t.column.getCanFilter() ? /* @__PURE__ */ B(Pe, {
272
+ column: t.column,
273
+ table: e
274
+ }) : null
275
+ }, `${t.id}-filter`))
276
+ })] }, n.id);
277
+ }) });
278
+ }
279
+ // src/Components/Base/BaseTable/tableHelper.tsx
280
+ var Ie = (e, t) => {
281
+ let { rows: n } = e.getFilteredRowModel(), r = t ?? "ExportedData.csv", i = e.getHeaderGroups().map((e) => e.headers.map((e) => typeof e.column.columnDef.header == "function" ? e.column.columnDef.accessorKey : e.column.columnDef.header)), a = n.map((e) => e.getVisibleCells().map((e) => e.getValue())), o = (e) => {
282
+ if (e == null) return "";
283
+ let t = String(e);
284
+ return t.includes(",") || t.includes("\"") || t.includes("\n") || t.includes("\r") ? `"${t.replace(/"/g, "\"\"")}"` : t;
285
+ }, s = [...i, ...a].map((e) => e.map(o).join(",")).join("\r\n"), c = new Blob([s], { type: "text/csv;charset=utf8;" }), l = document.createElement("a");
286
+ l.download = r, l.href = URL.createObjectURL(c), l.style.visibility = "hidden", document.body.appendChild(l), l.click(), document.body.removeChild(l);
287
+ };
288
+ // src/Utils/bootsTrap.tsx
289
+ function Le(e) {
290
+ return /* @__PURE__ */ B("div", {
291
+ className: "aa-tooltip-container",
292
+ children: /* @__PURE__ */ B("span", { children: e })
293
+ });
294
+ }
295
+ function Z(e, t) {
296
+ return /* @__PURE__ */ B(ge, {
297
+ placement: "auto",
298
+ trigger: ["hover", "focus"],
299
+ overlay: /* @__PURE__ */ B(_e, {
300
+ id: "aa-react-tooltip",
301
+ className: "aa-tooltip",
302
+ children: e
303
+ }),
304
+ children: t
305
+ });
306
+ }
307
+ // src/Utils/format.ts
308
+ function Re(e, t) {
309
+ if (!e) return "N/A";
310
+ let n = ve.language || "en", r = t && ("hour" in t || "minute" in t || "second" in t || "timeStyle" in t), i = t && ("year" in t || "month" in t || "day" in t || "dateStyle" in t), a = {
311
+ ...r || i ? {} : {
312
+ dateStyle: "medium",
313
+ timeStyle: "short"
314
+ },
315
+ ...t ?? {}
316
+ };
317
+ return new Intl.DateTimeFormat(n, a).format(new Date(e));
318
+ }
319
+ function ze(e) {
320
+ if (!e) return "N/A";
321
+ let t = e instanceof Date ? e : new Date(e);
322
+ if (isNaN(t.getTime())) return "N/A";
323
+ let n = Math.round((t.getTime() - Date.now()) / 1e3), r = [
324
+ {
325
+ unit: "year",
326
+ seconds: 31536e3
327
+ },
328
+ {
329
+ unit: "month",
330
+ seconds: 2592e3
331
+ },
332
+ {
333
+ unit: "day",
334
+ seconds: 86400
335
+ },
336
+ {
337
+ unit: "hour",
338
+ seconds: 3600
339
+ },
340
+ {
341
+ unit: "minute",
342
+ seconds: 60
343
+ },
344
+ {
345
+ unit: "second",
346
+ seconds: 1
347
+ }
348
+ ], i = r.find((e) => Math.abs(n) >= e.seconds) ?? r[r.length - 1], a = Math.round(n / i.seconds), o = ve.language || "en";
349
+ return new Intl.RelativeTimeFormat(o, { numeric: "auto" }).format(a, i.unit);
350
+ }
351
+ function Be(e, t = "Done") {
352
+ if (!e) return "N/A";
353
+ let n = e instanceof Date ? e : new Date(e);
354
+ return isNaN(n.getTime()) ? "N/A" : n.getTime() <= Date.now() ? t : ze(n);
355
+ }
356
+ function Ve(e, t, n) {
357
+ let r = t || ve.language || "en";
358
+ return new Intl.NumberFormat(r, n).format(e);
359
+ }
360
+ function He(e, t = "", n, r) {
361
+ let i = t ? ` ${t}` : "";
362
+ return e >= 1e9 ? `${(e / 1e9).toFixed(2)}B${i}` : e >= 1e6 ? `${(e / 1e6).toFixed(1)}M${i}` : e >= 1e3 ? `${(e / 1e3).toFixed(1)}K${i}` : `${Ve(e, n, r)}${i}`;
363
+ }
364
+ function Ue(e) {
365
+ return `${Ve(Math.round(e), void 0, { maximumFractionDigits: 0 })} ISK`;
366
+ }
367
+ // src/Components/Base/BaseTable/BaseTablePages.tsx
368
+ var We = ({ table: e, isFetching: t = !1, fileName: n, showPageNumber: r = !1, showExport: i = !0 }) => {
369
+ let { t: a } = R(q), o = Math.max(1, e.getPageCount());
370
+ return /* @__PURE__ */ B("div", { children: /* @__PURE__ */ V(A, {
371
+ size: "sm",
372
+ className: "z-0",
373
+ children: [
374
+ r && /* @__PURE__ */ B(k, {
375
+ size: "sm",
376
+ variant: "primary",
377
+ children: a("Page {{page}} of {{total}}", {
378
+ page: e.atoms.pagination.get().pageIndex + 1,
379
+ total: o
380
+ })
381
+ }),
382
+ t ? Z(a("Refreshing Data"), /* @__PURE__ */ B(k, {
383
+ size: "sm",
384
+ variant: "primary",
385
+ children: /* @__PURE__ */ B("i", { className: "fas fa-sync fa-spin" })
386
+ })) : Z(a("Data Loaded: {{date}}", { date: Re((/* @__PURE__ */ new Date()).toISOString()) }), /* @__PURE__ */ B(k, {
387
+ size: "sm",
388
+ variant: "primary",
389
+ children: /* @__PURE__ */ B("i", { className: "far fa-check-circle" })
390
+ })),
391
+ i && /* @__PURE__ */ B(k, {
392
+ size: "sm",
393
+ variant: "primary",
394
+ onClick: () => Ie(e, n ?? "ExportedData.csv"),
395
+ children: a("Export Table to CSV")
396
+ })
397
+ ]
398
+ }) });
399
+ }, Ge = C({
400
+ columnFilteringFeature: o,
401
+ columnFacetingFeature: a,
402
+ columnSizingFeature: s,
403
+ columnVisibilityFeature: c,
404
+ rowSortingFeature: x,
405
+ rowPaginationFeature: y,
406
+ rowSelectionFeature: b,
407
+ filteredRowModel: p(),
408
+ sortedRowModel: h(),
409
+ paginatedRowModel: m(),
410
+ facetedRowModel: d(),
411
+ facetedUniqueValues: f(),
412
+ facetedMinMaxValues: u(),
413
+ filterFns: g,
414
+ sortFns: S
415
+ }), Ke = () => l(), qe = ({ message: e, className: t = "", spinnerClassName: n = "" } = {}) => /* @__PURE__ */ V("div", {
416
+ className: `d-flex flex-column align-items-center justify-content-center ${t}`,
417
+ children: [/* @__PURE__ */ B("div", {
418
+ className: `spinner-border text-info ${n}`,
419
+ role: "status",
420
+ children: /* @__PURE__ */ B("span", {
421
+ className: "visually-hidden",
422
+ children: "Loading..."
423
+ })
424
+ }), e && /* @__PURE__ */ B("span", { children: e })]
425
+ }), Je = "aa-table-message text-center py-5 px-3", Ye = ({ isFetching: e = !1, isLoading: t = !1, loadingText: n, serverPagination: r, isError: a = !1, debugTable: o = !1, data: s = [], columns: c, initialState: l = void 0, exportFileName: u = void 0, variant: d = "default", emptyText: f, emptyState: p, toolbar: m, footer: h, showFooter: g = !1, className: y, tableClassName: b, headerClassName: x, bodyClassName: S, rowClassName: C, footClassName: w, footerClassName: T, pageSizeOptions: ie = [
426
+ 10,
427
+ 25,
428
+ 50,
429
+ 100
430
+ ], getRowClassName: D, enableFilters: ae = !0, rowSelection: O, onRowSelectionChange: oe, enableRowSelection: se, getRowId: ce, onRowClick: A }) => {
431
+ let le = i(), { t: j } = R(q), M = r && {
432
+ pageIndex: r.page - 1,
433
+ pageSize: r.pageSize
434
+ }, N = ee({
435
+ features: Ge,
436
+ data: s,
437
+ columns: c,
438
+ getRowId: ce,
439
+ state: {
440
+ ...O === void 0 ? {} : { rowSelection: O },
441
+ ...M ? { pagination: M } : {}
442
+ },
443
+ ...r && M ? {
444
+ manualPagination: !0,
445
+ pageCount: Math.max(1, Math.ceil(r.total / r.pageSize)),
446
+ enableSorting: !1,
447
+ enableColumnFilters: !1,
448
+ onPaginationChange: (e) => {
449
+ let t = v(e, M);
450
+ t.pageSize === M.pageSize ? t.pageIndex !== M.pageIndex && r.onPageChange(t.pageIndex + 1) : r.onPageSizeChange(t.pageSize);
451
+ }
452
+ } : {},
453
+ onRowSelectionChange: oe,
454
+ enableRowSelection: se,
455
+ debugTable: o,
456
+ initialState: {
457
+ ...l,
458
+ pagination: {
459
+ pageIndex: 0,
460
+ pageSize: 15,
461
+ ...l?.pagination
462
+ }
463
+ }
464
+ }), { rows: F } = N.getRowModel(), I = u === void 0 ? `ExportedData_${le.pathname}` : u, L = d === "light", { pageIndex: ue, pageSize: de } = N.state.pagination, z = N.getPageCount(), H = N.getVisibleLeafColumns().length;
465
+ return /* @__PURE__ */ V("div", {
466
+ className: `aa-table-shell mt-2 ${L ? "aa-table-shell-light aa-table-light" : ""} ${y ?? ""}`,
467
+ children: [
468
+ m,
469
+ /* @__PURE__ */ B("div", {
470
+ className: `aa-table-scroll ${t && F.length > 0 ? "opacity-50 pe-none" : ""}`,
471
+ "aria-busy": t,
472
+ children: /* @__PURE__ */ V("table", {
473
+ className: `aa-table w-100 text-start ${L ? "aa-table-light" : ""} ${b ?? ""}`,
474
+ children: [
475
+ /* @__PURE__ */ B("thead", {
476
+ className: `aa-table-head ${x ?? ""}`,
477
+ children: /* @__PURE__ */ B(Fe, {
478
+ table: N,
479
+ enableFilters: ae
480
+ })
481
+ }),
482
+ /* @__PURE__ */ B("tbody", {
483
+ className: `aa-table-body ${S ?? ""}`,
484
+ children: a ? /* @__PURE__ */ B("tr", { children: /* @__PURE__ */ B("td", {
485
+ colSpan: H,
486
+ className: Je,
487
+ children: j("Something went wrong.")
488
+ }) }) : t && F.length === 0 ? /* @__PURE__ */ B("tr", { children: /* @__PURE__ */ B("td", {
489
+ colSpan: H,
490
+ className: Je,
491
+ children: /* @__PURE__ */ B(qe, { message: n })
492
+ }) }) : F.length === 0 ? /* @__PURE__ */ B("tr", { children: /* @__PURE__ */ B("td", {
493
+ colSpan: H,
494
+ className: Je,
495
+ children: p ?? f ?? j("No Data Available")
496
+ }) }) : F.map((e) => /* @__PURE__ */ B("tr", {
497
+ onClick: A ? () => A(e) : void 0,
498
+ className: `aa-table-row ${D ? D(e) : "aa-table-row-hover"} ${C ?? ""}`,
499
+ children: e.getVisibleCells().map((e) => {
500
+ let t = e.column.columnDef.meta?.align === "right";
501
+ return /* @__PURE__ */ B("td", {
502
+ className: `aa-table-cell align-middle ${t ? "text-end" : ""}`,
503
+ children: _(e.column.columnDef.cell, e.getContext())
504
+ }, e.id);
505
+ })
506
+ }, e.id))
507
+ }),
508
+ g && !a && F.length > 0 && /* @__PURE__ */ B("tfoot", {
509
+ className: `aa-table-foot ${w ?? ""}`,
510
+ children: N.getFooterGroups().map((e) => /* @__PURE__ */ B("tr", { children: e.headers.map((e) => {
511
+ let t = e.column.columnDef.meta?.align === "right";
512
+ return /* @__PURE__ */ B("td", {
513
+ colSpan: e.colSpan,
514
+ className: `aa-table-cell align-middle ${t ? "text-end" : ""}`,
515
+ children: e.isPlaceholder ? null : _(e.column.columnDef.footer, e.getContext())
516
+ }, e.id);
517
+ }) }, e.id))
518
+ })
519
+ ]
520
+ })
521
+ }),
522
+ /* @__PURE__ */ V("div", {
523
+ className: `aa-table-footer d-flex flex-column flex-md-row align-items-center justify-content-between gap-3 p-3 ${T ?? ""}`,
524
+ children: [
525
+ /* @__PURE__ */ V("div", {
526
+ className: "d-flex align-items-center justify-content-between gap-3 align-self-stretch align-self-md-auto",
527
+ children: [/* @__PURE__ */ V("div", {
528
+ className: "d-flex align-items-center gap-3",
529
+ children: [/* @__PURE__ */ V("div", {
530
+ className: "d-flex align-items-center gap-2",
531
+ children: [/* @__PURE__ */ B("span", { children: j("Page Size:") }), /* @__PURE__ */ V(P.Select, {
532
+ size: "sm",
533
+ value: de,
534
+ disabled: t,
535
+ onChange: (e) => N.setPageSize(Number(e.target.value)),
536
+ className: "aa-table-select w-auto",
537
+ children: [ie.map((e) => /* @__PURE__ */ B("option", {
538
+ value: e,
539
+ children: e
540
+ }, e)), !r && /* @__PURE__ */ B("option", {
541
+ value: 1e6,
542
+ children: j("Show All")
543
+ })]
544
+ })]
545
+ }), r && /* @__PURE__ */ B("span", {
546
+ className: "aa-table-total",
547
+ children: r.totalText ?? j("Total: {{total}}", { total: r.total.toLocaleString() })
548
+ })]
549
+ }), /* @__PURE__ */ B(We, {
550
+ table: N,
551
+ isFetching: e,
552
+ fileName: I,
553
+ showPageNumber: !0,
554
+ showExport: !r
555
+ })]
556
+ }),
557
+ z > 1 && /* @__PURE__ */ V("div", {
558
+ className: "d-flex align-items-center gap-2",
559
+ children: [
560
+ /* @__PURE__ */ B(k, {
561
+ size: "sm",
562
+ disabled: t || !N.getCanPreviousPage(),
563
+ onClick: () => N.setPageIndex(0),
564
+ className: "aa-table-page-button",
565
+ title: j("First Page"),
566
+ children: /* @__PURE__ */ B(E, { className: "aa-table-page-icon" })
567
+ }),
568
+ /* @__PURE__ */ B(k, {
569
+ size: "sm",
570
+ disabled: t || !N.getCanPreviousPage(),
571
+ onClick: () => N.previousPage(),
572
+ className: "aa-table-page-button",
573
+ title: j("Previous Page"),
574
+ children: /* @__PURE__ */ B(ne, { className: "aa-table-page-icon" })
575
+ }),
576
+ /* @__PURE__ */ B("span", {
577
+ className: "aa-table-page-number px-2 fw-bold",
578
+ children: j("Page {{page}} of {{total}}", {
579
+ page: ue + 1,
580
+ total: z
581
+ })
582
+ }),
583
+ /* @__PURE__ */ B(k, {
584
+ size: "sm",
585
+ disabled: t || !N.getCanNextPage(),
586
+ onClick: () => N.nextPage(),
587
+ className: "aa-table-page-button",
588
+ title: j("Next Page"),
589
+ children: /* @__PURE__ */ B(re, { className: "aa-table-page-icon" })
590
+ }),
591
+ /* @__PURE__ */ B(k, {
592
+ size: "sm",
593
+ disabled: t || !N.getCanNextPage(),
594
+ onClick: () => N.setPageIndex(z - 1),
595
+ className: "aa-table-page-button",
596
+ title: j("Last Page"),
597
+ children: /* @__PURE__ */ B(te, { className: "aa-table-page-icon" })
598
+ })
599
+ ]
600
+ }),
601
+ h && /* @__PURE__ */ B("div", {
602
+ className: "w-100",
603
+ children: h
604
+ })
605
+ ]
606
+ }),
607
+ o && /* @__PURE__ */ V("div", {
608
+ className: "p-3",
609
+ children: [/* @__PURE__ */ B("div", { children: j("{{count}} Rows", { count: N.getRowModel().rows.length }) }), /* @__PURE__ */ B("pre", { children: JSON.stringify(N.state, null, 2) })]
610
+ })
611
+ ]
612
+ });
613
+ };
614
+ // src/Components/Base/BaseTable/BaseTableForm.tsx
615
+ function Xe({ table: e }) {
616
+ let { t } = R(q);
617
+ return /* @__PURE__ */ V("div", {
618
+ className: "d-flex align-items-center ms-2",
619
+ children: [/* @__PURE__ */ B(P.Label, {
620
+ className: "m-0 me-2 text-nowrap",
621
+ children: t("Page Size:")
622
+ }), /* @__PURE__ */ B(P.Select, {
623
+ className: "w-auto",
624
+ value: e.atoms.pagination.get().pageSize,
625
+ onChange: (t) => e.setPageSize(Number(t.target.value)),
626
+ children: [
627
+ 15,
628
+ 30,
629
+ 60,
630
+ 100,
631
+ 1e6
632
+ ].map((e) => /* @__PURE__ */ B("option", {
633
+ value: e,
634
+ children: e === 1e6 ? t("Show All") : t("Show {{pageSize}}", { pageSize: e })
635
+ }, e))
636
+ })]
637
+ });
638
+ }
639
+ // src/Components/Base/BaseTable/BaseTableToolbar.tsx
640
+ var Ze = ({ table: e }) => /* @__PURE__ */ V(le, { children: [/* @__PURE__ */ V(A, {
641
+ className: "z-0",
642
+ children: [
643
+ /* @__PURE__ */ B(k, {
644
+ variant: "success",
645
+ onClick: () => e.setPageIndex(0),
646
+ disabled: !e.getCanPreviousPage(),
647
+ children: /* @__PURE__ */ B("i", { className: "fas fa-angle-double-left" })
648
+ }),
649
+ /* @__PURE__ */ B(k, {
650
+ variant: "success",
651
+ onClick: () => e.previousPage(),
652
+ disabled: !e.getCanPreviousPage(),
653
+ children: /* @__PURE__ */ B("i", { className: "fas fa-caret-left" })
654
+ }),
655
+ /* @__PURE__ */ B(k, {
656
+ variant: "success",
657
+ onClick: () => e.nextPage(),
658
+ disabled: !e.getCanNextPage(),
659
+ children: /* @__PURE__ */ B("i", { className: "fas fa-caret-right" })
660
+ }),
661
+ /* @__PURE__ */ B(k, {
662
+ variant: "success",
663
+ onClick: () => e.setPageIndex(e.getPageCount() - 1),
664
+ disabled: !e.getCanNextPage(),
665
+ children: /* @__PURE__ */ B("i", { className: "fas fa-angle-double-right" })
666
+ })
667
+ ]
668
+ }), /* @__PURE__ */ B(Xe, { table: e })] }), Qe = {
669
+ small: "sm",
670
+ medium: void 0,
671
+ large: "lg",
672
+ extraLarge: "xl"
673
+ }, Q = {
674
+ size: Qe.large,
675
+ centered: !0,
676
+ scrollable: !1,
677
+ backdrop: !0,
678
+ restoreFocus: !1,
679
+ closeButton: !0,
680
+ closeVariant: "primary",
681
+ confirmVariant: "success"
682
+ };
683
+ // src/Components/Base/BaseModal/BaseModal.tsx
684
+ function $e({ show: e, onHide: t, onEnter: n, onShow: r, onExited: i, title: a, footer: o, children: s, size: c = Q.size, centered: l = Q.centered, scrollable: u = Q.scrollable, backdrop: d = Q.backdrop, restoreFocus: f = Q.restoreFocus, closeButton: p = Q.closeButton, className: m, bodyClassName: h, titleClassName: g }) {
685
+ let [_, v] = G({
686
+ title: a,
687
+ children: s,
688
+ footer: o
689
+ });
690
+ e && (a != null && a !== _.title || s != null && s !== !1 && s !== _.children || o !== void 0 && o !== _.footer) && v({
691
+ title: a ?? _.title,
692
+ children: s ?? _.children,
693
+ footer: o === void 0 ? _.footer : o
694
+ });
695
+ let y = e ? a : _.title ?? a, b = e ? s : _.children ?? s, x = e ? o : _.footer ?? o;
696
+ return /* @__PURE__ */ V(F, {
697
+ show: e,
698
+ size: c,
699
+ onHide: t,
700
+ onEnter: n,
701
+ onShow: r,
702
+ onExited: i,
703
+ centered: l,
704
+ scrollable: u,
705
+ backdrop: d,
706
+ restoreFocus: f,
707
+ dialogClassName: m,
708
+ contentClassName: "aa-react",
709
+ children: [
710
+ /* @__PURE__ */ B(F.Header, {
711
+ closeButton: p,
712
+ children: /* @__PURE__ */ B(F.Title, {
713
+ className: g,
714
+ children: y
715
+ })
716
+ }),
717
+ /* @__PURE__ */ B(F.Body, {
718
+ className: h,
719
+ children: b
720
+ }),
721
+ x !== null && /* @__PURE__ */ B(F.Footer, { children: x })
722
+ ]
723
+ });
724
+ }
725
+ function et({ show: e, onHide: t, title: n, children: r, footer: i, hideFooter: a = !1, closeText: o, closeVariant: s = Q.closeVariant, ...c }) {
726
+ let { t: l } = R(q), u = /* @__PURE__ */ B(k, {
727
+ variant: s,
728
+ onClick: t,
729
+ children: o ?? l("Close")
730
+ });
731
+ return /* @__PURE__ */ B($e, {
732
+ ...c,
733
+ show: e,
734
+ onHide: t,
735
+ title: n,
736
+ footer: a ? null : i ?? u,
737
+ children: r
738
+ });
739
+ }
740
+ function tt({ data: e, showModal: t, setShowModal: n, onApprove: r, isPending: i = !1, validate: a, initialFormData: o, title: s, confirmText: c, confirmVariant: l, closeText: u, closeVariant: d = Q.closeVariant, children: f, onEnter: p, onExited: m, ...h }) {
741
+ let { t: g } = R(q), [_, v] = G(null), [y, b] = G(o ?? {}), [x, S] = G(!1), [C, ee] = G(e);
742
+ t && e && e !== C && ee(e);
743
+ let w = t ? e : e ?? C, T = () => {
744
+ v(null), b(o ?? {}), S(!1);
745
+ }, E = () => {
746
+ n(!1);
747
+ }, te = () => {
748
+ T(), p?.();
749
+ }, ne = () => {
750
+ T(), m?.();
751
+ }, re = async () => {
752
+ if (a && !a(y)) S(!0);
753
+ else try {
754
+ await r({
755
+ url: w.url,
756
+ formData: y
757
+ }), n(!1);
758
+ } catch (e) {
759
+ v(e instanceof Error ? e.message : "An unexpected error occurred.");
760
+ }
761
+ }, ie = typeof f == "function" ? f({
762
+ formData: y,
763
+ onChange: b
764
+ }) : f, D = /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B(k, {
765
+ variant: l ?? w.color ?? Q.confirmVariant,
766
+ disabled: i,
767
+ onClick: re,
768
+ children: i ? g("Loading…") : c || w.buttonText || g("Confirm")
769
+ }), /* @__PURE__ */ B(k, {
770
+ variant: d,
771
+ onClick: E,
772
+ children: u ?? g("Close")
773
+ })] });
774
+ return /* @__PURE__ */ V($e, {
775
+ ...h,
776
+ show: t,
777
+ onHide: E,
778
+ onEnter: te,
779
+ onExited: ne,
780
+ title: s ?? w.title,
781
+ footer: D,
782
+ children: [_ && /* @__PURE__ */ B(ce, {
783
+ variant: "danger",
784
+ onClose: () => v(null),
785
+ dismissible: !0,
786
+ children: _
787
+ }), /* @__PURE__ */ B("div", {
788
+ className: x ? "was-validated" : "",
789
+ children: ie
790
+ })]
791
+ });
792
+ }
793
+ function nt(e) {
794
+ return e.variant === "confirm" || "showModal" in e || "data" in e ? /* @__PURE__ */ B(tt, { ...e }) : /* @__PURE__ */ B(et, { ...e });
795
+ }
796
+ // src/Components/Base/BaseModal/BaseModalQuery.tsx
797
+ function rt() {
798
+ let t = e.get("csrftoken");
799
+ return t ? { "X-CSRFToken": t } : {};
800
+ }
801
+ function it(e) {
802
+ let t = xe();
803
+ return ye({
804
+ mutationFn: async (e) => {
805
+ let t = await fetch(e, {
806
+ method: "POST",
807
+ credentials: "same-origin",
808
+ headers: rt()
809
+ }), n = await t.json();
810
+ if (!t.ok || n.success !== !0) throw Error(n.message ?? "Unknown error");
811
+ return n;
812
+ },
813
+ onSuccess: async () => {
814
+ e && (Array.isArray(e) && Array.isArray(e[0]) ? await Promise.all(e.map((e) => t.invalidateQueries({
815
+ queryKey: e,
816
+ refetchType: "all"
817
+ }))) : await t.invalidateQueries({
818
+ queryKey: e,
819
+ refetchType: "all"
820
+ }));
821
+ }
822
+ });
823
+ }
824
+ function at(e) {
825
+ let t = xe();
826
+ return ye({
827
+ mutationFn: async ({ url: e, formData: t = {} }) => {
828
+ let n = new URLSearchParams();
829
+ for (let [e, r] of Object.entries(t)) typeof r == "boolean" ? r && n.append(e, "on") : n.append(e, r);
830
+ let r = await fetch(e, {
831
+ method: "POST",
832
+ credentials: "same-origin",
833
+ headers: {
834
+ ...rt(),
835
+ "Content-Type": "application/x-www-form-urlencoded"
836
+ },
837
+ body: n.toString()
838
+ }), i = await r.json();
839
+ if (!r.ok || i.success !== !0) throw Error(i.message ?? "Unknown error");
840
+ return i;
841
+ },
842
+ onSuccess: async () => {
843
+ e && (Array.isArray(e) && Array.isArray(e[0]) ? await Promise.all(e.map((e) => t.invalidateQueries({
844
+ queryKey: e,
845
+ refetchType: "all"
846
+ }))) : await t.invalidateQueries({
847
+ queryKey: e,
848
+ refetchType: "all"
849
+ }));
850
+ }
851
+ });
852
+ }
853
+ // src/Components/Base/BaseModal/useModalState.ts
854
+ function ot(e = "modal", t = "id") {
855
+ let [n, r] = Se(e, {
856
+ clearOnDefault: !0,
857
+ defaultValue: ""
858
+ }), [i, a] = Se(t, {
859
+ clearOnDefault: !0,
860
+ defaultValue: ""
861
+ }), o = U((e, t) => {
862
+ r(e), t !== void 0 && a(t);
863
+ }, [r, a]), s = U(() => {
864
+ r(""), a("");
865
+ }, [r, a]);
866
+ return {
867
+ activeModal: n || null,
868
+ activeEntityId: i || null,
869
+ openModal: o,
870
+ closeModal: s,
871
+ setActiveModal: r
872
+ };
873
+ }
874
+ // src/Components/Base/Loader/ErrorLoader.tsx
875
+ var st = ({ message: e, title: t, className: n = "", iconClassName: r = "" } = {}) => /* @__PURE__ */ V("div", {
876
+ className: `d-flex flex-column align-items-center justify-content-center ${n}`,
877
+ children: [
878
+ /* @__PURE__ */ B("span", {
879
+ className: "aa-shake d-inline-block",
880
+ children: /* @__PURE__ */ B("i", { className: `fas fa-exclamation-triangle text-danger display-1 ${r}` })
881
+ }),
882
+ t && /* @__PURE__ */ B("h3", { children: t }),
883
+ e && /* @__PURE__ */ B("p", { children: e })
884
+ ]
885
+ }), ct = class extends H {
886
+ constructor(e) {
887
+ super(e), this.state = {
888
+ hasError: !1,
889
+ message: "",
890
+ trace: ""
891
+ };
892
+ }
893
+ componentDidCatch(e, t) {
894
+ console.error("ErrorBoundary caught an error: ", e, t), this.setState({
895
+ hasError: !0,
896
+ title: e.name,
897
+ message: e.message,
898
+ trace: String(t.componentStack)
899
+ });
900
+ }
901
+ render() {
902
+ if (this.state.hasError) {
903
+ let { t: e, traceClassName: t = "" } = this.props;
904
+ return /* @__PURE__ */ V(z, { children: [
905
+ /* @__PURE__ */ B(st, {
906
+ title: this.state.title,
907
+ message: this.state.message
908
+ }),
909
+ /* @__PURE__ */ B("h1", { children: e("Something went wrong.") }),
910
+ /* @__PURE__ */ B("div", {
911
+ className: "d-flex justify-content-center",
912
+ children: /* @__PURE__ */ B("pre", {
913
+ className: `border mw-100 overflow-auto p-2 ${t}`,
914
+ "data-testid": "error-boundary-trace",
915
+ children: this.state.trace
916
+ })
917
+ })
918
+ ] });
919
+ }
920
+ return this.props.children;
921
+ }
922
+ }, lt = de(q)(ct);
923
+ // src/Components/Base/BaseHeader.tsx
924
+ function ut({ name: e = "Header", children: t }) {
925
+ return /* @__PURE__ */ B(j, {
926
+ className: "bg-dark border-secondary mb-3 shadow-sm",
927
+ children: /* @__PURE__ */ V(j.Body, {
928
+ className: "d-flex flex-wrap align-items-center justify-content-between p-3",
929
+ children: [/* @__PURE__ */ B("h3", {
930
+ id: "section-heading",
931
+ className: "h4 mb-0 fw-bold",
932
+ children: e
933
+ }), t && /* @__PURE__ */ B("div", {
934
+ className: "d-flex flex-wrap align-items-center gap-2",
935
+ children: t
936
+ })]
937
+ })
938
+ });
939
+ }
940
+ // src/Hooks/useCooldown.ts
941
+ function dt() {
942
+ let [e, t] = G(0);
943
+ return W(() => {
944
+ if (e <= 0) return;
945
+ let n = setInterval(() => {
946
+ t((e) => e > 0 ? e - 1 : 0);
947
+ }, 1e3);
948
+ return () => clearInterval(n);
949
+ }, [e]), {
950
+ seconds: e,
951
+ start: U((e) => t(e), [])
952
+ };
953
+ }
954
+ function ft() {
955
+ let [e, t] = G({});
956
+ return W(() => {
957
+ if (!Object.values(e).some((e) => e > 0)) return;
958
+ let n = setInterval(() => {
959
+ t((e) => {
960
+ let t = {};
961
+ for (let [n, r] of Object.entries(e)) r > 1 && (t[Number(n)] = r - 1);
962
+ return t;
963
+ });
964
+ }, 1e3);
965
+ return () => clearInterval(n);
966
+ }, [e]), {
967
+ cooldowns: e,
968
+ start: U((e, n) => t((t) => ({
969
+ ...t,
970
+ [e]: n
971
+ })), [])
972
+ };
973
+ }
974
+ // src/Hooks/useFeedback.ts
975
+ function pt(e = 5e3) {
976
+ let [t, n] = G(null), r = he(null), i = U(() => {
977
+ r.current && clearTimeout(r.current), r.current = null, n(null);
978
+ }, []), a = U((t, i) => {
979
+ r.current && clearTimeout(r.current), n({
980
+ variant: t,
981
+ text: i
982
+ }), r.current = setTimeout(() => n(null), e);
983
+ }, [e]);
984
+ return W(() => () => {
985
+ r.current && clearTimeout(r.current);
986
+ }, []), {
987
+ feedback: t,
988
+ showFeedback: a,
989
+ clearFeedback: i
990
+ };
991
+ }
992
+ // src/Provider.tsx
993
+ var mt = fe(null);
994
+ function ht({ projectName: e, appName: t, children: n }) {
995
+ let r = me(() => ({
996
+ projectName: e,
997
+ appName: t
998
+ }), [e, t]);
999
+ return /* @__PURE__ */ B(mt.Provider, {
1000
+ value: r,
1001
+ children: n
1002
+ });
1003
+ }
1004
+ function $() {
1005
+ let e = pe(mt);
1006
+ if (!e) throw Error("useAaReact must be used inside <AaReactProvider projectName appName>.");
1007
+ return e;
1008
+ }
1009
+ // src/Hooks/useUserData.ts
1010
+ function gt() {
1011
+ let { projectName: e } = $();
1012
+ return be({
1013
+ queryKey: K.User,
1014
+ queryFn: () => De(e),
1015
+ staleTime: 3e5
1016
+ });
1017
+ }
1018
+ // src/Menu/BaseMenu.tsx
1019
+ var _t = (e, t) => {
1020
+ let n = t.replace(/^\/+|\/+$/g, "");
1021
+ return n ? `/${e}/${n}/` : `/${e}/`;
1022
+ }, vt = [q, Oe], yt = ({ link: e, toPath: t }) => {
1023
+ let { t: r } = R(q), a = i(), o = a.pathname.endsWith(e.link ?? "");
1024
+ return /* @__PURE__ */ B(I.Item, {
1025
+ as: "li",
1026
+ children: /* @__PURE__ */ V(I.Link, {
1027
+ as: n,
1028
+ to: {
1029
+ pathname: t(e.link ?? ""),
1030
+ search: a.search
1031
+ },
1032
+ id: e.name,
1033
+ active: o,
1034
+ className: "aa-nav-danger d-flex align-items-center gap-1",
1035
+ "data-testid": "administration-nav-link",
1036
+ children: [/* @__PURE__ */ B(O, {
1037
+ size: 15,
1038
+ className: "text-danger flex-shrink-0"
1039
+ }), /* @__PURE__ */ B("span", { children: r(e.name, {
1040
+ ns: vt,
1041
+ defaultValue: e.name
1042
+ }) })]
1043
+ }, e.name)
1044
+ });
1045
+ }, bt = ({ link: e, toPath: t }) => {
1046
+ let { t: r } = R(q), a = i(), o = a.pathname.endsWith(e.link ?? ""), s = r(e.name, {
1047
+ ns: vt,
1048
+ defaultValue: e.name
1049
+ });
1050
+ return e.is_external || e.link?.startsWith("http://") || e.link?.startsWith("https://") ? /* @__PURE__ */ B(I.Item, {
1051
+ as: "li",
1052
+ children: /* @__PURE__ */ B(I.Link, {
1053
+ href: e.link ?? "#",
1054
+ id: e.name,
1055
+ children: s
1056
+ }, e.name)
1057
+ }) : e.link?.replace(/^\/+|\/+$/g, "") === "administration" || e.name.toLowerCase() === "administration" ? /* @__PURE__ */ B(yt, {
1058
+ link: e,
1059
+ toPath: t
1060
+ }) : /* @__PURE__ */ B(I.Item, {
1061
+ as: "li",
1062
+ children: /* @__PURE__ */ V(I.Link, {
1063
+ as: n,
1064
+ to: {
1065
+ pathname: t(e.link ?? ""),
1066
+ search: a.search
1067
+ },
1068
+ id: e.name,
1069
+ active: o,
1070
+ children: [s, e.badge ? /* @__PURE__ */ B("span", {
1071
+ className: `badge bg-danger ms-1 ${e.has_errors ? "aa-menu-badge-pulse" : ""}`,
1072
+ children: e.badge
1073
+ }) : null]
1074
+ }, e.name)
1075
+ });
1076
+ }, xt = ({ data: e }) => {
1077
+ let { projectName: t } = $(), n = (e) => _t(t, e), r = Array.isArray(e) ? e.filter((e) => !!e.link) : [];
1078
+ return /* @__PURE__ */ B(z, { children: r.map((e) => /* @__PURE__ */ B(bt, {
1079
+ link: e,
1080
+ toPath: n
1081
+ }, e.link)) });
1082
+ }, St = (e) => /* @__PURE__ */ B(xt, { ...e }), Ct = (e) => /* @__PURE__ */ B(xt, { ...e });
1083
+ // src/Menu/Hooks/useMenu.ts
1084
+ function wt() {
1085
+ let { projectName: e } = $();
1086
+ return be({
1087
+ queryKey: K.Menu,
1088
+ queryFn: () => Ee(e),
1089
+ staleTime: 3e5,
1090
+ retry: 1,
1091
+ refetchOnWindowFocus: !1
1092
+ });
1093
+ }
1094
+ // src/Menu/AuthLeftMenuAsync.tsx
1095
+ var Tt = () => {
1096
+ let e = typeof document < "u" ? document.getElementById("nav-left") : null, { data: t, isLoading: n, isError: r } = wt();
1097
+ return !e || !t?.left_links ? /* @__PURE__ */ B(z, {}) : Ce.createPortal(/* @__PURE__ */ B(St, {
1098
+ error: r,
1099
+ isLoading: n,
1100
+ data: t.left_links
1101
+ }), e);
1102
+ }, Et = () => {
1103
+ let e = typeof document < "u" ? document.getElementById("nav-right") : null, { data: t, isLoading: n, isError: r } = wt();
1104
+ return !e || !t?.right_links ? /* @__PURE__ */ B(z, {}) : Ce.createPortal(/* @__PURE__ */ B(Ct, {
1105
+ error: r,
1106
+ isLoading: n,
1107
+ data: t.right_links
1108
+ }), e);
1109
+ }, Dt = ({ className: e = "", children: t }) => /* @__PURE__ */ V(z, { children: [
1110
+ /* @__PURE__ */ B(Tt, {}),
1111
+ /* @__PURE__ */ B(Et, {}),
1112
+ /* @__PURE__ */ B(M, { children: /* @__PURE__ */ B("div", {
1113
+ className: `aa-react container mt-4 ${e}`,
1114
+ children: /* @__PURE__ */ B(lt, { children: t ?? /* @__PURE__ */ B(r, {}) })
1115
+ }) })
1116
+ ] });
1117
+ // src/Pages/404.tsx
1118
+ function Ot() {
1119
+ let { t: e } = R(q);
1120
+ return /* @__PURE__ */ B(j, { children: /* @__PURE__ */ B(j.Body, {
1121
+ className: "p-0",
1122
+ children: /* @__PURE__ */ B(st, {
1123
+ title: e("Error 404"),
1124
+ message: e("The page you are looking for does not exist.")
1125
+ })
1126
+ }) });
1127
+ }
1128
+ // src/Utils/eveOnline.tsx
1129
+ function kt(e, t = 512) {
1130
+ return `https://images.evetech.net/types/${e}/render?size=${t}`;
1131
+ }
1132
+ function At(e, t = 512) {
1133
+ return `https://images.evetech.net/characters/${e}/portrait?size=${t}`;
1134
+ }
1135
+ function jt(e, t = 128) {
1136
+ return `https://images.evetech.net/corporations/${e}/logo?size=${t}`;
1137
+ }
1138
+ function Mt(e, t = 128) {
1139
+ return `https://images.evetech.net/alliances/${e}/logo?size=${t}`;
1140
+ }
1141
+ function Nt(e, t = 32) {
1142
+ return `https://images.evetech.net/types/${e}/icon?size=${t}`;
1143
+ }
1144
+ var Pt = (e) => e >= .5 ? "aa-badge-hisec" : e > 0 ? "aa-badge-lowsec" : "aa-badge-nullsec", Ft = (e = /* @__PURE__ */ new Date()) => {
1145
+ let t = (e) => String(e).padStart(2, "0");
1146
+ return `${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())} EVE`;
1147
+ };
1148
+ function It({ id: e, name: t, size: n = 12, className: r = "", externalLink: i = !1 }) {
1149
+ let a = `https://zkillboard.com/kill/${e}/`;
1150
+ return Z(t, /* @__PURE__ */ V("a", {
1151
+ href: a,
1152
+ target: "_blank",
1153
+ rel: "noopener noreferrer",
1154
+ className: r,
1155
+ children: [t, i && /* @__PURE__ */ B(D, { size: n })]
1156
+ }));
1157
+ }
1158
+ function Lt(e, t = 32) {
1159
+ return /* @__PURE__ */ B("img", {
1160
+ src: At(e, t),
1161
+ className: "rounded"
1162
+ });
1163
+ }
1164
+ // src/Utils/general.tsx
1165
+ var Rt = ({ url: e, text: t, children: n, external: r, className: i }) => /* @__PURE__ */ V("a", {
1166
+ href: e,
1167
+ className: `${i ?? ""}`,
1168
+ target: r ? "_blank" : void 0,
1169
+ rel: r ? "noopener noreferrer" : void 0,
1170
+ children: [t, n]
1171
+ }), zt = (e, t, n) => /* @__PURE__ */ B("img", {
1172
+ src: kt(e, 128),
1173
+ alt: t,
1174
+ className: `${n ?? ""}`,
1175
+ loading: "lazy",
1176
+ onError: (t) => {
1177
+ t.target.src = Nt(e, 64);
1178
+ }
1179
+ });
1180
+ function Bt(e) {
1181
+ return /* @__PURE__ */ B("span", { dangerouslySetInnerHTML: { __html: e } });
1182
+ }
1183
+ export { ht as AaReactProvider, yt as AdministrationMenuItem, Dt as AuthBase, St as AuthLeftMenu, Tt as AuthLeftMenuAsync, Ct as AuthRightMenu, Et as AuthRightMenuAsync, nt as BaseModal, ut as BaseSectionHeader, Ye as BaseTable, Xe as BaseTableForm, Fe as BaseTableHeader, We as BaseTablePages, Ze as BaseToolbar, je as BoolFilter, lt as ErrorBoundary, st as ErrorLoader, Ot as ErrorPage, qe as FetchingLoader, Pe as Filter, Oe as I18N_FALLBACK_NAMESPACE, q as I18N_NAMESPACE, Q as MODAL_DEFAULTS, bt as MenuItem, xt as MenuList, Qe as ModalSize, Ae as NumberFilter, Ne as SelectFilter, Me as TextFilter, Mt as allianceImageUrl, Te as baseApiClient, Ge as baseTableFeatures, At as characterImageUrl, jt as corporationImageUrl, we as createApiClient, Ke as createBaseColumnHelper, Ie as exportToCSV, He as formatCompactNumber, Re as formatDate, Be as formatEta, Ft as formatEveTime, Ue as formatIsk, Ve as formatNumber, ze as formatRelativeTime, Pt as getSecColor, Nt as itemImageUrl, Ee as loadMenu, De as loadUserData, K as queryKeys, Lt as renderCharacterPortrait, Bt as renderHtml, Rt as renderLink, zt as renderShipImage, Z as renderTooltip, kt as shipImageUrl, _t as toProjectPath, Le as toolTipContainer, $ as useAaReact, it as useApproveMutation, dt as useCooldown, pt as useFeedback, at as useFormApproveMutation, wt as useMenu, ot as useModalQueryState, ft as useOwnerCooldowns, gt as useUserData, It as zKillboardLink };
1184
+
1185
+ //# sourceMappingURL=index.js.map