@sito/dashboard-app 0.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 (134) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +60 -0
  3. package/dist/components/Actions/Action.d.ts +3 -0
  4. package/dist/components/Actions/Actions.d.ts +3 -0
  5. package/dist/components/Actions/ActionsDropdown.d.ts +3 -0
  6. package/dist/components/Actions/index.d.ts +4 -0
  7. package/dist/components/Actions/types.d.ts +14 -0
  8. package/dist/components/Buttons/Button.d.ts +2 -0
  9. package/dist/components/Buttons/IconButton.d.ts +2 -0
  10. package/dist/components/Buttons/ToTop.d.ts +1 -0
  11. package/dist/components/Buttons/index.d.ts +3 -0
  12. package/dist/components/Buttons/types.d.ts +12 -0
  13. package/dist/components/Chip/Chip.d.ts +7 -0
  14. package/dist/components/Chip/DeletableChip.d.ts +2 -0
  15. package/dist/components/Chip/index.d.ts +3 -0
  16. package/dist/components/Chip/types.d.ts +12 -0
  17. package/dist/components/Dialog/ConfirmationDialog.d.ts +2 -0
  18. package/dist/components/Dialog/Dialog.d.ts +2 -0
  19. package/dist/components/Dialog/FormDialog.d.ts +3 -0
  20. package/dist/components/Dialog/index.d.ts +4 -0
  21. package/dist/components/Dialog/types.d.ts +18 -0
  22. package/dist/components/Drawer/Drawer.d.ts +2 -0
  23. package/dist/components/Drawer/index.d.ts +2 -0
  24. package/dist/components/Drawer/types.d.ts +6 -0
  25. package/dist/components/Dropdown/Dropdown.d.ts +2 -0
  26. package/dist/components/Dropdown/index.d.ts +2 -0
  27. package/dist/components/Dropdown/types.d.ts +6 -0
  28. package/dist/components/Empty/Empty.d.ts +3 -0
  29. package/dist/components/Empty/index.d.ts +2 -0
  30. package/dist/components/Empty/types.d.ts +9 -0
  31. package/dist/components/Error/Error.d.ts +2 -0
  32. package/dist/components/Error/index.d.ts +2 -0
  33. package/dist/components/Error/types.d.ts +4 -0
  34. package/dist/components/Form/FormContainer.d.ts +3 -0
  35. package/dist/components/Form/ParagraphInput.d.ts +7 -0
  36. package/dist/components/Form/PasswordInput.d.ts +2 -0
  37. package/dist/components/Form/index.d.ts +4 -0
  38. package/dist/components/Form/types.d.ts +20 -0
  39. package/dist/components/Loading/Loading.d.ts +2 -0
  40. package/dist/components/Loading/SplashScreen.d.ts +1 -0
  41. package/dist/components/Loading/index.d.ts +3 -0
  42. package/dist/components/Loading/types.d.ts +6 -0
  43. package/dist/components/Navbar/Clock.d.ts +1 -0
  44. package/dist/components/Navbar/Navbar.d.ts +2 -0
  45. package/dist/components/Navbar/index.d.ts +2 -0
  46. package/dist/components/Navbar/types.d.ts +3 -0
  47. package/dist/components/Notification/Notification.d.ts +1 -0
  48. package/dist/components/Notification/index.d.ts +1 -0
  49. package/dist/components/Onboarding/Onboarding.d.ts +2 -0
  50. package/dist/components/Onboarding/Step.d.ts +2 -0
  51. package/dist/components/Onboarding/index.d.ts +3 -0
  52. package/dist/components/Onboarding/types.d.ts +10 -0
  53. package/dist/components/Page/Page.d.ts +3 -0
  54. package/dist/components/Page/PageHeader.d.ts +3 -0
  55. package/dist/components/Page/index.d.ts +2 -0
  56. package/dist/components/Page/types.d.ts +19 -0
  57. package/dist/components/PrettyGrid/PrettyGrid.d.ts +3 -0
  58. package/dist/components/PrettyGrid/index.d.ts +2 -0
  59. package/dist/components/PrettyGrid/types.d.ts +9 -0
  60. package/dist/components/TabsLayout/Tab.d.ts +2 -0
  61. package/dist/components/TabsLayout/TabsLayout.d.ts +2 -0
  62. package/dist/components/TabsLayout/index.d.ts +3 -0
  63. package/dist/components/TabsLayout/types.d.ts +21 -0
  64. package/dist/components/index.d.ts +18 -0
  65. package/dist/components/types.d.ts +8 -0
  66. package/dist/dashboard-app.cjs +1 -0
  67. package/dist/dashboard-app.js +2858 -0
  68. package/dist/hooks/actions/index.d.ts +5 -0
  69. package/dist/hooks/actions/types.d.ts +24 -0
  70. package/dist/hooks/actions/useDeleteAction.d.ts +12 -0
  71. package/dist/hooks/actions/useEditAction.d.ts +6 -0
  72. package/dist/hooks/actions/useExportAction.d.ts +11 -0
  73. package/dist/hooks/actions/useRestoreAction.d.ts +12 -0
  74. package/dist/hooks/dialogs/index.d.ts +5 -0
  75. package/dist/hooks/dialogs/types.d.ts +27 -0
  76. package/dist/hooks/dialogs/useDeleteDialog.d.ts +17 -0
  77. package/dist/hooks/dialogs/useDialog.d.ts +6 -0
  78. package/dist/hooks/dialogs/useFormDialog.d.ts +4 -0
  79. package/dist/hooks/dialogs/useRestoreDialog.d.ts +17 -0
  80. package/dist/hooks/forms/index.d.ts +3 -0
  81. package/dist/hooks/forms/types.d.ts +20 -0
  82. package/dist/hooks/forms/useConfirmationForm.d.ts +8 -0
  83. package/dist/hooks/forms/usePostForm.d.ts +5 -0
  84. package/dist/hooks/index.d.ts +7 -0
  85. package/dist/hooks/mutate/index.d.ts +1 -0
  86. package/dist/hooks/mutate/types.d.ts +9 -0
  87. package/dist/hooks/mutate/useExportActionMutate.d.ts +11 -0
  88. package/dist/hooks/queries/index.d.ts +1 -0
  89. package/dist/hooks/queries/types.d.ts +12 -0
  90. package/dist/hooks/useScrollTrigger.d.ts +1 -0
  91. package/dist/hooks/useTimeAge.d.ts +3 -0
  92. package/dist/index.d.ts +2 -0
  93. package/dist/lib/Notification.d.ts +11 -0
  94. package/dist/lib/ServiceError.d.ts +4 -0
  95. package/dist/lib/ValidationError.d.ts +3 -0
  96. package/dist/lib/api/APIClient.d.ts +48 -0
  97. package/dist/lib/api/AuthClient.d.ts +10 -0
  98. package/dist/lib/api/BaseClient.d.ts +59 -0
  99. package/dist/lib/api/IManager.d.ts +9 -0
  100. package/dist/lib/api/index.d.ts +6 -0
  101. package/dist/lib/api/types.d.ts +24 -0
  102. package/dist/lib/api/utils/index.d.ts +2 -0
  103. package/dist/lib/api/utils/query.d.ts +9 -0
  104. package/dist/lib/api/utils/services.d.ts +24 -0
  105. package/dist/lib/entities/auth/AuthDto.d.ts +4 -0
  106. package/dist/lib/entities/auth/RegisterDto.d.ts +4 -0
  107. package/dist/lib/entities/auth/SessionDto.d.ts +6 -0
  108. package/dist/lib/entities/auth/index.d.ts +3 -0
  109. package/dist/lib/entities/base/BaseCommonEntityDto.d.ts +4 -0
  110. package/dist/lib/entities/base/BaseEntityDto.d.ts +6 -0
  111. package/dist/lib/entities/base/BaseFilterDto.d.ts +3 -0
  112. package/dist/lib/entities/base/DeleteDto.d.ts +3 -0
  113. package/dist/lib/entities/base/index.d.ts +5 -0
  114. package/dist/lib/entities/index.d.ts +3 -0
  115. package/dist/lib/entities/user/CommonUserDto.d.ts +2 -0
  116. package/dist/lib/entities/user/index.d.ts +1 -0
  117. package/dist/lib/index.d.ts +8 -0
  118. package/dist/lib/models/index.d.ts +0 -0
  119. package/dist/lib/utils/date.d.ts +11 -0
  120. package/dist/lib/utils/enums.d.ts +4 -0
  121. package/dist/lib/utils/index.d.ts +6 -0
  122. package/dist/lib/utils/local.d.ts +20 -0
  123. package/dist/lib/utils/navigation.d.ts +56 -0
  124. package/dist/lib/utils/os.d.ts +1 -0
  125. package/dist/lib/utils/queryKey.d.ts +7 -0
  126. package/dist/main.css +1 -0
  127. package/dist/main.d.ts +4 -0
  128. package/dist/providers/AuthProvider.d.ts +13 -0
  129. package/dist/providers/ConfigProvider.d.ts +13 -0
  130. package/dist/providers/ManagerProvider.d.ts +15 -0
  131. package/dist/providers/NotificationProvider.d.ts +7 -0
  132. package/dist/providers/index.d.ts +5 -0
  133. package/dist/providers/types.d.ts +57 -0
  134. package/package.json +80 -0
