aa-geuthur-react 0.0.0-stage → 1.0.1

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