@@ -0,0 +1,2858 @@
1
+ var ms = Object.defineProperty;
2
+ var ys = (e, t, s) => t in e ? ms(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var ue = (e, t, s) => ys(e, typeof t != "symbol" ? t + "" : t, s);
4
+ import "./main.css";
5
+ import { jsxs as N, jsx as h, Fragment as Te } from "react/jsx-runtime";
6
+ import { FontAwesomeIcon as ee } from "@fortawesome/react-fontawesome";
7
+ import { useTranslation as P, State as gs, inputStateClassName as bs, labelStateClassName as ps, helperTextStateClassName as ws, TextInput as vs, useTableOptions as xs, Badge as _s, Loading as Cs } from "@sito/dashboard";
8
+ import { faClose as tt, faTrash as Ss, faRotateLeft as Dt, faPencil as Ns, faCircleNotch as Vt, faDownload as ks, faArrowUp as As, faEllipsisV as Es, faEyeSlash as $s, faEye as Fs, faArrowLeft as Ls, faAdd as gt, faFilter as Ts, faBars as Ds, faSearch as Vs, faCircleCheck as Ps, faWarning as Ms } from "@fortawesome/free-solid-svg-icons";
9
+ import X, { useRef as Pt, useCallback as F, useEffect as te, useReducer as Os, createContext as qe, useContext as Be, useState as se, forwardRef as Mt, useMemo as De } from "react";
10
+ import { createPortal as Ot } from "react-dom";
11
+ import { css as Is } from "@emotion/css";
12
+ import { QueryClient as Us, QueryClientProvider as Rs, useMutation as je, useQuery as qs } from "@tanstack/react-query";
13
+ import { faSadTear as Bs } from "@fortawesome/free-regular-svg-icons";
14
+ const js = (e) => {
15
+ const {
16
+ text: t,
17
+ children: s,
18
+ icon: r,
19
+ variant: i = "primary",
20
+ className: n = "",
21
+ iconClassName: c = "text-primary",
22
+ ...a
23
+ } = e;
24
+ return /* @__PURE__ */ N("div", { className: `chip ${i} ${n}`, ...a, children: [
25
+ r ? /* @__PURE__ */ h(ee, { icon: r, className: c }) : null,
26
+ t ?? s
27
+ ] });
28
+ }, Br = (e) => {
29
+ const { t } = P(), { onDelete: s, text: r, ...i } = e;
30
+ return /* @__PURE__ */ N(js, { ...i, className: "!pr-1", children: [
31
+ /* @__PURE__ */ h("p", { children: r }),
32
+ /* @__PURE__ */ h(
33
+ me,
34
+ {
35
+ name: t("_accessibility:buttons.deleteChip", { value: r }),
36
+ "aria-label": t("_accessibility:ariaLabels.deleteChip", {
37
+ value: r
38
+ }),
39
+ className: "hover:text-red-300",
40
+ onClick: s,
41
+ icon: tt
42
+ }
43
+ )
44
+ ] });
45
+ };
46
+ function It(e) {
47
+ const {
48
+ id: t,
49
+ icon: s,
50
+ tooltip: r,
51
+ onClick: i,
52
+ children: n,
53
+ hidden: c = !1,
54
+ disabled: a = !1,
55
+ showText: m = !1,
56
+ showTooltips: y = !0
57
+ } = e;
58
+ return c ? null : /* @__PURE__ */ N(
59
+ "button",
60
+ {
61
+ id: t,
62
+ className: `action ${m ? "text-action" : "icon-action"}`,
63
+ disabled: a,
64
+ onClick: () => i(),
65
+ "aria-disabled": a,
66
+ "data-tooltip-id": "tooltip",
67
+ "data-tooltip-content": y ? r : "",
68
+ children: [
69
+ s,
70
+ " ",
71
+ m && r,
72
+ n
73
+ ]
74
+ }
75
+ );
76
+ }
77
+ function Ut(e) {
78
+ const {
79
+ actions: t = [],
80
+ className: s = "",
81
+ showTooltips: r = !0,
82
+ showActionTexts: i = !1
83
+ } = e;
84
+ return /* @__PURE__ */ h("ul", { className: `actions-container ${s}`, children: t == null ? void 0 : t.map((n) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
85
+ It,
86
+ {
87
+ showTooltips: r,
88
+ showText: i,
89
+ ...n,
90
+ children: n.children
91
+ }
92
+ ) }, n.id)) });
93
+ }
94
+ const Hs = (e) => {
95
+ const { children: t, open: s, onClose: r } = e, i = Pt(null), n = F(
96
+ (a) => {
97
+ const m = i.current;
98
+ !s || !m || m.contains(a.target) || r();
99
+ },
100
+ [s, r]
101
+ ), c = F(
102
+ (a) => {
103
+ s && a.key === "Escape" && r();
104
+ },
105
+ [s, r]
106
+ );
107
+ return te(() => {
108
+ if (s)
109
+ return setTimeout(() => {
110
+ var a;
111
+ return (a = i.current) == null ? void 0 : a.focus();
112
+ }, 0), document.addEventListener("mousedown", n), document.addEventListener("keydown", c), () => {
113
+ document.removeEventListener("mousedown", n), document.removeEventListener("keydown", c);
114
+ };
115
+ }, [s, n, c]), /* @__PURE__ */ h(
116
+ "div",
117
+ {
118
+ ref: i,
119
+ role: "menu",
120
+ "aria-hidden": !s,
121
+ tabIndex: -1,
122
+ className: `dropdown-main ${s ? "opened" : "closed"}`,
123
+ onClick: (a) => a.stopPropagation(),
124
+ children: t
125
+ }
126
+ );
127
+ }, me = (e) => {
128
+ const {
129
+ children: t,
130
+ icon: s,
131
+ type: r = "button",
132
+ className: i = "",
133
+ variant: n = "text",
134
+ color: c = "default",
135
+ iconClassName: a = "",
136
+ ...m
137
+ } = e;
138
+ return /* @__PURE__ */ N(
139
+ "button",
140
+ {
141
+ type: r,
142
+ className: `icon-button ${i} ${n} ${c}`,
143
+ ...m,
144
+ children: [
145
+ /* @__PURE__ */ h(ee, { icon: s, className: `!w-auto ${a}` }),
146
+ t
147
+ ]
148
+ }
149
+ );
150
+ }, fe = (e) => {
151
+ const {
152
+ children: t,
153
+ type: s = "button",
154
+ variant: r = "text",
155
+ color: i = "default",
156
+ className: n = "",
157
+ ...c
158
+ } = e;
159
+ return /* @__PURE__ */ h("button", { type: s, className: `button ${r} ${i} ${n}`, ...c, children: t });
160
+ };
161
+ var Xe, bt;
162
+ function Qs() {
163
+ if (bt) return Xe;
164
+ bt = 1;
165
+ const e = (a, m = "local", y = void 0) => {
166
+ if (m === "local") {
167
+ if (localStorage.getItem(a) !== void 0 && localStorage.getItem(a) !== "undefined" && localStorage.getItem(a) !== null)
168
+ return y === void 0 || y !== void 0 && localStorage.getItem(a) === y;
169
+ } else if (m === "session" && sessionStorage.getItem(a) !== void 0 && sessionStorage.getItem(a) !== "undefined" && sessionStorage.getItem(a) !== null)
170
+ return y === void 0 || y !== void 0 && sessionStorage.getItem(a) === y;
171
+ return !1;
172
+ }, t = (a) => {
173
+ const m = {};
174
+ return a.substring(1).split("&").forEach((d) => {
175
+ const [g, f] = d.split("=");
176
+ m[g] = f;
177
+ }), m;
178
+ }, s = (a = "") => {
179
+ if (n(a) && a.length) return n(a);
180
+ {
181
+ let m = navigator.language || navigator.userLanguage;
182
+ if (m.indexOf("en") < 0 && m.indexOf("es") < 0 && (m = "en-US"), m = m.split("-")[0], m)
183
+ return a.length && i(a, 730, m), m;
184
+ }
185
+ return "en";
186
+ }, r = (a = 0, m = 0, y = window, d = "smooth") => y.scroll({
187
+ top: a,
188
+ left: m,
189
+ behavior: d
190
+ }), i = (a, m, y, d = "/", g = "Lax") => {
191
+ var f = /* @__PURE__ */ new Date();
192
+ f.setTime(f.getTime() + m * 24 * 60 * 60 * 1e3);
193
+ const x = "; expires=" + f.toUTCString();
194
+ document.cookie = `${a}=${y || ""}${x};path=${d};SameSite=${g}`;
195
+ }, n = (a) => {
196
+ const m = `${a}=`, d = decodeURIComponent(document.cookie).split(";");
197
+ for (let g = 0; g < d.length; g += 1) {
198
+ let f = d[g];
199
+ for (; f.charAt(0) === " "; )
200
+ f = f.substring(1);
201
+ if (f.indexOf(m) === 0)
202
+ return f.substring(m.length, f.length);
203
+ }
204
+ return "";
205
+ };
206
+ return Xe = {
207
+ getCookie: n,
208
+ createCookie: i,
209
+ deleteCookie: (a) => document.cookie = `${a}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`,
210
+ getUserLanguage: s,
211
+ scrollTo: r,
212
+ parseQueries: t,
213
+ validation: e
214
+ }, Xe;
215
+ }
216
+ var Ks = Qs();
217
+ function jr() {
218
+ const { t: e, language: t } = P();
219
+ return { timeAge: F(
220
+ (r) => {
221
+ const n = /* @__PURE__ */ new Date() - r, c = Math.floor(n / (1e3 * 60)), a = Math.floor(c / 60), m = t === "es", y = e("_accessibility:labels.ago"), d = e("_accessibility:labels.minute"), g = e("_accessibility:labels.minutes"), f = e("_accessibility:labels.hour"), x = e("_accessibility:labels.hours"), S = e("_accessibility:labels.yesterday"), C = e("_accessibility:labels.justNow");
222
+ return n < 1e3 * 60 ? C : c < 60 ? `${m ? y : ""} ${c} ${c === 1 ? d : g} ${m ? "" : y}` : a < 24 ? `${m ? y : ""} ${a} ${a === 1 ? f : x} ${m ? "" : y}` : a < 48 ? S : r.toLocaleDateString(navigator.language || "es-ES", {
223
+ day: "2-digit",
224
+ month: "2-digit",
225
+ year: "numeric"
226
+ });
227
+ },
228
+ [e, t]
229
+ ) };
230
+ }
231
+ var j = /* @__PURE__ */ ((e) => (e[e.success = 0] = "success", e[e.error = 1] = "error", e[e.warning = 2] = "warning", e[e.info = 3] = "info", e))(j || {});
232
+ const Ws = (e) => e < 200 || e > 299;
233
+ var Z = /* @__PURE__ */ ((e) => (e.GET = "GET", e.POST = "POST", e.PUT = "PUT", e.PATCH = "PATCH", e.DELETE = "DELETE", e))(Z || {});
234
+ async function Ae(e, t = "GET", s, r) {
235
+ var c;
236
+ const i = {
237
+ "Content-Type": "application/json",
238
+ ...r
239
+ }, n = {
240
+ method: t,
241
+ headers: i,
242
+ ...s ? { body: JSON.stringify(s) } : {}
243
+ };
244
+ try {
245
+ const a = await fetch(e, n), y = ((c = a.headers.get("content-type")) == null ? void 0 : c.includes("application/json")) ? await a.json() : null;
246
+ let d = null;
247
+ if (!a.ok || Ws(a.status)) {
248
+ const g = await a.text();
249
+ g && (d = {
250
+ status: a.status,
251
+ message: g
252
+ });
253
+ }
254
+ return {
255
+ data: a.ok && a.status !== 204 ? y : null,
256
+ status: a.status,
257
+ error: d
258
+ };
259
+ } catch (a) {
260
+ return {
261
+ data: null,
262
+ status: 500,
263
+ error: {
264
+ status: 500,
265
+ message: a.message || "Unknown error occurred"
266
+ }
267
+ };
268
+ }
269
+ }
270
+ function zs(e, t) {
271
+ if (t) {
272
+ const s = Object.entries(t).filter(([, r]) => r != null).map(
273
+ ([r, i]) => `${encodeURIComponent(r)}=${encodeURIComponent(String(i))}`
274
+ ).join("&");
275
+ return s ? `${e}?${s}` : e;
276
+ }
277
+ return e;
278
+ }
279
+ const Rt = (e, t, s) => {
280
+ const r = [];
281
+ if (t) {
282
+ const { sortingBy: i, sortingOrder: n, currentPage: c, pageSize: a } = t;
283
+ r.push(
284
+ `sort=${String(i)}`,
285
+ `order=${n}`,
286
+ `page=${c}`,
287
+ `pageSize=${a}`
288
+ );
289
+ }
290
+ if (s) {
291
+ const i = Object.entries(s).filter(
292
+ ([, n]) => n != null && n !== ""
293
+ ).flatMap(([n, c]) => {
294
+ if (Array.isArray(c))
295
+ return c.map((a) => `${n}==${encodeURIComponent((a == null ? void 0 : a.id) ?? a)}`);
296
+ if (typeof c == "object" && c !== null && "start" in c && "end" in c) {
297
+ const a = [];
298
+ return c.start != null && c.start !== "" && a.push(`${n}>=${encodeURIComponent(c.start)}`), c.end != null && c.end !== "" && a.push(`${n}<=${encodeURIComponent(c.end)}`), a;
299
+ }
300
+ return typeof c == "object" && c !== null ? `${n}==${encodeURIComponent(c.id ?? "")}` : `${n}==${encodeURIComponent(c)}`;
301
+ });
302
+ i.length > 0 && r.push(`filters=${i.join(",")}`);
303
+ }
304
+ return r.length ? `${e}?${r.join("&")}` : e;
305
+ };
306
+ class qt {
307
+ /**
308
+ * @param baseUrl the base url of the server
309
+ * @param userKey the local storage user key
310
+ * @param secured if the api client requires token
311
+ * @param tokenAcquirer custom token acquirer
312
+ */
313
+ constructor(t, s = "user", r = !0, i = null) {
314
+ ue(this, "baseUrl");
315
+ ue(this, "userKey");
316
+ ue(this, "secured");
317
+ ue(this, "tokenAcquirer");
318
+ this.baseUrl = t, this.secured = r, this.userKey = s, i || (this.tokenAcquirer = this.defaultTokenAcquirer);
319
+ }
320
+ defaultTokenAcquirer(t) {
321
+ if (t) return { credentials: "include" };
322
+ const s = Bt(this.userKey);
323
+ if (s && s.length)
324
+ return { Authorization: `Bearer ${s}` };
325
+ }
326
+ async doQuery(t, s = Z.GET, r, i) {
327
+ const n = this.secured ? this.defaultTokenAcquirer() : {}, { data: c, status: a } = await Ae(
328
+ `${this.baseUrl}${t}`,
329
+ s,
330
+ r,
331
+ {
332
+ ...n,
333
+ ...i ?? {}
334
+ }
335
+ );
336
+ if (a !== 200 && a !== 204) throw new Error(String(a));
337
+ return c;
338
+ }
339
+ /**
340
+ * @description Get all objects
341
+ * @param endpoint - backed endpoint
342
+ * @param query - query parameters
343
+ * @returns Result list
344
+ */
345
+ async get(t, s, r) {
346
+ const i = Rt(t, s, r), n = this.secured ? this.defaultTokenAcquirer() : void 0, { data: c, error: a } = await Ae(
347
+ `${this.baseUrl}${i}`,
348
+ Z.GET,
349
+ null,
350
+ n
351
+ );
352
+ if (a) throw new Error(`${a.status} ${a.message}`);
353
+ return c;
354
+ }
355
+ /**
356
+ * @description Get entity by id
357
+ * @param endpoint - backed endpoint
358
+ * @param data - data to update
359
+ * @returns updated entity
360
+ */
361
+ async patch(t, s) {
362
+ const r = this.secured ? this.defaultTokenAcquirer() : void 0, { error: i, data: n } = await Ae(
363
+ `${this.baseUrl}${t}`,
364
+ Z.PATCH,
365
+ s,
366
+ r
367
+ );
368
+ if (i || !n) throw new Error(i == null ? void 0 : i.message);
369
+ return n;
370
+ }
371
+ /**
372
+ * @param endpoint - backend endpoint
373
+ * @param data - value to insert
374
+ * @returns delete result
375
+ */
376
+ async delete(t, s) {
377
+ const r = this.secured ? this.defaultTokenAcquirer() : void 0, { error: i, data: n } = await Ae(
378
+ `${this.baseUrl}${t}`,
379
+ Z.DELETE,
380
+ s,
381
+ r
382
+ );
383
+ if (i || !n) throw new Error(i == null ? void 0 : i.message);
384
+ return n;
385
+ }
386
+ /**
387
+ *
388
+ * @param endpoint - backend endpoint
389
+ * @param data - value to insert
390
+ * @returns inserted item
391
+ */
392
+ async post(t, s) {
393
+ const r = this.secured ? this.defaultTokenAcquirer() : void 0, { error: i, data: n } = await Ae(
394
+ `${this.baseUrl}${t}`,
395
+ Z.POST,
396
+ s,
397
+ r
398
+ );
399
+ if (i || !n)
400
+ throw new Error((i == null ? void 0 : i.message) ?? String(i == null ? void 0 : i.status));
401
+ return n;
402
+ }
403
+ }
404
+ class Gs {
405
+ constructor(t, s = "user") {
406
+ ue(this, "api");
407
+ this.api = new qt(t, s, !1);
408
+ }
409
+ async login(t) {
410
+ const s = "auth/sign-in", r = t;
411
+ return await this.api.doQuery(
412
+ s,
413
+ Z.POST,
414
+ r
415
+ );
416
+ }
417
+ async logout() {
418
+ return await this.api.doQuery("auth/sign-out", Z.POST);
419
+ }
420
+ async register(t) {
421
+ return await this.api.doQuery(
422
+ "auth/sign-up",
423
+ Z.POST,
424
+ t
425
+ );
426
+ }
427
+ async getSession() {
428
+ return await this.api.doQuery("auth/session", Z.GET, null, {
429
+ ...this.api.defaultTokenAcquirer()
430
+ });
431
+ }
432
+ }
433
+ class Hr {
434
+ constructor(t, s) {
435
+ ue(this, "auth");
436
+ this.auth = new Gs(t, s);
437
+ }
438
+ /**
439
+ * @returns auth
440
+ */
441
+ get Auth() {
442
+ return this.auth;
443
+ }
444
+ }
445
+ class Qr {
446
+ /**
447
+ *
448
+ * @param table
449
+ * @param secured to see if the api client requires jwt protection
450
+ */
451
+ constructor(t, s, r = "user", i = !0) {
452
+ ue(this, "table");
453
+ ue(this, "secured");
454
+ ue(this, "api");
455
+ this.table = t, this.secured = i, this.api = new qt(s, r, i);
456
+ }
457
+ /**
458
+ *
459
+ * @param value
460
+ * @returns inserted item
461
+ */
462
+ async insert(t) {
463
+ return await this.api.post(`${this.table}`, t);
464
+ }
465
+ /**
466
+ *
467
+ * @param data - values to insert
468
+ * @returns - Query result
469
+ */
470
+ async insertMany(t) {
471
+ return await this.api.doQuery(
472
+ `${this.table}/batch`,
473
+ Z.POST,
474
+ t
475
+ );
476
+ }
477
+ /**
478
+ *
479
+ * @param value
480
+ * @returns updated item
481
+ */
482
+ async update(t) {
483
+ return await this.api.patch(
484
+ `${this.table}/${t.id}`,
485
+ t
486
+ );
487
+ }
488
+ /**
489
+ *
490
+ * @param query - Where conditions (key-value)
491
+ * @param filters - Filters to apply
492
+ * @returns - Query result
493
+ */
494
+ async get(t, s) {
495
+ return await this.api.get(`${this.table}`, t, s);
496
+ }
497
+ /**
498
+ *
499
+ * @param filters - Filters to apply
500
+ * @returns - List of elements
501
+ */
502
+ async export(t) {
503
+ const s = Rt(
504
+ `${this.table}/export`,
505
+ void 0,
506
+ t
507
+ );
508
+ return await this.api.doQuery(s, Z.GET, void 0);
509
+ }
510
+ /**
511
+ *
512
+ * @param query - Where conditions (key-value)
513
+ * @returns - Query result
514
+ */
515
+ async commonGet(t) {
516
+ return await this.api.doQuery(
517
+ zs(`${this.table}/common`, t),
518
+ Z.GET
519
+ );
520
+ }
521
+ /**
522
+ *
523
+ * @param id
524
+ * @returns - Query result
525
+ */
526
+ async getById(t) {
527
+ return await this.api.doQuery(`${this.table}/${t}`);
528
+ }
529
+ async softDelete(t) {
530
+ return await this.api.delete(`${this.table}`, t);
531
+ }
532
+ async restore(t) {
533
+ return await this.api.patch(`${this.table}/restore`, t);
534
+ }
535
+ }
536
+ function Kr(e) {
537
+ return Object.keys(e).filter((t) => isNaN(Number(t))).map((t) => ({
538
+ key: t,
539
+ value: e[t]
540
+ }));
541
+ }
542
+ const Bt = (e, t = "") => {
543
+ const s = localStorage.getItem(e) ?? void 0;
544
+ if (s && t.length)
545
+ switch (t) {
546
+ case "object":
547
+ return JSON.parse(s);
548
+ case "number":
549
+ return Number(s);
550
+ case "boolean":
551
+ return s === "true" || s === "1";
552
+ default:
553
+ return s;
554
+ }
555
+ return s;
556
+ }, pt = (e, t) => localStorage.setItem(
557
+ e,
558
+ typeof t == "object" ? JSON.stringify(t) : t
559
+ ), wt = (e) => localStorage.removeItem(e);
560
+ function vt(e) {
561
+ const t = e ? new Date(e) : /* @__PURE__ */ new Date(), s = {
562
+ weekday: "long",
563
+ // martes
564
+ day: "numeric",
565
+ // 29
566
+ month: "long",
567
+ // julio
568
+ year: "numeric",
569
+ // 2025
570
+ hour: "numeric",
571
+ // 3
572
+ minute: "2-digit",
573
+ // 42
574
+ hour12: !0
575
+ // PM
576
+ };
577
+ return t.toLocaleString(
578
+ navigator.language || "es-ES",
579
+ s
580
+ );
581
+ }
582
+ function Wr(e) {
583
+ const t = e ? new Date(e) : /* @__PURE__ */ new Date(), s = t.getFullYear(), r = String(t.getMonth() + 1).padStart(2, "0"), i = String(t.getDate()).padStart(2, "0"), n = String(t.getHours()).padStart(2, "0"), c = String(t.getMinutes()).padStart(2, "0");
584
+ return `${s}-${r}-${i}T${n}:${c}`;
585
+ }
586
+ const Js = () => {
587
+ var s;
588
+ const e = navigator, t = ((s = e == null ? void 0 : e.userAgentData) == null ? void 0 : s.platform) || (e == null ? void 0 : e.platform) || "";
589
+ return /Mac|iPhone|iPod|iPad/i.test(t);
590
+ }, jt = qe({});
591
+ function zr(e) {
592
+ const { children: t } = e, [s, r] = Os(
593
+ (y, d) => {
594
+ const { type: g, items: f, index: x } = d;
595
+ switch (g) {
596
+ case "set":
597
+ return (f == null ? void 0 : f.map((S, C) => ({
598
+ ...S,
599
+ id: C
600
+ }))) ?? [];
601
+ case "remove":
602
+ return x !== void 0 ? y.filter((S, C) => C !== x) : [];
603
+ }
604
+ return y;
605
+ },
606
+ [],
607
+ () => []
608
+ ), i = (y) => r({
609
+ type: "set",
610
+ items: [{ ...y, type: j.error }]
611
+ }), n = (y) => r({
612
+ type: "set",
613
+ items: [{ ...y }]
614
+ }), c = (y) => r({ type: "set", items: y }), a = (y) => r({
615
+ type: "set",
616
+ items: [{ ...y, type: j.success }]
617
+ }), m = (y) => r({ type: "remove", index: y });
618
+ return /* @__PURE__ */ h(
619
+ jt.Provider,
620
+ {
621
+ value: {
622
+ notification: s,
623
+ removeNotification: m,
624
+ showErrorNotification: i,
625
+ showNotification: n,
626
+ showSuccessNotification: a,
627
+ showStackNotifications: c
628
+ },
629
+ children: t
630
+ }
631
+ );
632
+ }
633
+ const Ne = () => {
634
+ const e = Be(jt);
635
+ if (e === void 0)
636
+ throw new Error("NotificationContext must be used within a Provider");
637
+ return e;
638
+ }, Ce = new Us({
639
+ defaultOptions: {
640
+ queries: {
641
+ refetchInterval: !1,
642
+ refetchOnMount: !0,
643
+ refetchOnReconnect: !1,
644
+ retry: !1,
645
+ retryOnMount: !0,
646
+ refetchOnWindowFocus: !1
647
+ // default: true
648
+ }
649
+ }
650
+ }), Ht = qe({}), Gr = (e) => {
651
+ const { children: t, manager: s } = e;
652
+ return /* @__PURE__ */ h(Ht.Provider, { value: { client: s }, children: /* @__PURE__ */ h(Rs, { client: Ce, children: t }) });
653
+ }, Ys = () => {
654
+ const e = Be(Ht);
655
+ if (e === void 0)
656
+ throw new Error("managerContext must be used within a Provider");
657
+ return e.client;
658
+ }, Qt = qe({}), Jr = (e) => {
659
+ const { children: t, guestMode: s = "guest_mode", user: r = "user" } = e, i = Ys(), [n, c] = se({}), a = F(() => !!Bt(s, "boolean") && n.token === void 0, [n.token]), m = F((x) => {
660
+ pt(s, x);
661
+ }, []), y = F((x) => {
662
+ x && (c(x), wt(s), pt(r, x.token));
663
+ }, []), d = F(async () => {
664
+ try {
665
+ await i.Auth.logout();
666
+ } catch (x) {
667
+ console.error(x);
668
+ }
669
+ c({}), wt(r);
670
+ }, [i.Auth]), g = F(async () => {
671
+ try {
672
+ const x = await i.Auth.getSession();
673
+ y(x);
674
+ } catch (x) {
675
+ console.error(x), d();
676
+ }
677
+ }, [y, d, i.Auth]), f = {
678
+ account: n,
679
+ logUser: y,
680
+ logoutUser: d,
681
+ logUserFromLocal: g,
682
+ isInGuestMode: a,
683
+ setGuestMode: m
684
+ };
685
+ return /* @__PURE__ */ h(Qt.Provider, { value: f, children: t });
686
+ }, Kt = () => {
687
+ const e = Be(Qt);
688
+ if (e === void 0)
689
+ throw new Error("authContext must be used within a Provider");
690
+ return e;
691
+ }, Wt = qe({}), Yr = (e) => {
692
+ const { children: t, location: s, navigate: r, linkComponent: i, searchComponent: n } = e;
693
+ return /* @__PURE__ */ h(
694
+ Wt.Provider,
695
+ {
696
+ value: { location: s, navigate: r, linkComponent: i, searchComponent: n },
697
+ children: t
698
+ }
699
+ );
700
+ }, He = () => {
701
+ const e = Be(Wt);
702
+ if (e === void 0 || Object.keys(e).length === 0)
703
+ throw new Error(
704
+ "Config provider has not been set. This step is required and cannot be skipped."
705
+ );
706
+ return e;
707
+ }, zt = (e) => {
708
+ const { showSuccessNotification: t } = Ne(), { mutationFn: s, onError: r, onSuccess: i, onSuccessMessage: n } = e, [c, a] = se([]), { open: m, handleClose: y, handleOpen: d } = rs(), g = () => {
709
+ y(), a([]);
710
+ }, f = async (S) => {
711
+ a(S), d();
712
+ }, x = je({
713
+ mutationFn: () => s(
714
+ Array.isArray(c) ? c : [c]
715
+ ),
716
+ onError: (S) => {
717
+ console.error(S), r && r(S), g();
718
+ },
719
+ onSuccess: async (S) => {
720
+ i && i(S), t({
721
+ message: n
722
+ }), g();
723
+ }
724
+ });
725
+ return { open: m, onClick: f, close: g, dialogFn: x, isLoading: x.isPending };
726
+ };
727
+ var Ve = (e) => e.type === "checkbox", _e = (e) => e instanceof Date, z = (e) => e == null;
728
+ const Gt = (e) => typeof e == "object";
729
+ var I = (e) => !z(e) && !Array.isArray(e) && Gt(e) && !_e(e), Xs = (e) => I(e) && e.target ? Ve(e.target) ? e.target.checked : e.target.value : e, Zs = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, er = (e, t) => e.has(Zs(t)), tr = (e) => {
730
+ const t = e.constructor && e.constructor.prototype;
731
+ return I(t) && t.hasOwnProperty("isPrototypeOf");
732
+ }, st = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
733
+ function Q(e) {
734
+ let t;
735
+ const s = Array.isArray(e), r = typeof FileList < "u" ? e instanceof FileList : !1;
736
+ if (e instanceof Date)
737
+ t = new Date(e);
738
+ else if (!(st && (e instanceof Blob || r)) && (s || I(e)))
739
+ if (t = s ? [] : {}, !s && !tr(e))
740
+ t = e;
741
+ else
742
+ for (const i in e)
743
+ e.hasOwnProperty(i) && (t[i] = Q(e[i]));
744
+ else
745
+ return e;
746
+ return t;
747
+ }
748
+ var Qe = (e) => /^\w*$/.test(e), R = (e) => e === void 0, rt = (e) => Array.isArray(e) ? e.filter(Boolean) : [], nt = (e) => rt(e.replace(/["|']|\]/g, "").split(/\.|\[/)), v = (e, t, s) => {
749
+ if (!t || !I(e))
750
+ return s;
751
+ const r = (Qe(t) ? [t] : nt(t)).reduce((i, n) => z(i) ? i : i[n], e);
752
+ return R(r) || r === e ? R(e[t]) ? s : e[t] : r;
753
+ }, de = (e) => typeof e == "boolean", M = (e, t, s) => {
754
+ let r = -1;
755
+ const i = Qe(t) ? [t] : nt(t), n = i.length, c = n - 1;
756
+ for (; ++r < n; ) {
757
+ const a = i[r];
758
+ let m = s;
759
+ if (r !== c) {
760
+ const y = e[a];
761
+ m = I(y) || Array.isArray(y) ? y : isNaN(+i[r + 1]) ? {} : [];
762
+ }
763
+ if (a === "__proto__" || a === "constructor" || a === "prototype")
764
+ return;
765
+ e[a] = m, e = e[a];
766
+ }
767
+ };
768
+ const xt = {
769
+ BLUR: "blur",
770
+ FOCUS_OUT: "focusout"
771
+ }, ce = {
772
+ onBlur: "onBlur",
773
+ onChange: "onChange",
774
+ onSubmit: "onSubmit",
775
+ onTouched: "onTouched",
776
+ all: "all"
777
+ }, ye = {
778
+ max: "max",
779
+ min: "min",
780
+ maxLength: "maxLength",
781
+ minLength: "minLength",
782
+ pattern: "pattern",
783
+ required: "required",
784
+ validate: "validate"
785
+ }, sr = X.createContext(null);
786
+ sr.displayName = "HookFormContext";
787
+ var rr = (e, t, s, r = !0) => {
788
+ const i = {
789
+ defaultValues: t._defaultValues
790
+ };
791
+ for (const n in e)
792
+ Object.defineProperty(i, n, {
793
+ get: () => {
794
+ const c = n;
795
+ return t._proxyFormState[c] !== ce.all && (t._proxyFormState[c] = !r || ce.all), e[c];
796
+ }
797
+ });
798
+ return i;
799
+ };
800
+ const nr = typeof window < "u" ? X.useLayoutEffect : X.useEffect;
801
+ var he = (e) => typeof e == "string", ir = (e, t, s, r, i) => he(e) ? (r && t.watch.add(e), v(s, e, i)) : Array.isArray(e) ? e.map((n) => (r && t.watch.add(n), v(s, n))) : (r && (t.watchAll = !0), s), et = (e) => z(e) || !Gt(e);
802
+ function pe(e, t, s = /* @__PURE__ */ new WeakSet()) {
803
+ if (et(e) || et(t))
804
+ return e === t;
805
+ if (_e(e) && _e(t))
806
+ return e.getTime() === t.getTime();
807
+ const r = Object.keys(e), i = Object.keys(t);
808
+ if (r.length !== i.length)
809
+ return !1;
810
+ if (s.has(e) || s.has(t))
811
+ return !0;
812
+ s.add(e), s.add(t);
813
+ for (const n of r) {
814
+ const c = e[n];
815
+ if (!i.includes(n))
816
+ return !1;
817
+ if (n !== "ref") {
818
+ const a = t[n];
819
+ if (_e(c) && _e(a) || I(c) && I(a) || Array.isArray(c) && Array.isArray(a) ? !pe(c, a, s) : c !== a)
820
+ return !1;
821
+ }
822
+ }
823
+ return !0;
824
+ }
825
+ var or = (e, t, s, r, i) => t ? {
826
+ ...s[e],
827
+ types: {
828
+ ...s[e] && s[e].types ? s[e].types : {},
829
+ [r]: i || !0
830
+ }
831
+ } : {}, Fe = (e) => Array.isArray(e) ? e : [e], _t = () => {
832
+ let e = [];
833
+ return {
834
+ get observers() {
835
+ return e;
836
+ },
837
+ next: (i) => {
838
+ for (const n of e)
839
+ n.next && n.next(i);
840
+ },
841
+ subscribe: (i) => (e.push(i), {
842
+ unsubscribe: () => {
843
+ e = e.filter((n) => n !== i);
844
+ }
845
+ }),
846
+ unsubscribe: () => {
847
+ e = [];
848
+ }
849
+ };
850
+ }, J = (e) => I(e) && !Object.keys(e).length, it = (e) => e.type === "file", le = (e) => typeof e == "function", Ie = (e) => {
851
+ if (!st)
852
+ return !1;
853
+ const t = e ? e.ownerDocument : 0;
854
+ return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
855
+ }, Jt = (e) => e.type === "select-multiple", ot = (e) => e.type === "radio", ar = (e) => ot(e) || Ve(e), Ze = (e) => Ie(e) && e.isConnected;
856
+ function cr(e, t) {
857
+ const s = t.slice(0, -1).length;
858
+ let r = 0;
859
+ for (; r < s; )
860
+ e = R(e) ? r++ : e[t[r++]];
861
+ return e;
862
+ }
863
+ function lr(e) {
864
+ for (const t in e)
865
+ if (e.hasOwnProperty(t) && !R(e[t]))
866
+ return !1;
867
+ return !0;
868
+ }
869
+ function U(e, t) {
870
+ const s = Array.isArray(t) ? t : Qe(t) ? [t] : nt(t), r = s.length === 1 ? e : cr(e, s), i = s.length - 1, n = s[i];
871
+ return r && delete r[n], i !== 0 && (I(r) && J(r) || Array.isArray(r) && lr(r)) && U(e, s.slice(0, -1)), e;
872
+ }
873
+ var Yt = (e) => {
874
+ for (const t in e)
875
+ if (le(e[t]))
876
+ return !0;
877
+ return !1;
878
+ };
879
+ function Ue(e, t = {}) {
880
+ const s = Array.isArray(e);
881
+ if (I(e) || s)
882
+ for (const r in e)
883
+ Array.isArray(e[r]) || I(e[r]) && !Yt(e[r]) ? (t[r] = Array.isArray(e[r]) ? [] : {}, Ue(e[r], t[r])) : z(e[r]) || (t[r] = !0);
884
+ return t;
885
+ }
886
+ function Xt(e, t, s) {
887
+ const r = Array.isArray(e);
888
+ if (I(e) || r)
889
+ for (const i in e)
890
+ Array.isArray(e[i]) || I(e[i]) && !Yt(e[i]) ? R(t) || et(s[i]) ? s[i] = Array.isArray(e[i]) ? Ue(e[i], []) : { ...Ue(e[i]) } : Xt(e[i], z(t) ? {} : t[i], s[i]) : s[i] = !pe(e[i], t[i]);
891
+ return s;
892
+ }
893
+ var Ee = (e, t) => Xt(e, t, Ue(t));
894
+ const Ct = {
895
+ value: !1,
896
+ isValid: !1
897
+ }, St = { value: !0, isValid: !0 };
898
+ var Zt = (e) => {
899
+ if (Array.isArray(e)) {
900
+ if (e.length > 1) {
901
+ const t = e.filter((s) => s && s.checked && !s.disabled).map((s) => s.value);
902
+ return { value: t, isValid: !!t.length };
903
+ }
904
+ return e[0].checked && !e[0].disabled ? (
905
+ // @ts-expect-error expected to work in the browser
906
+ e[0].attributes && !R(e[0].attributes.value) ? R(e[0].value) || e[0].value === "" ? St : { value: e[0].value, isValid: !0 } : St
907
+ ) : Ct;
908
+ }
909
+ return Ct;
910
+ }, es = (e, { valueAsNumber: t, valueAsDate: s, setValueAs: r }) => R(e) ? e : t ? e === "" ? NaN : e && +e : s && he(e) ? new Date(e) : r ? r(e) : e;
911
+ const Nt = {
912
+ isValid: !1,
913
+ value: null
914
+ };
915
+ var ts = (e) => Array.isArray(e) ? e.reduce((t, s) => s && s.checked && !s.disabled ? {
916
+ isValid: !0,
917
+ value: s.value
918
+ } : t, Nt) : Nt;
919
+ function kt(e) {
920
+ const t = e.ref;
921
+ return it(t) ? t.files : ot(t) ? ts(e.refs).value : Jt(t) ? [...t.selectedOptions].map(({ value: s }) => s) : Ve(t) ? Zt(e.refs).value : es(R(t.value) ? e.ref.value : t.value, e);
922
+ }
923
+ var ur = (e, t, s, r) => {
924
+ const i = {};
925
+ for (const n of e) {
926
+ const c = v(t, n);
927
+ c && M(i, n, c._f);
928
+ }
929
+ return {
930
+ criteriaMode: s,
931
+ names: [...e],
932
+ fields: i,
933
+ shouldUseNativeValidation: r
934
+ };
935
+ }, Re = (e) => e instanceof RegExp, $e = (e) => R(e) ? e : Re(e) ? e.source : I(e) ? Re(e.value) ? e.value.source : e.value : e, At = (e) => ({
936
+ isOnSubmit: !e || e === ce.onSubmit,
937
+ isOnBlur: e === ce.onBlur,
938
+ isOnChange: e === ce.onChange,
939
+ isOnAll: e === ce.all,
940
+ isOnTouch: e === ce.onTouched
941
+ });
942
+ const Et = "AsyncFunction";
943
+ var dr = (e) => !!e && !!e.validate && !!(le(e.validate) && e.validate.constructor.name === Et || I(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === Et)), fr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), $t = (e, t, s) => !s && (t.watchAll || t.watch.has(e) || [...t.watch].some((r) => e.startsWith(r) && /^\.\w+/.test(e.slice(r.length))));
944
+ const Le = (e, t, s, r) => {
945
+ for (const i of s || Object.keys(e)) {
946
+ const n = v(e, i);
947
+ if (n) {
948
+ const { _f: c, ...a } = n;
949
+ if (c) {
950
+ if (c.refs && c.refs[0] && t(c.refs[0], i) && !r)
951
+ return !0;
952
+ if (c.ref && t(c.ref, c.name) && !r)
953
+ return !0;
954
+ if (Le(a, t))
955
+ break;
956
+ } else if (I(a) && Le(a, t))
957
+ break;
958
+ }
959
+ }
960
+ };
961
+ function Ft(e, t, s) {
962
+ const r = v(e, s);
963
+ if (r || Qe(s))
964
+ return {
965
+ error: r,
966
+ name: s
967
+ };
968
+ const i = s.split(".");
969
+ for (; i.length; ) {
970
+ const n = i.join("."), c = v(t, n), a = v(e, n);
971
+ if (c && !Array.isArray(c) && s !== n)
972
+ return { name: s };
973
+ if (a && a.type)
974
+ return {
975
+ name: n,
976
+ error: a
977
+ };
978
+ if (a && a.root && a.root.type)
979
+ return {
980
+ name: `${n}.root`,
981
+ error: a.root
982
+ };
983
+ i.pop();
984
+ }
985
+ return {
986
+ name: s
987
+ };
988
+ }
989
+ var hr = (e, t, s, r) => {
990
+ s(e);
991
+ const { name: i, ...n } = e;
992
+ return J(n) || Object.keys(n).length >= Object.keys(t).length || Object.keys(n).find((c) => t[c] === (!r || ce.all));
993
+ }, mr = (e, t, s) => !e || !t || e === t || Fe(e).some((r) => r && (s ? r === t : r.startsWith(t) || t.startsWith(r))), yr = (e, t, s, r, i) => i.isOnAll ? !1 : !s && i.isOnTouch ? !(t || e) : (s ? r.isOnBlur : i.isOnBlur) ? !e : (s ? r.isOnChange : i.isOnChange) ? e : !0, gr = (e, t) => !rt(v(e, t)).length && U(e, t), br = (e, t, s) => {
994
+ const r = Fe(v(e, s));
995
+ return M(r, "root", t[s]), M(e, s, r), e;
996
+ }, Oe = (e) => he(e);
997
+ function Lt(e, t, s = "validate") {
998
+ if (Oe(e) || Array.isArray(e) && e.every(Oe) || de(e) && !e)
999
+ return {
1000
+ type: s,
1001
+ message: Oe(e) ? e : "",
1002
+ ref: t
1003
+ };
1004
+ }
1005
+ var ke = (e) => I(e) && !Re(e) ? e : {
1006
+ value: e,
1007
+ message: ""
1008
+ }, Tt = async (e, t, s, r, i, n) => {
1009
+ const { ref: c, refs: a, required: m, maxLength: y, minLength: d, min: g, max: f, pattern: x, validate: S, name: C, valueAsNumber: q, mount: ge } = e._f, k = v(s, C);
1010
+ if (!ge || t.has(C))
1011
+ return {};
1012
+ const W = a ? a[0] : c, T = (A) => {
1013
+ i && W.reportValidity && (W.setCustomValidity(de(A) ? "" : A || ""), W.reportValidity());
1014
+ }, L = {}, G = ot(c), Y = Ve(c), we = G || Y, B = (q || it(c)) && R(c.value) && R(k) || Ie(c) && c.value === "" || k === "" || Array.isArray(k) && !k.length, oe = or.bind(null, C, r, L), re = (A, E, O, H = ye.maxLength, K = ye.minLength) => {
1015
+ const D = A ? E : O;
1016
+ L[C] = {
1017
+ type: A ? H : K,
1018
+ message: D,
1019
+ ref: c,
1020
+ ...oe(A ? H : K, D)
1021
+ };
1022
+ };
1023
+ if (n ? !Array.isArray(k) || !k.length : m && (!we && (B || z(k)) || de(k) && !k || Y && !Zt(a).isValid || G && !ts(a).isValid)) {
1024
+ const { value: A, message: E } = Oe(m) ? { value: !!m, message: m } : ke(m);
1025
+ if (A && (L[C] = {
1026
+ type: ye.required,
1027
+ message: E,
1028
+ ref: W,
1029
+ ...oe(ye.required, E)
1030
+ }, !r))
1031
+ return T(E), L;
1032
+ }
1033
+ if (!B && (!z(g) || !z(f))) {
1034
+ let A, E;
1035
+ const O = ke(f), H = ke(g);
1036
+ if (!z(k) && !isNaN(k)) {
1037
+ const K = c.valueAsNumber || k && +k;
1038
+ z(O.value) || (A = K > O.value), z(H.value) || (E = K < H.value);
1039
+ } else {
1040
+ const K = c.valueAsDate || new Date(k), D = (ve) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ve), ne = c.type == "time", ae = c.type == "week";
1041
+ he(O.value) && k && (A = ne ? D(k) > D(O.value) : ae ? k > O.value : K > new Date(O.value)), he(H.value) && k && (E = ne ? D(k) < D(H.value) : ae ? k < H.value : K < new Date(H.value));
1042
+ }
1043
+ if ((A || E) && (re(!!A, O.message, H.message, ye.max, ye.min), !r))
1044
+ return T(L[C].message), L;
1045
+ }
1046
+ if ((y || d) && !B && (he(k) || n && Array.isArray(k))) {
1047
+ const A = ke(y), E = ke(d), O = !z(A.value) && k.length > +A.value, H = !z(E.value) && k.length < +E.value;
1048
+ if ((O || H) && (re(O, A.message, E.message), !r))
1049
+ return T(L[C].message), L;
1050
+ }
1051
+ if (x && !B && he(k)) {
1052
+ const { value: A, message: E } = ke(x);
1053
+ if (Re(A) && !k.match(A) && (L[C] = {
1054
+ type: ye.pattern,
1055
+ message: E,
1056
+ ref: c,
1057
+ ...oe(ye.pattern, E)
1058
+ }, !r))
1059
+ return T(E), L;
1060
+ }
1061
+ if (S) {
1062
+ if (le(S)) {
1063
+ const A = await S(k, s), E = Lt(A, W);
1064
+ if (E && (L[C] = {
1065
+ ...E,
1066
+ ...oe(ye.validate, E.message)
1067
+ }, !r))
1068
+ return T(E.message), L;
1069
+ } else if (I(S)) {
1070
+ let A = {};
1071
+ for (const E in S) {
1072
+ if (!J(A) && !r)
1073
+ break;
1074
+ const O = Lt(await S[E](k, s), W, E);
1075
+ O && (A = {
1076
+ ...O,
1077
+ ...oe(E, O.message)
1078
+ }, T(O.message), r && (L[C] = A));
1079
+ }
1080
+ if (!J(A) && (L[C] = {
1081
+ ref: W,
1082
+ ...A
1083
+ }, !r))
1084
+ return L;
1085
+ }
1086
+ }
1087
+ return T(!0), L;
1088
+ };
1089
+ const pr = {
1090
+ mode: ce.onSubmit,
1091
+ reValidateMode: ce.onChange,
1092
+ shouldFocusError: !0
1093
+ };
1094
+ function wr(e = {}) {
1095
+ let t = {
1096
+ ...pr,
1097
+ ...e
1098
+ }, s = {
1099
+ submitCount: 0,
1100
+ isDirty: !1,
1101
+ isReady: !1,
1102
+ isLoading: le(t.defaultValues),
1103
+ isValidating: !1,
1104
+ isSubmitted: !1,
1105
+ isSubmitting: !1,
1106
+ isSubmitSuccessful: !1,
1107
+ isValid: !1,
1108
+ touchedFields: {},
1109
+ dirtyFields: {},
1110
+ validatingFields: {},
1111
+ errors: t.errors || {},
1112
+ disabled: t.disabled || !1
1113
+ }, r = {}, i = I(t.defaultValues) || I(t.values) ? Q(t.defaultValues || t.values) || {} : {}, n = t.shouldUnregister ? {} : Q(i), c = {
1114
+ action: !1,
1115
+ mount: !1,
1116
+ watch: !1
1117
+ }, a = {
1118
+ mount: /* @__PURE__ */ new Set(),
1119
+ disabled: /* @__PURE__ */ new Set(),
1120
+ unMount: /* @__PURE__ */ new Set(),
1121
+ array: /* @__PURE__ */ new Set(),
1122
+ watch: /* @__PURE__ */ new Set()
1123
+ }, m, y = 0;
1124
+ const d = {
1125
+ isDirty: !1,
1126
+ dirtyFields: !1,
1127
+ validatingFields: !1,
1128
+ touchedFields: !1,
1129
+ isValidating: !1,
1130
+ isValid: !1,
1131
+ errors: !1
1132
+ };
1133
+ let g = {
1134
+ ...d
1135
+ };
1136
+ const f = {
1137
+ array: _t(),
1138
+ state: _t()
1139
+ }, x = t.criteriaMode === ce.all, S = (o) => (l) => {
1140
+ clearTimeout(y), y = setTimeout(o, l);
1141
+ }, C = async (o) => {
1142
+ if (!t.disabled && (d.isValid || g.isValid || o)) {
1143
+ const l = t.resolver ? J((await Y()).errors) : await B(r, !0);
1144
+ l !== s.isValid && f.state.next({
1145
+ isValid: l
1146
+ });
1147
+ }
1148
+ }, q = (o, l) => {
1149
+ !t.disabled && (d.isValidating || d.validatingFields || g.isValidating || g.validatingFields) && ((o || Array.from(a.mount)).forEach((u) => {
1150
+ u && (l ? M(s.validatingFields, u, l) : U(s.validatingFields, u));
1151
+ }), f.state.next({
1152
+ validatingFields: s.validatingFields,
1153
+ isValidating: !J(s.validatingFields)
1154
+ }));
1155
+ }, ge = (o, l = [], u, w, p = !0, b = !0) => {
1156
+ if (w && u && !t.disabled) {
1157
+ if (c.action = !0, b && Array.isArray(v(r, o))) {
1158
+ const _ = u(v(r, o), w.argA, w.argB);
1159
+ p && M(r, o, _);
1160
+ }
1161
+ if (b && Array.isArray(v(s.errors, o))) {
1162
+ const _ = u(v(s.errors, o), w.argA, w.argB);
1163
+ p && M(s.errors, o, _), gr(s.errors, o);
1164
+ }
1165
+ if ((d.touchedFields || g.touchedFields) && b && Array.isArray(v(s.touchedFields, o))) {
1166
+ const _ = u(v(s.touchedFields, o), w.argA, w.argB);
1167
+ p && M(s.touchedFields, o, _);
1168
+ }
1169
+ (d.dirtyFields || g.dirtyFields) && (s.dirtyFields = Ee(i, n)), f.state.next({
1170
+ name: o,
1171
+ isDirty: re(o, l),
1172
+ dirtyFields: s.dirtyFields,
1173
+ errors: s.errors,
1174
+ isValid: s.isValid
1175
+ });
1176
+ } else
1177
+ M(n, o, l);
1178
+ }, k = (o, l) => {
1179
+ M(s.errors, o, l), f.state.next({
1180
+ errors: s.errors
1181
+ });
1182
+ }, W = (o) => {
1183
+ s.errors = o, f.state.next({
1184
+ errors: s.errors,
1185
+ isValid: !1
1186
+ });
1187
+ }, T = (o, l, u, w) => {
1188
+ const p = v(r, o);
1189
+ if (p) {
1190
+ const b = v(n, o, R(u) ? v(i, o) : u);
1191
+ R(b) || w && w.defaultChecked || l ? M(n, o, l ? b : kt(p._f)) : O(o, b), c.mount && C();
1192
+ }
1193
+ }, L = (o, l, u, w, p) => {
1194
+ let b = !1, _ = !1;
1195
+ const $ = {
1196
+ name: o
1197
+ };
1198
+ if (!t.disabled) {
1199
+ if (!u || w) {
1200
+ (d.isDirty || g.isDirty) && (_ = s.isDirty, s.isDirty = $.isDirty = re(), b = _ !== $.isDirty);
1201
+ const V = pe(v(i, o), l);
1202
+ _ = !!v(s.dirtyFields, o), V ? U(s.dirtyFields, o) : M(s.dirtyFields, o, !0), $.dirtyFields = s.dirtyFields, b = b || (d.dirtyFields || g.dirtyFields) && _ !== !V;
1203
+ }
1204
+ if (u) {
1205
+ const V = v(s.touchedFields, o);
1206
+ V || (M(s.touchedFields, o, u), $.touchedFields = s.touchedFields, b = b || (d.touchedFields || g.touchedFields) && V !== u);
1207
+ }
1208
+ b && p && f.state.next($);
1209
+ }
1210
+ return b ? $ : {};
1211
+ }, G = (o, l, u, w) => {
1212
+ const p = v(s.errors, o), b = (d.isValid || g.isValid) && de(l) && s.isValid !== l;
1213
+ if (t.delayError && u ? (m = S(() => k(o, u)), m(t.delayError)) : (clearTimeout(y), m = null, u ? M(s.errors, o, u) : U(s.errors, o)), (u ? !pe(p, u) : p) || !J(w) || b) {
1214
+ const _ = {
1215
+ ...w,
1216
+ ...b && de(l) ? { isValid: l } : {},
1217
+ errors: s.errors,
1218
+ name: o
1219
+ };
1220
+ s = {
1221
+ ...s,
1222
+ ..._
1223
+ }, f.state.next(_);
1224
+ }
1225
+ }, Y = async (o) => {
1226
+ q(o, !0);
1227
+ const l = await t.resolver(n, t.context, ur(o || a.mount, r, t.criteriaMode, t.shouldUseNativeValidation));
1228
+ return q(o), l;
1229
+ }, we = async (o) => {
1230
+ const { errors: l } = await Y(o);
1231
+ if (o)
1232
+ for (const u of o) {
1233
+ const w = v(l, u);
1234
+ w ? M(s.errors, u, w) : U(s.errors, u);
1235
+ }
1236
+ else
1237
+ s.errors = l;
1238
+ return l;
1239
+ }, B = async (o, l, u = {
1240
+ valid: !0
1241
+ }) => {
1242
+ for (const w in o) {
1243
+ const p = o[w];
1244
+ if (p) {
1245
+ const { _f: b, ..._ } = p;
1246
+ if (b) {
1247
+ const $ = a.array.has(b.name), V = p._f && dr(p._f);
1248
+ V && d.validatingFields && q([w], !0);
1249
+ const ie = await Tt(p, a.disabled, n, x, t.shouldUseNativeValidation && !l, $);
1250
+ if (V && d.validatingFields && q([w]), ie[b.name] && (u.valid = !1, l))
1251
+ break;
1252
+ !l && (v(ie, b.name) ? $ ? br(s.errors, ie, b.name) : M(s.errors, b.name, ie[b.name]) : U(s.errors, b.name));
1253
+ }
1254
+ !J(_) && await B(_, l, u);
1255
+ }
1256
+ }
1257
+ return u.valid;
1258
+ }, oe = () => {
1259
+ for (const o of a.unMount) {
1260
+ const l = v(r, o);
1261
+ l && (l._f.refs ? l._f.refs.every((u) => !Ze(u)) : !Ze(l._f.ref)) && We(o);
1262
+ }
1263
+ a.unMount = /* @__PURE__ */ new Set();
1264
+ }, re = (o, l) => !t.disabled && (o && l && M(n, o, l), !pe(ve(), i)), A = (o, l, u) => ir(o, a, {
1265
+ ...c.mount ? n : R(l) ? i : he(o) ? { [o]: l } : l
1266
+ }, u, l), E = (o) => rt(v(c.mount ? n : i, o, t.shouldUnregister ? v(i, o, []) : [])), O = (o, l, u = {}) => {
1267
+ const w = v(r, o);
1268
+ let p = l;
1269
+ if (w) {
1270
+ const b = w._f;
1271
+ b && (!b.disabled && M(n, o, es(l, b)), p = Ie(b.ref) && z(l) ? "" : l, Jt(b.ref) ? [...b.ref.options].forEach((_) => _.selected = p.includes(_.value)) : b.refs ? Ve(b.ref) ? b.refs.forEach((_) => {
1272
+ (!_.defaultChecked || !_.disabled) && (Array.isArray(p) ? _.checked = !!p.find(($) => $ === _.value) : _.checked = p === _.value || !!p);
1273
+ }) : b.refs.forEach((_) => _.checked = _.value === p) : it(b.ref) ? b.ref.value = "" : (b.ref.value = p, b.ref.type || f.state.next({
1274
+ name: o,
1275
+ values: Q(n)
1276
+ })));
1277
+ }
1278
+ (u.shouldDirty || u.shouldTouch) && L(o, p, u.shouldTouch, u.shouldDirty, !0), u.shouldValidate && ae(o);
1279
+ }, H = (o, l, u) => {
1280
+ for (const w in l) {
1281
+ if (!l.hasOwnProperty(w))
1282
+ return;
1283
+ const p = l[w], b = o + "." + w, _ = v(r, b);
1284
+ (a.array.has(o) || I(p) || _ && !_._f) && !_e(p) ? H(b, p, u) : O(b, p, u);
1285
+ }
1286
+ }, K = (o, l, u = {}) => {
1287
+ const w = v(r, o), p = a.array.has(o), b = Q(l);
1288
+ M(n, o, b), p ? (f.array.next({
1289
+ name: o,
1290
+ values: Q(n)
1291
+ }), (d.isDirty || d.dirtyFields || g.isDirty || g.dirtyFields) && u.shouldDirty && f.state.next({
1292
+ name: o,
1293
+ dirtyFields: Ee(i, n),
1294
+ isDirty: re(o, b)
1295
+ })) : w && !w._f && !z(b) ? H(o, b, u) : O(o, b, u), $t(o, a) && f.state.next({ ...s, name: o }), f.state.next({
1296
+ name: c.mount ? o : void 0,
1297
+ values: Q(n)
1298
+ });
1299
+ }, D = async (o) => {
1300
+ c.mount = !0;
1301
+ const l = o.target;
1302
+ let u = l.name, w = !0;
1303
+ const p = v(r, u), b = (V) => {
1304
+ w = Number.isNaN(V) || _e(V) && isNaN(V.getTime()) || pe(V, v(n, u, V));
1305
+ }, _ = At(t.mode), $ = At(t.reValidateMode);
1306
+ if (p) {
1307
+ let V, ie;
1308
+ const Me = l.type ? kt(p._f) : Xs(o), be = o.type === xt.BLUR || o.type === xt.FOCUS_OUT, ds = !fr(p._f) && !t.resolver && !v(s.errors, u) && !p._f.deps || yr(be, v(s.touchedFields, u), s.isSubmitted, $, _), Je = $t(u, a, be);
1309
+ M(n, u, Me), be ? (p._f.onBlur && p._f.onBlur(o), m && m(0)) : p._f.onChange && p._f.onChange(o);
1310
+ const Ye = L(u, Me, be), fs = !J(Ye) || Je;
1311
+ if (!be && f.state.next({
1312
+ name: u,
1313
+ type: o.type,
1314
+ values: Q(n)
1315
+ }), ds)
1316
+ return (d.isValid || g.isValid) && (t.mode === "onBlur" ? be && C() : be || C()), fs && f.state.next({ name: u, ...Je ? {} : Ye });
1317
+ if (!be && Je && f.state.next({ ...s }), t.resolver) {
1318
+ const { errors: mt } = await Y([u]);
1319
+ if (b(Me), w) {
1320
+ const hs = Ft(s.errors, r, u), yt = Ft(mt, r, hs.name || u);
1321
+ V = yt.error, u = yt.name, ie = J(mt);
1322
+ }
1323
+ } else
1324
+ q([u], !0), V = (await Tt(p, a.disabled, n, x, t.shouldUseNativeValidation))[u], q([u]), b(Me), w && (V ? ie = !1 : (d.isValid || g.isValid) && (ie = await B(r, !0)));
1325
+ w && (p._f.deps && ae(p._f.deps), G(u, ie, V, Ye));
1326
+ }
1327
+ }, ne = (o, l) => {
1328
+ if (v(s.errors, l) && o.focus)
1329
+ return o.focus(), 1;
1330
+ }, ae = async (o, l = {}) => {
1331
+ let u, w;
1332
+ const p = Fe(o);
1333
+ if (t.resolver) {
1334
+ const b = await we(R(o) ? o : p);
1335
+ u = J(b), w = o ? !p.some((_) => v(b, _)) : u;
1336
+ } else o ? (w = (await Promise.all(p.map(async (b) => {
1337
+ const _ = v(r, b);
1338
+ return await B(_ && _._f ? { [b]: _ } : _);
1339
+ }))).every(Boolean), !(!w && !s.isValid) && C()) : w = u = await B(r);
1340
+ return f.state.next({
1341
+ ...!he(o) || (d.isValid || g.isValid) && u !== s.isValid ? {} : { name: o },
1342
+ ...t.resolver || !o ? { isValid: u } : {},
1343
+ errors: s.errors
1344
+ }), l.shouldFocus && !w && Le(r, ne, o ? p : a.mount), w;
1345
+ }, ve = (o) => {
1346
+ const l = {
1347
+ ...c.mount ? n : i
1348
+ };
1349
+ return R(o) ? l : he(o) ? v(l, o) : o.map((u) => v(l, u));
1350
+ }, Pe = (o, l) => ({
1351
+ invalid: !!v((l || s).errors, o),
1352
+ isDirty: !!v((l || s).dirtyFields, o),
1353
+ error: v((l || s).errors, o),
1354
+ isValidating: !!v(s.validatingFields, o),
1355
+ isTouched: !!v((l || s).touchedFields, o)
1356
+ }), xe = (o) => {
1357
+ o && Fe(o).forEach((l) => U(s.errors, l)), f.state.next({
1358
+ errors: o ? s.errors : {}
1359
+ });
1360
+ }, at = (o, l, u) => {
1361
+ const w = (v(r, o, { _f: {} })._f || {}).ref, p = v(s.errors, o) || {}, { ref: b, message: _, type: $, ...V } = p;
1362
+ M(s.errors, o, {
1363
+ ...V,
1364
+ ...l,
1365
+ ref: w
1366
+ }), f.state.next({
1367
+ name: o,
1368
+ errors: s.errors,
1369
+ isValid: !1
1370
+ }), u && u.shouldFocus && w && w.focus && w.focus();
1371
+ }, is = (o, l) => le(o) ? f.state.subscribe({
1372
+ next: (u) => "values" in u && o(A(void 0, l), u)
1373
+ }) : A(o, l, !0), ct = (o) => f.state.subscribe({
1374
+ next: (l) => {
1375
+ mr(o.name, l.name, o.exact) && hr(l, o.formState || d, us, o.reRenderRoot) && o.callback({
1376
+ values: { ...n },
1377
+ ...s,
1378
+ ...l,
1379
+ defaultValues: i
1380
+ });
1381
+ }
1382
+ }).unsubscribe, os = (o) => (c.mount = !0, g = {
1383
+ ...g,
1384
+ ...o.formState
1385
+ }, ct({
1386
+ ...o,
1387
+ formState: g
1388
+ })), We = (o, l = {}) => {
1389
+ for (const u of o ? Fe(o) : a.mount)
1390
+ a.mount.delete(u), a.array.delete(u), l.keepValue || (U(r, u), U(n, u)), !l.keepError && U(s.errors, u), !l.keepDirty && U(s.dirtyFields, u), !l.keepTouched && U(s.touchedFields, u), !l.keepIsValidating && U(s.validatingFields, u), !t.shouldUnregister && !l.keepDefaultValue && U(i, u);
1391
+ f.state.next({
1392
+ values: Q(n)
1393
+ }), f.state.next({
1394
+ ...s,
1395
+ ...l.keepDirty ? { isDirty: re() } : {}
1396
+ }), !l.keepIsValid && C();
1397
+ }, lt = ({ disabled: o, name: l }) => {
1398
+ (de(o) && c.mount || o || a.disabled.has(l)) && (o ? a.disabled.add(l) : a.disabled.delete(l));
1399
+ }, ze = (o, l = {}) => {
1400
+ let u = v(r, o);
1401
+ const w = de(l.disabled) || de(t.disabled);
1402
+ return M(r, o, {
1403
+ ...u || {},
1404
+ _f: {
1405
+ ...u && u._f ? u._f : { ref: { name: o } },
1406
+ name: o,
1407
+ mount: !0,
1408
+ ...l
1409
+ }
1410
+ }), a.mount.add(o), u ? lt({
1411
+ disabled: de(l.disabled) ? l.disabled : t.disabled,
1412
+ name: o
1413
+ }) : T(o, !0, l.value), {
1414
+ ...w ? { disabled: l.disabled || t.disabled } : {},
1415
+ ...t.progressive ? {
1416
+ required: !!l.required,
1417
+ min: $e(l.min),
1418
+ max: $e(l.max),
1419
+ minLength: $e(l.minLength),
1420
+ maxLength: $e(l.maxLength),
1421
+ pattern: $e(l.pattern)
1422
+ } : {},
1423
+ name: o,
1424
+ onChange: D,
1425
+ onBlur: D,
1426
+ ref: (p) => {
1427
+ if (p) {
1428
+ ze(o, l), u = v(r, o);
1429
+ const b = R(p.value) && p.querySelectorAll && p.querySelectorAll("input,select,textarea")[0] || p, _ = ar(b), $ = u._f.refs || [];
1430
+ if (_ ? $.find((V) => V === b) : b === u._f.ref)
1431
+ return;
1432
+ M(r, o, {
1433
+ _f: {
1434
+ ...u._f,
1435
+ ..._ ? {
1436
+ refs: [
1437
+ ...$.filter(Ze),
1438
+ b,
1439
+ ...Array.isArray(v(i, o)) ? [{}] : []
1440
+ ],
1441
+ ref: { type: b.type, name: o }
1442
+ } : { ref: b }
1443
+ }
1444
+ }), T(o, !1, void 0, b);
1445
+ } else
1446
+ u = v(r, o, {}), u._f && (u._f.mount = !1), (t.shouldUnregister || l.shouldUnregister) && !(er(a.array, o) && c.action) && a.unMount.add(o);
1447
+ }
1448
+ };
1449
+ }, Ge = () => t.shouldFocusError && Le(r, ne, a.mount), as = (o) => {
1450
+ de(o) && (f.state.next({ disabled: o }), Le(r, (l, u) => {
1451
+ const w = v(r, u);
1452
+ w && (l.disabled = w._f.disabled || o, Array.isArray(w._f.refs) && w._f.refs.forEach((p) => {
1453
+ p.disabled = w._f.disabled || o;
1454
+ }));
1455
+ }, 0, !1));
1456
+ }, ut = (o, l) => async (u) => {
1457
+ let w;
1458
+ u && (u.preventDefault && u.preventDefault(), u.persist && u.persist());
1459
+ let p = Q(n);
1460
+ if (f.state.next({
1461
+ isSubmitting: !0
1462
+ }), t.resolver) {
1463
+ const { errors: b, values: _ } = await Y();
1464
+ s.errors = b, p = Q(_);
1465
+ } else
1466
+ await B(r);
1467
+ if (a.disabled.size)
1468
+ for (const b of a.disabled)
1469
+ U(p, b);
1470
+ if (U(s.errors, "root"), J(s.errors)) {
1471
+ f.state.next({
1472
+ errors: {}
1473
+ });
1474
+ try {
1475
+ await o(p, u);
1476
+ } catch (b) {
1477
+ w = b;
1478
+ }
1479
+ } else
1480
+ l && await l({ ...s.errors }, u), Ge(), setTimeout(Ge);
1481
+ if (f.state.next({
1482
+ isSubmitted: !0,
1483
+ isSubmitting: !1,
1484
+ isSubmitSuccessful: J(s.errors) && !w,
1485
+ submitCount: s.submitCount + 1,
1486
+ errors: s.errors
1487
+ }), w)
1488
+ throw w;
1489
+ }, cs = (o, l = {}) => {
1490
+ v(r, o) && (R(l.defaultValue) ? K(o, Q(v(i, o))) : (K(o, l.defaultValue), M(i, o, Q(l.defaultValue))), l.keepTouched || U(s.touchedFields, o), l.keepDirty || (U(s.dirtyFields, o), s.isDirty = l.defaultValue ? re(o, Q(v(i, o))) : re()), l.keepError || (U(s.errors, o), d.isValid && C()), f.state.next({ ...s }));
1491
+ }, dt = (o, l = {}) => {
1492
+ const u = o ? Q(o) : i, w = Q(u), p = J(o), b = p ? i : w;
1493
+ if (l.keepDefaultValues || (i = u), !l.keepValues) {
1494
+ if (l.keepDirtyValues) {
1495
+ const _ = /* @__PURE__ */ new Set([
1496
+ ...a.mount,
1497
+ ...Object.keys(Ee(i, n))
1498
+ ]);
1499
+ for (const $ of Array.from(_))
1500
+ v(s.dirtyFields, $) ? M(b, $, v(n, $)) : K($, v(b, $));
1501
+ } else {
1502
+ if (st && R(o))
1503
+ for (const _ of a.mount) {
1504
+ const $ = v(r, _);
1505
+ if ($ && $._f) {
1506
+ const V = Array.isArray($._f.refs) ? $._f.refs[0] : $._f.ref;
1507
+ if (Ie(V)) {
1508
+ const ie = V.closest("form");
1509
+ if (ie) {
1510
+ ie.reset();
1511
+ break;
1512
+ }
1513
+ }
1514
+ }
1515
+ }
1516
+ if (l.keepFieldsRef)
1517
+ for (const _ of a.mount)
1518
+ K(_, v(b, _));
1519
+ else
1520
+ r = {};
1521
+ }
1522
+ n = t.shouldUnregister ? l.keepDefaultValues ? Q(i) : {} : Q(b), f.array.next({
1523
+ values: { ...b }
1524
+ }), f.state.next({
1525
+ values: { ...b }
1526
+ });
1527
+ }
1528
+ a = {
1529
+ mount: l.keepDirtyValues ? a.mount : /* @__PURE__ */ new Set(),
1530
+ unMount: /* @__PURE__ */ new Set(),
1531
+ array: /* @__PURE__ */ new Set(),
1532
+ disabled: /* @__PURE__ */ new Set(),
1533
+ watch: /* @__PURE__ */ new Set(),
1534
+ watchAll: !1,
1535
+ focus: ""
1536
+ }, c.mount = !d.isValid || !!l.keepIsValid || !!l.keepDirtyValues, c.watch = !!t.shouldUnregister, f.state.next({
1537
+ submitCount: l.keepSubmitCount ? s.submitCount : 0,
1538
+ isDirty: p ? !1 : l.keepDirty ? s.isDirty : !!(l.keepDefaultValues && !pe(o, i)),
1539
+ isSubmitted: l.keepIsSubmitted ? s.isSubmitted : !1,
1540
+ dirtyFields: p ? {} : l.keepDirtyValues ? l.keepDefaultValues && n ? Ee(i, n) : s.dirtyFields : l.keepDefaultValues && o ? Ee(i, o) : l.keepDirty ? s.dirtyFields : {},
1541
+ touchedFields: l.keepTouched ? s.touchedFields : {},
1542
+ errors: l.keepErrors ? s.errors : {},
1543
+ isSubmitSuccessful: l.keepIsSubmitSuccessful ? s.isSubmitSuccessful : !1,
1544
+ isSubmitting: !1
1545
+ });
1546
+ }, ft = (o, l) => dt(le(o) ? o(n) : o, l), ls = (o, l = {}) => {
1547
+ const u = v(r, o), w = u && u._f;
1548
+ if (w) {
1549
+ const p = w.refs ? w.refs[0] : w.ref;
1550
+ p.focus && (p.focus(), l.shouldSelect && le(p.select) && p.select());
1551
+ }
1552
+ }, us = (o) => {
1553
+ s = {
1554
+ ...s,
1555
+ ...o
1556
+ };
1557
+ }, ht = {
1558
+ control: {
1559
+ register: ze,
1560
+ unregister: We,
1561
+ getFieldState: Pe,
1562
+ handleSubmit: ut,
1563
+ setError: at,
1564
+ _subscribe: ct,
1565
+ _runSchema: Y,
1566
+ _focusError: Ge,
1567
+ _getWatch: A,
1568
+ _getDirty: re,
1569
+ _setValid: C,
1570
+ _setFieldArray: ge,
1571
+ _setDisabledField: lt,
1572
+ _setErrors: W,
1573
+ _getFieldArray: E,
1574
+ _reset: dt,
1575
+ _resetDefaultValues: () => le(t.defaultValues) && t.defaultValues().then((o) => {
1576
+ ft(o, t.resetOptions), f.state.next({
1577
+ isLoading: !1
1578
+ });
1579
+ }),
1580
+ _removeUnmounted: oe,
1581
+ _disableForm: as,
1582
+ _subjects: f,
1583
+ _proxyFormState: d,
1584
+ get _fields() {
1585
+ return r;
1586
+ },
1587
+ get _formValues() {
1588
+ return n;
1589
+ },
1590
+ get _state() {
1591
+ return c;
1592
+ },
1593
+ set _state(o) {
1594
+ c = o;
1595
+ },
1596
+ get _defaultValues() {
1597
+ return i;
1598
+ },
1599
+ get _names() {
1600
+ return a;
1601
+ },
1602
+ set _names(o) {
1603
+ a = o;
1604
+ },
1605
+ get _formState() {
1606
+ return s;
1607
+ },
1608
+ get _options() {
1609
+ return t;
1610
+ },
1611
+ set _options(o) {
1612
+ t = {
1613
+ ...t,
1614
+ ...o
1615
+ };
1616
+ }
1617
+ },
1618
+ subscribe: os,
1619
+ trigger: ae,
1620
+ register: ze,
1621
+ handleSubmit: ut,
1622
+ watch: is,
1623
+ setValue: K,
1624
+ getValues: ve,
1625
+ reset: ft,
1626
+ resetField: cs,
1627
+ clearErrors: xe,
1628
+ unregister: We,
1629
+ setError: at,
1630
+ setFocus: ls,
1631
+ getFieldState: Pe
1632
+ };
1633
+ return {
1634
+ ...ht,
1635
+ formControl: ht
1636
+ };
1637
+ }
1638
+ function ss(e = {}) {
1639
+ const t = X.useRef(void 0), s = X.useRef(void 0), [r, i] = X.useState({
1640
+ isDirty: !1,
1641
+ isValidating: !1,
1642
+ isLoading: le(e.defaultValues),
1643
+ isSubmitted: !1,
1644
+ isSubmitting: !1,
1645
+ isSubmitSuccessful: !1,
1646
+ isValid: !1,
1647
+ submitCount: 0,
1648
+ dirtyFields: {},
1649
+ touchedFields: {},
1650
+ validatingFields: {},
1651
+ errors: e.errors || {},
1652
+ disabled: e.disabled || !1,
1653
+ isReady: !1,
1654
+ defaultValues: le(e.defaultValues) ? void 0 : e.defaultValues
1655
+ });
1656
+ if (!t.current)
1657
+ if (e.formControl)
1658
+ t.current = {
1659
+ ...e.formControl,
1660
+ formState: r
1661
+ }, e.defaultValues && !le(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
1662
+ else {
1663
+ const { formControl: c, ...a } = wr(e);
1664
+ t.current = {
1665
+ ...a,
1666
+ formState: r
1667
+ };
1668
+ }
1669
+ const n = t.current.control;
1670
+ return n._options = e, nr(() => {
1671
+ const c = n._subscribe({
1672
+ formState: n._proxyFormState,
1673
+ callback: () => i({ ...n._formState }),
1674
+ reRenderRoot: !0
1675
+ });
1676
+ return i((a) => ({
1677
+ ...a,
1678
+ isReady: !0
1679
+ })), n._formState.isReady = !0, c;
1680
+ }, [n]), X.useEffect(() => n._disableForm(e.disabled), [n, e.disabled]), X.useEffect(() => {
1681
+ e.mode && (n._options.mode = e.mode), e.reValidateMode && (n._options.reValidateMode = e.reValidateMode);
1682
+ }, [n, e.mode, e.reValidateMode]), X.useEffect(() => {
1683
+ e.errors && (n._setErrors(e.errors), n._focusError());
1684
+ }, [n, e.errors]), X.useEffect(() => {
1685
+ e.shouldUnregister && n._subjects.state.next({
1686
+ values: n._getWatch()
1687
+ });
1688
+ }, [n, e.shouldUnregister]), X.useEffect(() => {
1689
+ if (n._proxyFormState.isDirty) {
1690
+ const c = n._getDirty();
1691
+ c !== r.isDirty && n._subjects.state.next({
1692
+ isDirty: c
1693
+ });
1694
+ }
1695
+ }, [n, r.isDirty]), X.useEffect(() => {
1696
+ e.values && !pe(e.values, s.current) ? (n._reset(e.values, {
1697
+ keepFieldsRef: !0,
1698
+ ...n._options.resetOptions
1699
+ }), s.current = e.values, i((c) => ({ ...c }))) : n._resetDefaultValues();
1700
+ }, [n, e.values]), X.useEffect(() => {
1701
+ n._state.mount || (n._setValid(), n._state.mount = !0), n._state.watch && (n._state.watch = !1, n._subjects.state.next({ ...n._formState })), n._removeUnmounted();
1702
+ }), t.current.formState = rr(r, n), t.current;
1703
+ }
1704
+ const Xr = (e) => {
1705
+ const { t } = P(), { showStackNotifications: s, showSuccessNotification: r } = Ne(), {
1706
+ defaultValues: i,
1707
+ mutationFn: n,
1708
+ formToDto: c,
1709
+ onError: a,
1710
+ onSuccess: m,
1711
+ queryKey: y,
1712
+ onSuccessMessage: d
1713
+ } = e, { control: g, handleSubmit: f, reset: x, setError: S, getValues: C, setValue: q } = ss({
1714
+ defaultValues: i
1715
+ }), ge = F(
1716
+ (T) => {
1717
+ const L = T == null ? void 0 : T.errors, G = [];
1718
+ return L && L.forEach(([Y, we]) => {
1719
+ const B = document.querySelector(`[name="${Y}"]`);
1720
+ (B instanceof HTMLInputElement || B instanceof HTMLTextAreaElement || B instanceof HTMLSelectElement) && (B.focus(), B.classList.add("error"), G.push(t(`_entities:${y}.${Y}.${we}`)));
1721
+ }), G;
1722
+ },
1723
+ [t, y]
1724
+ ), k = F(() => {
1725
+ document.querySelectorAll("input, textarea, select").forEach((L) => {
1726
+ L.classList.remove("error");
1727
+ });
1728
+ }, []), W = je(
1729
+ {
1730
+ mutationFn: n,
1731
+ onError: (T) => {
1732
+ if (console.error(T), T.errors) {
1733
+ const L = ge(T);
1734
+ s(
1735
+ L.map(
1736
+ (G) => ({
1737
+ message: G,
1738
+ type: j.error
1739
+ })
1740
+ )
1741
+ );
1742
+ }
1743
+ a && a(T);
1744
+ },
1745
+ onSuccess: async (T) => {
1746
+ Ce && await Ce.invalidateQueries({ queryKey: y }), m && m(T), d && r({
1747
+ message: d
1748
+ });
1749
+ }
1750
+ }
1751
+ );
1752
+ return {
1753
+ control: g,
1754
+ getValues: C,
1755
+ setValue: q,
1756
+ handleSubmit: f,
1757
+ onSubmit: (T) => W.mutate(c(T)),
1758
+ reset: x,
1759
+ setError: S,
1760
+ parseFormError: ge,
1761
+ releaseFormError: k,
1762
+ isLoading: W.isPending
1763
+ };
1764
+ }, vr = (e) => {
1765
+ const { t } = P(), { onClick: s, hidden: r = !1, disabled: i = !1 } = e;
1766
+ return {
1767
+ action: F(
1768
+ (c) => ({
1769
+ id: Se.Delete,
1770
+ hidden: c.deleted || r,
1771
+ disabled: c.deleted || i,
1772
+ icon: /* @__PURE__ */ h(ee, { className: "text-red-500", icon: Ss }),
1773
+ tooltip: t("_pages:common.actions.delete.text"),
1774
+ onClick: () => s([c == null ? void 0 : c.id])
1775
+ }),
1776
+ [i, r, s, t]
1777
+ )
1778
+ };
1779
+ }, xr = (e) => {
1780
+ const { t } = P(), { onClick: s, hidden: r = !1 } = e;
1781
+ return {
1782
+ action: F(
1783
+ (n) => ({
1784
+ id: Se.Restore,
1785
+ hidden: !n.deleted || r,
1786
+ disabled: !n.deleted,
1787
+ icon: /* @__PURE__ */ h(ee, { className: "text-red-500", icon: Dt }),
1788
+ tooltip: t("_pages:common.actions.restore.text"),
1789
+ onClick: () => s([n == null ? void 0 : n.id])
1790
+ }),
1791
+ [r, s, t]
1792
+ )
1793
+ };
1794
+ }, Zr = (e) => {
1795
+ const { t } = P(), { onClick: s, hidden: r = !1 } = e;
1796
+ return {
1797
+ action: F(
1798
+ (n) => ({
1799
+ id: Se.Edit,
1800
+ hidden: n.deleted || r,
1801
+ disabled: n.deleted,
1802
+ icon: /* @__PURE__ */ h(ee, { className: "primary", icon: Ns }),
1803
+ tooltip: t("_pages:common.actions.edit.text"),
1804
+ onClick: () => s(n == null ? void 0 : n.id)
1805
+ }),
1806
+ [r, s, t]
1807
+ )
1808
+ };
1809
+ };
1810
+ var Se = /* @__PURE__ */ ((e) => (e.Add = "add", e.Edit = "edit", e.Delete = "delete", e.Restore = "restore", e.Refresh = "refresh", e.Export = "export", e))(Se || {});
1811
+ const _r = (e) => {
1812
+ const { t } = P(), {
1813
+ isLoading: s = !1,
1814
+ onClick: r,
1815
+ hidden: i = !1,
1816
+ disabled: n = !1
1817
+ } = e;
1818
+ return {
1819
+ action: F(
1820
+ () => ({
1821
+ id: Se.Export,
1822
+ hidden: i,
1823
+ disabled: n,
1824
+ icon: /* @__PURE__ */ h(
1825
+ ee,
1826
+ {
1827
+ icon: s ? Vt : ks,
1828
+ className: `${s ? "rotate" : ""}`
1829
+ }
1830
+ ),
1831
+ tooltip: t("_pages:common.actions.export.text"),
1832
+ onClick: r
1833
+ }),
1834
+ [n, i, s, r, t]
1835
+ )
1836
+ };
1837
+ }, en = (e) => {
1838
+ const { queryKey: t, onSuccess: s, ...r } = e, { showStackNotifications: i } = Ne(), { t: n } = P(), { open: c, onClick: a, close: m, dialogFn: y, isLoading: d } = zt({
1839
+ onSuccessMessage: n("_pages:common.actions.delete.successMessage"),
1840
+ onError: (f) => {
1841
+ f.errors && i(
1842
+ f.errors.map(
1843
+ ([x, S]) => ({
1844
+ message: n(`_pages:${x}.errors.${S}`),
1845
+ type: j.error
1846
+ })
1847
+ )
1848
+ );
1849
+ },
1850
+ onSuccess: async (f) => {
1851
+ await Ce.invalidateQueries({ queryKey: t }), s && s(f);
1852
+ },
1853
+ ...r
1854
+ }), { action: g } = vr({ onClick: a });
1855
+ return {
1856
+ onClick: a,
1857
+ title: n("_pages:common.actions.delete.dialog.title"),
1858
+ open: c,
1859
+ isLoading: d,
1860
+ handleSubmit: () => y.mutate(),
1861
+ handleClose: m,
1862
+ action: g
1863
+ };
1864
+ }, rs = () => {
1865
+ const [e, t] = se(!1);
1866
+ return { open: e, setOpen: t, handleClose: () => t(!1), handleOpen: () => t(!0) };
1867
+ }, tn = (e) => {
1868
+ const { t } = P(), {
1869
+ showErrorNotification: s,
1870
+ showStackNotifications: r,
1871
+ showSuccessNotification: i
1872
+ } = Ne(), {
1873
+ defaultValues: n,
1874
+ getFunction: c,
1875
+ mutationFn: a,
1876
+ formToDto: m,
1877
+ dtoToForm: y,
1878
+ onError: d,
1879
+ onSuccess: g,
1880
+ queryKey: f,
1881
+ onSuccessMessage: x,
1882
+ title: S
1883
+ } = e, [C, q] = se(0), { open: ge, handleClose: k, handleOpen: W } = rs(), { control: T, handleSubmit: L, reset: G, setError: Y, getValues: we, setValue: B } = ss({
1884
+ defaultValues: n
1885
+ }), { data: oe, isLoading: re } = qs({
1886
+ queryFn: () => c == null ? void 0 : c(C),
1887
+ queryKey: [...f, C],
1888
+ enabled: !!c && !!f && !!C
1889
+ });
1890
+ te(() => {
1891
+ oe && y && G({ ...y(oe) });
1892
+ }, [oe]);
1893
+ const A = F(
1894
+ (D) => {
1895
+ const ne = D == null ? void 0 : D.errors, ae = [];
1896
+ return ne && ne.forEach(([ve, Pe]) => {
1897
+ const xe = document.querySelector(`[name="${ve}"]`);
1898
+ (xe instanceof HTMLInputElement || xe instanceof HTMLTextAreaElement || xe instanceof HTMLSelectElement) && (xe.focus(), xe.classList.add("error"), ae.push(t(`_entities:${f}.${ve}.${Pe}`)));
1899
+ }), ae;
1900
+ },
1901
+ [t, f]
1902
+ ), E = F(() => {
1903
+ document.querySelectorAll("input, textarea, select").forEach((ne) => {
1904
+ ne.classList.remove("error");
1905
+ });
1906
+ }, []), O = F(
1907
+ (D) => {
1908
+ q(D ?? 0), W();
1909
+ },
1910
+ [W]
1911
+ ), H = F(() => {
1912
+ E(), k(), G();
1913
+ }, [G, E, k]), K = je({
1914
+ mutationFn: a,
1915
+ onError: (D) => {
1916
+ if (console.error(D), D.errors) {
1917
+ const ne = A(D);
1918
+ r(
1919
+ ne.map(
1920
+ (ae) => ({
1921
+ message: ae,
1922
+ type: j.error
1923
+ })
1924
+ )
1925
+ );
1926
+ } else d ? d(D) : s({ message: t("_accessibility:errors.500") });
1927
+ },
1928
+ onSuccess: async (D) => {
1929
+ await Ce.invalidateQueries({ queryKey: f }), g && g(D), i({
1930
+ message: x
1931
+ }), H();
1932
+ }
1933
+ });
1934
+ return {
1935
+ open: ge,
1936
+ openDialog: O,
1937
+ handleClose: H,
1938
+ control: T,
1939
+ getValues: we,
1940
+ setValue: B,
1941
+ handleSubmit: L,
1942
+ onSubmit: (D) => K.mutate(m(D)),
1943
+ reset: G,
1944
+ setError: Y,
1945
+ parseFormError: A,
1946
+ releaseFormError: E,
1947
+ title: S,
1948
+ isLoading: re || K.isPending
1949
+ };
1950
+ }, sn = (e) => {
1951
+ const { queryKey: t, onSuccess: s, ...r } = e, { showStackNotifications: i } = Ne(), { t: n } = P(), { open: c, onClick: a, close: m, dialogFn: y, isLoading: d } = zt({
1952
+ onSuccessMessage: n("_pages:common.actions.restore.successMessage"),
1953
+ onError: (f) => {
1954
+ f.errors && i(
1955
+ f.errors.map(
1956
+ ([x, S]) => ({
1957
+ message: n(`_pages:${x}.errors.${S}`),
1958
+ type: j.error
1959
+ })
1960
+ )
1961
+ );
1962
+ },
1963
+ onSuccess: async (f) => {
1964
+ await Ce.invalidateQueries({ queryKey: t }), s && s(f);
1965
+ },
1966
+ ...r
1967
+ }), { action: g } = xr({ onClick: a });
1968
+ return {
1969
+ onClick: a,
1970
+ title: n("_pages:common.actions.restore.dialog.title"),
1971
+ open: c,
1972
+ isLoading: d,
1973
+ handleSubmit: () => y.mutate(),
1974
+ handleClose: m,
1975
+ action: g
1976
+ };
1977
+ }, rn = (e) => {
1978
+ const { showSuccessNotification: t } = Ne(), { t: s } = P(), {
1979
+ entity: r,
1980
+ mutationFn: i,
1981
+ onError: n,
1982
+ onSuccess: c,
1983
+ onSuccessMessage: a = s("_pages:common.actions.export.successMessage")
1984
+ } = e, m = je({
1985
+ mutationFn: () => i(),
1986
+ onError: (g) => {
1987
+ console.error(g), n && n(g);
1988
+ },
1989
+ onSuccess: async (g) => {
1990
+ const f = JSON.stringify(g, null, 2), x = new Blob([f], { type: "application/json" }), S = URL.createObjectURL(x), C = document.createElement("a");
1991
+ C.href = S, C.download = `${r}.json`, C.click(), URL.revokeObjectURL(S), c && c(g), t({
1992
+ message: a
1993
+ });
1994
+ }
1995
+ }), y = F(() => {
1996
+ m.mutate();
1997
+ }, [m]), { action: d } = _r({
1998
+ onClick: y,
1999
+ isLoading: m.isPending
2000
+ });
2001
+ return {
2002
+ action: d
2003
+ };
2004
+ };
2005
+ function Cr(e) {
2006
+ const [t, s] = se(!1), r = F(() => {
2007
+ const i = window.scrollY > e;
2008
+ s(i);
2009
+ }, [e]);
2010
+ return te(() => (window.addEventListener("scroll", r), () => {
2011
+ window.removeEventListener("scroll", r);
2012
+ }), [r]), t;
2013
+ }
2014
+ const nn = () => {
2015
+ const { t: e } = P(), t = Cr(200);
2016
+ return /* @__PURE__ */ h(
2017
+ me,
2018
+ {
2019
+ icon: As,
2020
+ onClick: () => Ks.scrollTo(0, 0),
2021
+ "data-tooltip-id": "tooltip",
2022
+ "data-tooltip-content": e("_accessibility:buttons.toTop"),
2023
+ className: `submit primary to-top ${t ? "show" : "hide"}`
2024
+ }
2025
+ );
2026
+ }, Sr = (e) => {
2027
+ const { actions: t = [], className: s = "" } = e, { t: r } = P(), [i, n] = se(!1);
2028
+ return /* @__PURE__ */ N("div", { className: `actions-dropdown ${s}`, children: [
2029
+ /* @__PURE__ */ h(
2030
+ me,
2031
+ {
2032
+ icon: Es,
2033
+ onClick: () => n(!0),
2034
+ "data-tooltip-id": "tooltip",
2035
+ "data-tooltip-content": r("_accessibility:buttons.openActions")
2036
+ }
2037
+ ),
2038
+ /* @__PURE__ */ h(Hs, { open: i, onClose: () => n(!1), children: /* @__PURE__ */ h(
2039
+ Ut,
2040
+ {
2041
+ showActionTexts: !0,
2042
+ actions: t,
2043
+ className: "flex-col",
2044
+ showTooltips: !1
2045
+ }
2046
+ ) })
2047
+ ] });
2048
+ }, on = Mt(function(e, t) {
2049
+ const {
2050
+ value: s,
2051
+ onChange: r,
2052
+ state: i = gs.default,
2053
+ name: n = "",
2054
+ id: c = "",
2055
+ label: a = "",
2056
+ disabled: m = !1,
2057
+ required: y = !1,
2058
+ placeholder: d = "",
2059
+ containerClassName: g = "",
2060
+ inputClassName: f = "",
2061
+ labelClassName: x = "",
2062
+ helperText: S = "",
2063
+ helperTextClassName: C = "",
2064
+ ...q
2065
+ } = e;
2066
+ return /* @__PURE__ */ N(
2067
+ "div",
2068
+ {
2069
+ className: `relative z-0 w-full mb-5 group ${g}`,
2070
+ children: [
2071
+ /* @__PURE__ */ h(
2072
+ "textarea",
2073
+ {
2074
+ ref: t,
2075
+ name: n,
2076
+ id: c,
2077
+ className: `text-input text-area ${bs(i)} ${f} peer`,
2078
+ placeholder: "",
2079
+ required: y,
2080
+ value: s,
2081
+ onChange: r,
2082
+ disabled: m,
2083
+ ...q
2084
+ }
2085
+ ),
2086
+ /* @__PURE__ */ N(
2087
+ "label",
2088
+ {
2089
+ htmlFor: n,
2090
+ className: `text-input-label ${ps(i)} ${x}`,
2091
+ children: [
2092
+ a,
2093
+ y ? " *" : ""
2094
+ ]
2095
+ }
2096
+ ),
2097
+ /* @__PURE__ */ h(
2098
+ "p",
2099
+ {
2100
+ className: `text-input-helper-text ${ws(i)} ${C}`,
2101
+ children: i !== "error" && i !== "good" ? d : S
2102
+ }
2103
+ )
2104
+ ]
2105
+ }
2106
+ );
2107
+ }), an = (e) => {
2108
+ const { t } = P(), {
2109
+ children: s,
2110
+ handleSubmit: r,
2111
+ onSubmit: i,
2112
+ isLoading: n = !1,
2113
+ buttonEnd: c = !0,
2114
+ reset: a
2115
+ } = e;
2116
+ return /* @__PURE__ */ N("form", { className: "form-container", onSubmit: r(i), children: [
2117
+ s,
2118
+ /* @__PURE__ */ N("div", { className: `flex gap-2 mt-5 ${c ? "justify-end" : ""}`, children: [
2119
+ /* @__PURE__ */ N(
2120
+ fe,
2121
+ {
2122
+ type: "submit",
2123
+ color: "primary",
2124
+ variant: "submit",
2125
+ disabled: n,
2126
+ name: t("_accessibility:buttons.submit"),
2127
+ "aria-label": t("_accessibility:ariaLabels.submit"),
2128
+ children: [
2129
+ n ? /* @__PURE__ */ h(Ke, { color: "text-dark", className: "mt-1" }) : null,
2130
+ t("_accessibility:buttons.submit")
2131
+ ]
2132
+ }
2133
+ ),
2134
+ /* @__PURE__ */ h(
2135
+ fe,
2136
+ {
2137
+ type: "button",
2138
+ variant: "outlined",
2139
+ onClick: () => a == null ? void 0 : a(),
2140
+ name: t("_accessibility:buttons.cancel"),
2141
+ "aria-label": t("_accessibility:ariaLabels.cancel"),
2142
+ children: t("_accessibility:buttons.cancel")
2143
+ }
2144
+ )
2145
+ ] })
2146
+ ] });
2147
+ }, cn = Mt(function(e, t) {
2148
+ const [s, r] = se(!1);
2149
+ return /* @__PURE__ */ h(vs, { ...e, type: s ? "text" : "password", ref: t, children: /* @__PURE__ */ h(
2150
+ me,
2151
+ {
2152
+ type: "button",
2153
+ tabIndex: -1,
2154
+ className: "absolute right-2 password-icon",
2155
+ onClick: () => r(!s),
2156
+ icon: s ? $s : Fs
2157
+ }
2158
+ ) });
2159
+ }), ns = (e) => {
2160
+ const { t } = P(), {
2161
+ title: s,
2162
+ children: r,
2163
+ handleClose: i,
2164
+ open: n = !1,
2165
+ containerClassName: c = "",
2166
+ className: a = "",
2167
+ animationClass: m = "appear"
2168
+ } = e, [y, d] = se(window.innerWidth), g = F(
2169
+ (C) => {
2170
+ C.key === "Escape" && n && i();
2171
+ },
2172
+ [n, i]
2173
+ );
2174
+ te(() => (window.addEventListener("keydown", g), () => {
2175
+ window.removeEventListener("keydown", g);
2176
+ }), [g]);
2177
+ const f = F(() => {
2178
+ d(window.innerWidth);
2179
+ }, []);
2180
+ te(() => (window.addEventListener("resize", f), () => {
2181
+ window.removeEventListener("resize", f);
2182
+ }), [f]);
2183
+ const x = De(() => Is({ width: `${y}px` }), [y]), S = F(
2184
+ (C) => {
2185
+ var q;
2186
+ ((q = C == null ? void 0 : C.currentTarget) == null ? void 0 : q.getAttribute("name")) === t("_accessibility:buttons.closeDialog") && i();
2187
+ },
2188
+ [t, i]
2189
+ );
2190
+ return te(() => {
2191
+ const C = (q) => {
2192
+ q ? document.body.style.overflow = "hidden" : document.body.style.overflow = "auto";
2193
+ };
2194
+ return C(n), () => {
2195
+ C(n);
2196
+ };
2197
+ }, [n]), Ot(
2198
+ /* @__PURE__ */ h(
2199
+ "div",
2200
+ {
2201
+ "aria-label": t("_accessibility:ariaLabels.closeDialog"),
2202
+ "aria-disabled": !n,
2203
+ onClick: S,
2204
+ className: `dialog-backdrop animated ${n ? `opened ${m}` : "closed"} ${x} h-screen ${n ? "bg-base/20 backdrop-blur-xl" : "pointer-events-none"} ${c}`,
2205
+ children: /* @__PURE__ */ N(
2206
+ "div",
2207
+ {
2208
+ className: `dialog elevated animated ${n ? `opened ${m}` : "closed"} ${a}`,
2209
+ children: [
2210
+ /* @__PURE__ */ N("div", { className: "dialog-header", children: [
2211
+ /* @__PURE__ */ h("h3", { className: "text-text text-xl", children: s }),
2212
+ /* @__PURE__ */ h(
2213
+ me,
2214
+ {
2215
+ icon: tt,
2216
+ disabled: !n,
2217
+ "aria-disabled": !n,
2218
+ onClick: i,
2219
+ className: "icon-button text-red-400",
2220
+ name: t("_accessibility:buttons.closeDialog"),
2221
+ "aria-label": t("_accessibility:ariaLabels.closeDialog")
2222
+ }
2223
+ )
2224
+ ] }),
2225
+ r
2226
+ ]
2227
+ }
2228
+ )
2229
+ }
2230
+ ),
2231
+ document.body
2232
+ );
2233
+ }, ln = (e) => {
2234
+ const { t } = P(), {
2235
+ children: s,
2236
+ handleSubmit: r,
2237
+ onSubmit: i,
2238
+ handleClose: n,
2239
+ isLoading: c = !1,
2240
+ buttonEnd: a = !0,
2241
+ ...m
2242
+ } = e;
2243
+ return /* @__PURE__ */ h(ns, { ...m, handleClose: n, children: /* @__PURE__ */ N("form", { onSubmit: r(i), children: [
2244
+ /* @__PURE__ */ h("div", { className: "form-container", children: s }),
2245
+ /* @__PURE__ */ N("div", { className: `flex gap-2 mt-2 ${a ? "justify-end" : ""}`, children: [
2246
+ /* @__PURE__ */ N(
2247
+ fe,
2248
+ {
2249
+ type: "submit",
2250
+ color: "primary",
2251
+ variant: "submit",
2252
+ className: "!px-6",
2253
+ disabled: c,
2254
+ name: t("_accessibility:buttons.submit"),
2255
+ "aria-label": t("_accessibility:ariaLabels.submit"),
2256
+ children: [
2257
+ c ? /* @__PURE__ */ h(Ke, { color: "text-dark", className: "mt-1" }) : null,
2258
+ t("_accessibility:buttons.submit")
2259
+ ]
2260
+ }
2261
+ ),
2262
+ /* @__PURE__ */ h(
2263
+ fe,
2264
+ {
2265
+ type: "button",
2266
+ variant: "outlined",
2267
+ disabled: c,
2268
+ onClick: n,
2269
+ name: t("_accessibility:buttons.cancel"),
2270
+ "aria-label": t("_accessibility:ariaLabels.cancel"),
2271
+ children: t("_accessibility:buttons.cancel")
2272
+ }
2273
+ )
2274
+ ] })
2275
+ ] }) });
2276
+ }, un = (e) => {
2277
+ const { t } = P(), {
2278
+ children: s,
2279
+ handleSubmit: r,
2280
+ handleClose: i,
2281
+ isLoading: n = !1,
2282
+ ...c
2283
+ } = e;
2284
+ return /* @__PURE__ */ N(ns, { ...c, handleClose: i, children: [
2285
+ s,
2286
+ /* @__PURE__ */ N("div", { className: "flex gap-2 mt-5", children: [
2287
+ /* @__PURE__ */ N(
2288
+ fe,
2289
+ {
2290
+ color: "primary",
2291
+ variant: "submit",
2292
+ disabled: n,
2293
+ onClick: r,
2294
+ name: t("_accessibility:buttons.ok"),
2295
+ "aria-label": t("_accessibility:ariaLabels.ok"),
2296
+ children: [
2297
+ n ? /* @__PURE__ */ h(Ke, { color: "text-text-mute", className: "mt-1" }) : null,
2298
+ t("_accessibility:buttons.ok")
2299
+ ]
2300
+ }
2301
+ ),
2302
+ /* @__PURE__ */ h(
2303
+ fe,
2304
+ {
2305
+ type: "button",
2306
+ variant: "outlined",
2307
+ disabled: n,
2308
+ onClick: i,
2309
+ name: t("_accessibility:buttons.cancel"),
2310
+ "aria-label": t("_accessibility:ariaLabels.cancel"),
2311
+ children: t("_accessibility:buttons.cancel")
2312
+ }
2313
+ )
2314
+ ] })
2315
+ ] });
2316
+ };
2317
+ function dn(e) {
2318
+ const { t } = P(), { open: s, onClose: r, menuMap: i } = e, { account: n } = Kt(), { linkComponent: c } = He(), a = c, m = De(() => i.filter((d) => {
2319
+ const g = d.auth, f = !!(n != null && n.email);
2320
+ return g == null || g && f || !g && !f;
2321
+ }), [n]), y = F(
2322
+ (d) => {
2323
+ d.key === "Escape" && s && r();
2324
+ },
2325
+ [r, s]
2326
+ );
2327
+ return te(() => (document.addEventListener("keydown", y), () => {
2328
+ document.removeEventListener("keydown", y);
2329
+ }), [y]), /* @__PURE__ */ h(
2330
+ "div",
2331
+ {
2332
+ "aria-label": t("_accessibility:ariaLabels.closeMenu"),
2333
+ "aria-disabled": !s,
2334
+ className: `${s ? "opened" : "closed"} drawer-backdrop`,
2335
+ onClick: () => r(),
2336
+ children: /* @__PURE__ */ N(
2337
+ "aside",
2338
+ {
2339
+ className: `${s ? "opened" : "closed"} bg-base drawer animated`,
2340
+ children: [
2341
+ /* @__PURE__ */ h("h2", { className: "text-xl text-text px-5 pb-5 font-bold poppins", children: t("_pages:home.appName") }),
2342
+ /* @__PURE__ */ h("ul", { className: "flex flex-col", children: m.map((d, g) => /* @__PURE__ */ h(
2343
+ "li",
2344
+ {
2345
+ className: `w-full flex hover:bg-base-light ${d.path === location.pathname ? "bg-base-light" : ""} animated`,
2346
+ children: d.type !== "divider" && a ? /* @__PURE__ */ N(
2347
+ a,
2348
+ {
2349
+ "aria-disabled": !s,
2350
+ to: d.path ?? `/${d.path}`,
2351
+ "aria-label": t(`_accessibility:ariaLabels.${d.path}`),
2352
+ className: "text-lg text-text-muted w-full py-2 px-5 flex items-center justify-start gap-2",
2353
+ children: [
2354
+ d.icon,
2355
+ t(`_pages:${d.page}.title`)
2356
+ ]
2357
+ }
2358
+ ) : /* @__PURE__ */ h("hr", { className: "border-border border-spacing-x-0.5 w-full" })
2359
+ },
2360
+ `${d.page ?? g}`
2361
+ )) })
2362
+ ]
2363
+ }
2364
+ )
2365
+ }
2366
+ );
2367
+ }
2368
+ function fn(e) {
2369
+ const { error: t } = e, { t: s } = P();
2370
+ return /* @__PURE__ */ N("div", { className: "flex flex-col items-center justify-center pt-10 gap-5", children: [
2371
+ /* @__PURE__ */ h(ee, { icon: Bs, className: "text-red-300 text-4xl" }),
2372
+ /* @__PURE__ */ h("p", { className: "text-text text-center", children: (t == null ? void 0 : t.message) ?? s("_accessibility:errors.unknownError") })
2373
+ ] });
2374
+ }
2375
+ const Nr = (e) => {
2376
+ const { showBackButton: t, title: s, actions: r } = e, { t: i } = P(), { navigate: n } = He();
2377
+ return /* @__PURE__ */ N("div", { className: "page-header", children: [
2378
+ /* @__PURE__ */ N("div", { className: "flex gap-2 items-center justify-start", children: [
2379
+ t && /* @__PURE__ */ h(
2380
+ me,
2381
+ {
2382
+ icon: Ls,
2383
+ onClick: () => n(-1),
2384
+ name: i("_accessibility:buttons.back"),
2385
+ "data-tooltip-id": "tooltip",
2386
+ "data-tooltip-content": i("_accessibility:buttons.back")
2387
+ }
2388
+ ),
2389
+ /* @__PURE__ */ h("h2", { className: "text-3xl font-bold", children: s })
2390
+ ] }),
2391
+ /* @__PURE__ */ N("div", { children: [
2392
+ /* @__PURE__ */ h(Ut, { className: "max-xs:!hidden", actions: r ?? [] }),
2393
+ /* @__PURE__ */ h(Sr, { className: "min-xs:hidden", actions: r ?? [] })
2394
+ ] })
2395
+ ] });
2396
+ }, hn = (e) => {
2397
+ const {
2398
+ title: t,
2399
+ children: s,
2400
+ addOptions: r,
2401
+ filterOptions: i,
2402
+ actions: n,
2403
+ queryKey: c,
2404
+ isLoading: a = !1,
2405
+ isAnimated: m = !0,
2406
+ showBackButton: y = !1
2407
+ } = e, { t: d } = P(), { countOfFilters: g } = xs(), f = De(() => {
2408
+ const x = Array.isArray(n) ? [...n] : [];
2409
+ if (c) {
2410
+ const S = {
2411
+ id: Se.Refresh,
2412
+ onClick: () => Ce.invalidateQueries({ queryKey: c }),
2413
+ icon: /* @__PURE__ */ h(ee, { icon: Dt }),
2414
+ tooltip: d("_pages:common.actions.refresh.text")
2415
+ };
2416
+ x.unshift(S);
2417
+ }
2418
+ if (r) {
2419
+ const S = {
2420
+ ...r,
2421
+ id: Se.Add,
2422
+ icon: /* @__PURE__ */ h(ee, { icon: gt })
2423
+ };
2424
+ x.unshift(S);
2425
+ }
2426
+ if (i) {
2427
+ const S = {
2428
+ ...i,
2429
+ id: "filter",
2430
+ icon: /* @__PURE__ */ h(ee, { icon: Ts }),
2431
+ children: /* @__PURE__ */ h(
2432
+ _s,
2433
+ {
2434
+ className: `${g > 0 ? "show" : "hide"} `,
2435
+ count: g
2436
+ }
2437
+ )
2438
+ };
2439
+ x.push(S);
2440
+ }
2441
+ return x;
2442
+ }, [n, r, g, i, c, d]);
2443
+ return /* @__PURE__ */ N("main", { className: "", children: [
2444
+ /* @__PURE__ */ N("div", { className: "flex flex-col", children: [
2445
+ /* @__PURE__ */ h(
2446
+ Nr,
2447
+ {
2448
+ showBackButton: y,
2449
+ actions: f,
2450
+ title: t
2451
+ }
2452
+ ),
2453
+ /* @__PURE__ */ h("div", { className: `px-5 py-3 h-useConfigfull ${m ? "appear" : ""}`, children: a ? /* @__PURE__ */ h(Ke, { containerClassName: "flex justify-center items-center h-50" }) : s })
2454
+ ] }),
2455
+ /* @__PURE__ */ h(
2456
+ me,
2457
+ {
2458
+ icon: gt,
2459
+ color: "primary",
2460
+ variant: "submit",
2461
+ onClick: () => {
2462
+ var x;
2463
+ return (x = r == null ? void 0 : r.onClick) == null ? void 0 : x.call(r);
2464
+ },
2465
+ className: "button fab min-xs:!hidden"
2466
+ }
2467
+ )
2468
+ ] });
2469
+ }, mn = (e) => {
2470
+ const { t } = P(), {
2471
+ loading: s = !1,
2472
+ emptyComponent: r = null,
2473
+ emptyMessage: i = t("_accessibility:messages.empty"),
2474
+ renderComponent: n,
2475
+ data: c = []
2476
+ } = e;
2477
+ return /* @__PURE__ */ h(Te, { children: c != null && c.length ? /* @__PURE__ */ h("ul", { className: "pretty-grid-main", children: c == null ? void 0 : c.map((a) => /* @__PURE__ */ h("li", { className: "pretty-grid-item", children: n(a) }, a.id)) }) : /* @__PURE__ */ h(Te, { children: r || /* @__PURE__ */ h("p", { className: "text-center mt-5", children: i }) }) });
2478
+ }, kr = () => {
2479
+ const [e, t] = se(vt());
2480
+ return te(() => {
2481
+ const s = setInterval(() => {
2482
+ t(vt());
2483
+ }, 1e3);
2484
+ return () => clearInterval(s);
2485
+ }, []), /* @__PURE__ */ h("p", { className: "capitalize max-xs:hidden", children: e });
2486
+ };
2487
+ function yn(e) {
2488
+ const { t } = P(), { openDrawer: s } = e, { searchComponent: r } = He(), [i, n] = se(!1), c = F((m) => {
2489
+ (Js() ? m.metaKey : m.ctrlKey) && m.shiftKey && m.key.toLowerCase() === "f" && (n(!0), m.preventDefault());
2490
+ }, []);
2491
+ te(() => (window.addEventListener("keydown", c), () => {
2492
+ window.removeEventListener("keydown", c);
2493
+ }), [c]);
2494
+ const a = r;
2495
+ return /* @__PURE__ */ N(Te, { children: [
2496
+ location.pathname !== "/" && !!a && /* @__PURE__ */ h(
2497
+ a,
2498
+ {
2499
+ open: i,
2500
+ onClose: () => n(!1)
2501
+ }
2502
+ ),
2503
+ /* @__PURE__ */ N("header", { id: "header", className: "header", children: [
2504
+ /* @__PURE__ */ N("div", { className: "flex gap-2 items-center", children: [
2505
+ /* @__PURE__ */ h(
2506
+ me,
2507
+ {
2508
+ type: "button",
2509
+ icon: Ds,
2510
+ onClick: s,
2511
+ name: t("_accessibility:buttons.openMenu"),
2512
+ "aria-label": t("_accessibility:ariaLabels.openMenu"),
2513
+ className: "menu animated"
2514
+ }
2515
+ ),
2516
+ /* @__PURE__ */ h("h1", { className: "text-lg text-text pointer-events-none poppins font-bold", children: t("_pages:home.appName") })
2517
+ ] }),
2518
+ /* @__PURE__ */ N("div", { className: "flex items-center justify-end gap-2", children: [
2519
+ /* @__PURE__ */ h(
2520
+ me,
2521
+ {
2522
+ icon: Vs,
2523
+ className: "min-xs:!hidden",
2524
+ onClick: () => n(!0)
2525
+ }
2526
+ ),
2527
+ /* @__PURE__ */ h(kr, {})
2528
+ ] })
2529
+ ] })
2530
+ ] });
2531
+ }
2532
+ function gn() {
2533
+ const { t: e } = P(), { notification: t, removeNotification: s } = Ne(), [r, i] = se(/* @__PURE__ */ new Set()), n = F(
2534
+ (d) => {
2535
+ if (d === void 0) {
2536
+ const g = new Set(t.map((f, x) => x));
2537
+ i(g), window.setTimeout(() => s(), 300);
2538
+ } else
2539
+ i((g) => new Set(g).add(d)), window.setTimeout(() => s(d), 300);
2540
+ },
2541
+ [t, s]
2542
+ ), c = F((d) => {
2543
+ switch (d) {
2544
+ case j.error:
2545
+ return Ms;
2546
+ default:
2547
+ return Ps;
2548
+ }
2549
+ }, []), a = F((d) => {
2550
+ switch (d) {
2551
+ case j.success:
2552
+ return "!text-success";
2553
+ case j.error:
2554
+ return "!text-error";
2555
+ case j.warning:
2556
+ return "!text-warning";
2557
+ default:
2558
+ return "!text-info";
2559
+ }
2560
+ }, []), m = F((d) => {
2561
+ switch (d) {
2562
+ case j.success:
2563
+ return "bg-bg-success";
2564
+ case j.error:
2565
+ return "bg-bg-error";
2566
+ case j.warning:
2567
+ return "bg-bg-warning";
2568
+ default:
2569
+ return "bg-bg-info";
2570
+ }
2571
+ }, []), y = Pt();
2572
+ return te(() => {
2573
+ y.current = () => n();
2574
+ }, [n]), te(() => {
2575
+ if (!(t != null && t.length)) return;
2576
+ const d = (g) => {
2577
+ var f;
2578
+ return (f = y.current) == null ? void 0 : f.call(y, g);
2579
+ };
2580
+ return window.addEventListener("click", d), () => {
2581
+ window.removeEventListener("click", d);
2582
+ };
2583
+ }, [t == null ? void 0 : t.length]), te(() => {
2584
+ i(/* @__PURE__ */ new Set());
2585
+ }, [t]), Ot(
2586
+ /* @__PURE__ */ h(
2587
+ "div",
2588
+ {
2589
+ className: `notification-portal ${t != null && t.length ? "w-screen h-screen" : ""}`,
2590
+ children: t != null && t.length ? t == null ? void 0 : t.map(({ id: d, type: g, message: f }, x) => /* @__PURE__ */ N(
2591
+ "div",
2592
+ {
2593
+ className: `notification ${r.has(x) ? "closing" : ""} ${m(
2594
+ g ?? j.error
2595
+ )}`,
2596
+ onClick: (S) => S.stopPropagation(),
2597
+ children: [
2598
+ /* @__PURE__ */ N("div", { className: "flex gap-3 items-center", children: [
2599
+ /* @__PURE__ */ h(
2600
+ ee,
2601
+ {
2602
+ icon: c(g ?? j.error),
2603
+ className: `${a(g ?? j.error)}`
2604
+ }
2605
+ ),
2606
+ /* @__PURE__ */ h(
2607
+ "p",
2608
+ {
2609
+ className: `whitespace-nowrap ${a(
2610
+ g ?? j.error
2611
+ )}`,
2612
+ children: f
2613
+ }
2614
+ )
2615
+ ] }),
2616
+ /* @__PURE__ */ h(
2617
+ me,
2618
+ {
2619
+ type: "button",
2620
+ icon: tt,
2621
+ color: "error",
2622
+ className: "group",
2623
+ onClick: (S) => {
2624
+ S.stopPropagation(), n(x);
2625
+ },
2626
+ iconClassName: `${a(
2627
+ g ?? j.error
2628
+ )} group-hover:!text-red-400 cursor-pointer`,
2629
+ name: e("_accessibility:buttons.closeNotification"),
2630
+ "aria-label": e("_accessibility:ariaLabels.closeNotification")
2631
+ }
2632
+ )
2633
+ ]
2634
+ },
2635
+ d
2636
+ )) : null
2637
+ }
2638
+ ),
2639
+ document.body
2640
+ );
2641
+ }
2642
+ function Ke(e) {
2643
+ const {
2644
+ color: t = "text-primary",
2645
+ size: s = "text-xl",
2646
+ className: r = "",
2647
+ containerClassName: i = ""
2648
+ } = e;
2649
+ return /* @__PURE__ */ h("div", { className: i, children: /* @__PURE__ */ h(
2650
+ ee,
2651
+ {
2652
+ className: `rotate ${t} ${s} ${r}`,
2653
+ icon: Vt
2654
+ }
2655
+ ) });
2656
+ }
2657
+ function bn() {
2658
+ return /* @__PURE__ */ h("div", { className: "w-screen h-screen flex items-center justify-center overflow-hidden", children: /* @__PURE__ */ h(Cs, { className: "blur-appear" }) });
2659
+ }
2660
+ const Ar = (e) => {
2661
+ const { id: t, active: s, onClick: r, children: i, to: n } = e, { linkComponent: c } = He();
2662
+ return /* @__PURE__ */ h(
2663
+ c,
2664
+ {
2665
+ to: n ?? `#${t}`,
2666
+ onClick: () => r(),
2667
+ className: `button submit tab ${s ? "primary" : "outlined"}`,
2668
+ children: i
2669
+ }
2670
+ );
2671
+ }, Er = (e) => {
2672
+ var m;
2673
+ const {
2674
+ tabs: t = [],
2675
+ defaultTab: s,
2676
+ className: r = "",
2677
+ tabsContainerClassName: i = ""
2678
+ } = e, [n, c] = se((m = t[0]) == null ? void 0 : m.id), a = De(() => t.find((y) => y.id === n), [t, n]);
2679
+ return te(() => {
2680
+ s && c(s);
2681
+ }, [s]), /* @__PURE__ */ N("div", { className: `tabs-layout-main ${r}`, children: [
2682
+ /* @__PURE__ */ h(
2683
+ "ul",
2684
+ {
2685
+ className: `horizontal tabs tabs-container ${i}`,
2686
+ children: t.map(({ id: y, to: d, label: g }) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
2687
+ Ar,
2688
+ {
2689
+ onClick: () => c(y),
2690
+ id: y,
2691
+ to: d ?? "",
2692
+ siblings: t.length > 1,
2693
+ active: n === y,
2694
+ children: g
2695
+ }
2696
+ ) }, y))
2697
+ }
2698
+ ),
2699
+ a == null ? void 0 : a.content
2700
+ ] });
2701
+ }, $r = (e) => {
2702
+ const {
2703
+ translation: t,
2704
+ onClickNext: s,
2705
+ image: r = "",
2706
+ alt: i = "",
2707
+ final: n = !1
2708
+ } = e, { setGuestMode: c } = Kt(), { t: a } = P();
2709
+ return /* @__PURE__ */ N("div", { className: "big-appear w-md flex flex-col gap-20", children: [
2710
+ /* @__PURE__ */ h("img", { src: r, alt: i }),
2711
+ /* @__PURE__ */ h("h2", { className: "text-5xl text-center leading-16", children: a(`_pages:onboarding.${t}.title`) }),
2712
+ /* @__PURE__ */ h("p", { className: "text-center !text-lg", children: a(`_pages:onboarding.${t}.body`) }),
2713
+ /* @__PURE__ */ h("div", { className: "flex gap-5 items-center justify-center", children: n ? /* @__PURE__ */ N(Te, { children: [
2714
+ /* @__PURE__ */ h(
2715
+ fe,
2716
+ {
2717
+ color: "primary",
2718
+ className: "!px-8",
2719
+ variant: "outlined",
2720
+ onClick: () => {
2721
+ c(!0), window.location.href = "/";
2722
+ },
2723
+ "aria-label": a("_accessibility:ariaLabels.start"),
2724
+ children: a("_accessibility:buttons.startAsGuest")
2725
+ }
2726
+ ),
2727
+ /* @__PURE__ */ h(
2728
+ fe,
2729
+ {
2730
+ color: "primary",
2731
+ variant: "submit",
2732
+ className: "!px-8",
2733
+ "aria-label": a("_accessibility:ariaLabels.start"),
2734
+ onClick: () => window.location.href = "/auth/sign-in",
2735
+ children: a("_accessibility:buttons.signIn")
2736
+ }
2737
+ )
2738
+ ] }) : /* @__PURE__ */ N(Te, { children: [
2739
+ /* @__PURE__ */ h(
2740
+ fe,
2741
+ {
2742
+ color: "primary",
2743
+ className: "!px-8",
2744
+ variant: "outlined",
2745
+ onClick: () => window.location.href = "/auth/sign-in",
2746
+ "aria-label": a("_accessibility:ariaLabels.skip"),
2747
+ children: a("_accessibility:buttons.skip")
2748
+ }
2749
+ ),
2750
+ /* @__PURE__ */ h(
2751
+ fe,
2752
+ {
2753
+ color: "primary",
2754
+ className: "!px-8",
2755
+ variant: "outlined",
2756
+ onClick: () => s(),
2757
+ "aria-label": a("_accessibility:ariaLabels.next"),
2758
+ children: a("_accessibility:buttons.next")
2759
+ }
2760
+ )
2761
+ ] }) })
2762
+ ] });
2763
+ }, pn = (e) => {
2764
+ const { steps: t } = e, [s, r] = se(1), i = De(() => t.map((n, c) => ({
2765
+ id: c + 1,
2766
+ label: "",
2767
+ content: /* @__PURE__ */ h(
2768
+ $r,
2769
+ {
2770
+ translation: n,
2771
+ final: c === t.length - 1,
2772
+ onClickNext: () => r(s + 1)
2773
+ }
2774
+ )
2775
+ })), [s]);
2776
+ return /* @__PURE__ */ h("div", { className: "onboarding-main", children: /* @__PURE__ */ h(Er, { defaultTab: s, tabs: i }) });
2777
+ }, wn = (e) => {
2778
+ const {
2779
+ message: t,
2780
+ messageProps: s = { className: "text-gray-400 text-balance text-center" },
2781
+ action: r,
2782
+ iconProps: i
2783
+ } = e;
2784
+ return /* @__PURE__ */ N("div", { className: "flex flex-col items-center justify-center gap-5 pt-5", children: [
2785
+ i && /* @__PURE__ */ h(ee, { ...i ?? {} }),
2786
+ /* @__PURE__ */ h("p", { ...s ?? {}, children: t }),
2787
+ r && /* @__PURE__ */ h(It, { showTooltips: !1, showText: !0, ...r })
2788
+ ] });
2789
+ };
2790
+ export {
2791
+ qt as APIClient,
2792
+ It as Action,
2793
+ Ut as Actions,
2794
+ Sr as ActionsDropdown,
2795
+ Gs as AuthClient,
2796
+ Jr as AuthProvider,
2797
+ Qr as BaseClient,
2798
+ fe as Button,
2799
+ js as Chip,
2800
+ Yr as ConfigProvider,
2801
+ un as ConfirmationDialog,
2802
+ Br as DeletableChip,
2803
+ ns as Dialog,
2804
+ dn as Drawer,
2805
+ Hs as Dropdown,
2806
+ wn as Empty,
2807
+ fn as Error,
2808
+ an as FormContainer,
2809
+ ln as FormDialog,
2810
+ Se as GlobalActions,
2811
+ Hr as IManager,
2812
+ me as IconButton,
2813
+ Ke as Loading,
2814
+ Gr as ManagerProvider,
2815
+ Z as Methods,
2816
+ yn as Navbar,
2817
+ gn as Notification,
2818
+ j as NotificationEnumType,
2819
+ zr as NotificationProvider,
2820
+ pn as Onboarding,
2821
+ hn as Page,
2822
+ on as ParagraphInput,
2823
+ cn as PasswordInput,
2824
+ mn as PrettyGrid,
2825
+ bn as SplashScreen,
2826
+ $r as Step,
2827
+ Ar as Tab,
2828
+ Er as TabsLayout,
2829
+ nn as ToTop,
2830
+ zs as buildQueryUrl,
2831
+ Kr as enumToKeyValueArray,
2832
+ Wr as formatForDatetimeLocal,
2833
+ Bt as fromLocal,
2834
+ vt as getFormattedDateTime,
2835
+ Js as isMac,
2836
+ Ae as makeRequest,
2837
+ Rt as parseQueries,
2838
+ Ce as queryClient,
2839
+ wt as removeFromLocal,
2840
+ pt as toLocal,
2841
+ Kt as useAuth,
2842
+ He as useConfig,
2843
+ zt as useConfirmationForm,
2844
+ vr as useDeleteAction,
2845
+ en as useDeleteDialog,
2846
+ rs as useDialog,
2847
+ Zr as useEditAction,
2848
+ _r as useExportAction,
2849
+ rn as useExportActionMutate,
2850
+ tn as useFormDialog,
2851
+ Ys as useManager,
2852
+ Ne as useNotification,
2853
+ Xr as usePostForm,
2854
+ xr as useRestoreAction,
2855
+ sn as useRestoreDialog,
2856
+ Cr as useScrollTrigger,
2857
+ jr as useTimeAge
2858
+ };