@sito/dashboard-app 0.0.46 → 0.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/components/Onboarding/Onboarding.stories.d.ts +9 -1
- package/dist/components/Onboarding/Onboarding.test.d.ts +1 -0
- package/dist/components/Onboarding/types.d.ts +9 -4
- package/dist/components/TabsLayout/types.d.ts +2 -0
- package/dist/dashboard-app.cjs +1 -1
- package/dist/dashboard-app.js +1205 -1190
- package/dist/lib/api/IndexedDBClient.d.ts +1 -1
- package/dist/main.css +1 -1
- package/package.json +1 -1
package/dist/dashboard-app.js
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
1
|
var Ss = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var W = (
|
|
2
|
+
var Ts = (e, t, s) => t in e ? Ss(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
3
|
+
var W = (e, t, s) => Ts(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
4
|
import "./main.css";
|
|
5
|
-
import { State as
|
|
5
|
+
import { State as Es, inputStateClassName as _s, labelStateClassName as Cs, helperTextStateClassName as Ns, useTranslation as R, Button as ge, Loading as Le, TextInput as xs, FileInput as As, IconButton as Fs, Actions as $s, ActionsDropdown as Ls, useTableOptions as Ds, Badge as Vs, Action as Rs } from "@sito/dashboard";
|
|
6
6
|
export * from "@sito/dashboard";
|
|
7
7
|
import { Action as jn, Actions as Qn, ActionsDropdown as Gn, Button as zn } from "@sito/dashboard";
|
|
8
|
-
import { jsxs as
|
|
8
|
+
import { jsxs as $, jsx as g, Fragment as Oe } from "react/jsx-runtime";
|
|
9
9
|
import { FontAwesomeIcon as ue } from "@fortawesome/react-fontawesome";
|
|
10
|
-
import ae, { forwardRef as Bt, useState as X, useCallback as D, useEffect as me, useReducer as qt, useRef as Ue, createContext as De, useContext as Ve, useMemo as
|
|
11
|
-
import { faEyeSlash as Ps, faEye as Ms, faClose as Ht, faTrash as Os, faRotateLeft as Wt, faPencil as Us, faCircleNotch as jt, faCloudArrowDown as Ks, faCloudUpload as Bs, faArrowUp as qs, faArrowLeft as Hs, faAdd as
|
|
10
|
+
import ae, { forwardRef as Bt, useState as X, useCallback as D, useEffect as me, useReducer as qt, useRef as Ue, createContext as De, useContext as Ve, useMemo as xe, useLayoutEffect as Is } from "react";
|
|
11
|
+
import { faEyeSlash as Ps, faEye as Ms, faClose as Ht, faTrash as Os, faRotateLeft as Wt, faPencil as Us, faCircleNotch as jt, faCloudArrowDown as Ks, faCloudUpload as Bs, faArrowUp as qs, faArrowLeft as Hs, faAdd as Nt, faFilter as Ws, faBars as js, faSearch as Qs, faCircleCheck as Gs, faWarning as zs } from "@fortawesome/free-solid-svg-icons";
|
|
12
12
|
import { createPortal as Qt } from "react-dom";
|
|
13
13
|
import { QueryClient as Js, QueryClientProvider as Ys, useMutation as Ke, useQuery as Xs } from "@tanstack/react-query";
|
|
14
14
|
import { faSadTear as Zs } from "@fortawesome/free-regular-svg-icons";
|
|
15
|
-
const
|
|
15
|
+
const xt = (e) => e == null ? !1 : `${e}`.length > 0, an = Bt(function(e, t) {
|
|
16
16
|
const {
|
|
17
17
|
value: s,
|
|
18
18
|
defaultValue: r,
|
|
19
19
|
onChange: i,
|
|
20
|
-
state: n =
|
|
20
|
+
state: n = Es.default,
|
|
21
21
|
name: a = "",
|
|
22
22
|
id: o = "",
|
|
23
23
|
label: l = "",
|
|
24
|
-
disabled:
|
|
25
|
-
required:
|
|
26
|
-
containerClassName:
|
|
24
|
+
disabled: m = !1,
|
|
25
|
+
required: f = !1,
|
|
26
|
+
containerClassName: h = "",
|
|
27
27
|
inputClassName: d = "",
|
|
28
28
|
labelClassName: p = "",
|
|
29
|
-
helperText:
|
|
29
|
+
helperText: b = "",
|
|
30
30
|
helperTextClassName: S = "",
|
|
31
|
-
...
|
|
32
|
-
} =
|
|
33
|
-
() =>
|
|
34
|
-
),
|
|
35
|
-
|
|
31
|
+
...E
|
|
32
|
+
} = e, N = s !== void 0, [C, F] = X(
|
|
33
|
+
() => xt(r)
|
|
34
|
+
), x = N ? xt(s) : C, A = (I) => {
|
|
35
|
+
N || F(I.currentTarget.value.length > 0), i == null || i(I);
|
|
36
36
|
};
|
|
37
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ $("div", { className: `form-paragraph-container group ${h}`, children: [
|
|
38
38
|
/* @__PURE__ */ g(
|
|
39
39
|
"textarea",
|
|
40
40
|
{
|
|
41
|
-
ref:
|
|
41
|
+
ref: t,
|
|
42
42
|
name: a,
|
|
43
43
|
id: o,
|
|
44
|
-
className: `text-input text-area form-paragraph-textarea peer ${_s(n)} ${
|
|
45
|
-
required:
|
|
44
|
+
className: `text-input text-area form-paragraph-textarea peer ${_s(n)} ${x ? "has-value" : ""} ${E.placeholder ? "has-placeholder" : ""} ${d}`,
|
|
45
|
+
required: f,
|
|
46
46
|
defaultValue: r,
|
|
47
|
-
...
|
|
48
|
-
onChange:
|
|
49
|
-
disabled:
|
|
50
|
-
...
|
|
47
|
+
...N ? { value: s } : {},
|
|
48
|
+
onChange: A,
|
|
49
|
+
disabled: m,
|
|
50
|
+
...E
|
|
51
51
|
}
|
|
52
52
|
),
|
|
53
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ $(
|
|
54
54
|
"label",
|
|
55
55
|
{
|
|
56
56
|
htmlFor: o,
|
|
57
57
|
className: `text-input-label ${Cs(n)} ${p}`,
|
|
58
58
|
children: [
|
|
59
59
|
l,
|
|
60
|
-
|
|
60
|
+
f ? " *" : ""
|
|
61
61
|
]
|
|
62
62
|
}
|
|
63
63
|
),
|
|
64
|
-
!!
|
|
64
|
+
!!b && /* @__PURE__ */ g(
|
|
65
65
|
"p",
|
|
66
66
|
{
|
|
67
|
-
className: `text-input-helper-text ${
|
|
68
|
-
children:
|
|
67
|
+
className: `text-input-helper-text ${Ns(n)} ${S}`,
|
|
68
|
+
children: b
|
|
69
69
|
}
|
|
70
70
|
)
|
|
71
71
|
] });
|
|
72
|
-
}), on = (
|
|
73
|
-
const { t
|
|
72
|
+
}), on = (e) => {
|
|
73
|
+
const { t } = R(), {
|
|
74
74
|
children: s,
|
|
75
75
|
handleSubmit: r,
|
|
76
76
|
onSubmit: i,
|
|
77
77
|
isLoading: n = !1,
|
|
78
78
|
buttonEnd: a = !0,
|
|
79
79
|
reset: o
|
|
80
|
-
} =
|
|
81
|
-
return /* @__PURE__ */
|
|
80
|
+
} = e;
|
|
81
|
+
return /* @__PURE__ */ $("form", { className: "form-container", onSubmit: r(i), children: [
|
|
82
82
|
s,
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ $("div", { className: `form-actions ${a ? "end" : ""}`, children: [
|
|
84
|
+
/* @__PURE__ */ $(
|
|
85
85
|
ge,
|
|
86
86
|
{
|
|
87
87
|
type: "submit",
|
|
88
88
|
color: "primary",
|
|
89
89
|
variant: "submit",
|
|
90
90
|
disabled: n,
|
|
91
|
-
name:
|
|
92
|
-
"aria-label":
|
|
91
|
+
name: t("_accessibility:buttons.submit"),
|
|
92
|
+
"aria-label": t("_accessibility:ariaLabels.submit"),
|
|
93
93
|
children: [
|
|
94
94
|
n ? /* @__PURE__ */ g(Le, { color: "stroke-base", loaderClass: "!w-6 mt-1", strokeWidth: "6" }) : null,
|
|
95
|
-
|
|
95
|
+
t("_accessibility:buttons.submit")
|
|
96
96
|
]
|
|
97
97
|
}
|
|
98
98
|
),
|
|
@@ -102,17 +102,17 @@ const At = (t) => t == null ? !1 : `${t}`.length > 0, an = Bt(function(t, e) {
|
|
|
102
102
|
type: "button",
|
|
103
103
|
variant: "outlined",
|
|
104
104
|
onClick: () => o == null ? void 0 : o(),
|
|
105
|
-
name:
|
|
106
|
-
"aria-label":
|
|
107
|
-
children:
|
|
105
|
+
name: t("_accessibility:buttons.cancel"),
|
|
106
|
+
"aria-label": t("_accessibility:ariaLabels.cancel"),
|
|
107
|
+
children: t("_accessibility:buttons.cancel")
|
|
108
108
|
}
|
|
109
109
|
)
|
|
110
110
|
] })
|
|
111
111
|
] });
|
|
112
|
-
}, cn = Bt(function(
|
|
112
|
+
}, cn = Bt(function(e, t) {
|
|
113
113
|
const { t: s } = R(), [r, i] = X(!1);
|
|
114
|
-
return /* @__PURE__ */ g(
|
|
115
|
-
|
|
114
|
+
return /* @__PURE__ */ g(xs, { ...e, type: r ? "text" : "password", ref: t, children: /* @__PURE__ */ g(
|
|
115
|
+
Te,
|
|
116
116
|
{
|
|
117
117
|
type: "button",
|
|
118
118
|
tabIndex: -1,
|
|
@@ -124,8 +124,8 @@ const At = (t) => t == null ? !1 : `${t}`.length > 0, an = Bt(function(t, e) {
|
|
|
124
124
|
icon: r ? Ps : Ms
|
|
125
125
|
}
|
|
126
126
|
) });
|
|
127
|
-
}), dt = (
|
|
128
|
-
const { t
|
|
127
|
+
}), dt = (e) => {
|
|
128
|
+
const { t } = R(), {
|
|
129
129
|
title: s,
|
|
130
130
|
children: r,
|
|
131
131
|
handleClose: i,
|
|
@@ -133,53 +133,53 @@ const At = (t) => t == null ? !1 : `${t}`.length > 0, an = Bt(function(t, e) {
|
|
|
133
133
|
containerClassName: a = "",
|
|
134
134
|
className: o = "",
|
|
135
135
|
animationClass: l = "appear"
|
|
136
|
-
} =
|
|
137
|
-
(
|
|
138
|
-
|
|
136
|
+
} = e, m = D(
|
|
137
|
+
(h) => {
|
|
138
|
+
h.key === "Escape" && n && i();
|
|
139
139
|
},
|
|
140
140
|
[n, i]
|
|
141
141
|
);
|
|
142
|
-
me(() => (window.addEventListener("keydown",
|
|
143
|
-
window.removeEventListener("keydown",
|
|
144
|
-
}), [
|
|
145
|
-
const
|
|
146
|
-
(
|
|
147
|
-
|
|
142
|
+
me(() => (window.addEventListener("keydown", m), () => {
|
|
143
|
+
window.removeEventListener("keydown", m);
|
|
144
|
+
}), [m]);
|
|
145
|
+
const f = D(
|
|
146
|
+
(h) => {
|
|
147
|
+
h.target === h.currentTarget && i();
|
|
148
148
|
},
|
|
149
149
|
[i]
|
|
150
150
|
);
|
|
151
151
|
return me(() => {
|
|
152
|
-
const
|
|
152
|
+
const h = (d) => {
|
|
153
153
|
d ? document.body.style.overflow = "hidden" : document.body.style.overflow = "auto";
|
|
154
154
|
};
|
|
155
|
-
return
|
|
156
|
-
|
|
155
|
+
return h(n), () => {
|
|
156
|
+
h(!1);
|
|
157
157
|
};
|
|
158
158
|
}, [n]), Qt(
|
|
159
159
|
/* @__PURE__ */ g(
|
|
160
160
|
"div",
|
|
161
161
|
{
|
|
162
|
-
"aria-label":
|
|
162
|
+
"aria-label": t("_accessibility:ariaLabels.closeDialog"),
|
|
163
163
|
"aria-hidden": !n,
|
|
164
|
-
onClick:
|
|
164
|
+
onClick: f,
|
|
165
165
|
className: `dialog-backdrop animated ${n ? `opened ${l}` : "closed"} ${a}`,
|
|
166
|
-
children: /* @__PURE__ */
|
|
166
|
+
children: /* @__PURE__ */ $(
|
|
167
167
|
"div",
|
|
168
168
|
{
|
|
169
169
|
className: `dialog elevated animated ${n ? `opened ${l}` : "closed"} ${o}`,
|
|
170
170
|
children: [
|
|
171
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ $("div", { className: "dialog-header", children: [
|
|
172
172
|
/* @__PURE__ */ g("h3", { className: "dialog-title", children: s }),
|
|
173
173
|
/* @__PURE__ */ g(
|
|
174
|
-
|
|
174
|
+
Te,
|
|
175
175
|
{
|
|
176
176
|
icon: Ht,
|
|
177
177
|
disabled: !n,
|
|
178
178
|
"aria-disabled": !n,
|
|
179
179
|
onClick: i,
|
|
180
180
|
className: "icon-button dialog-close-btn",
|
|
181
|
-
name:
|
|
182
|
-
"aria-label":
|
|
181
|
+
name: t("_accessibility:buttons.closeDialog"),
|
|
182
|
+
"aria-label": t("_accessibility:ariaLabels.closeDialog")
|
|
183
183
|
}
|
|
184
184
|
)
|
|
185
185
|
] }),
|
|
@@ -191,9 +191,9 @@ const At = (t) => t == null ? !1 : `${t}`.length > 0, an = Bt(function(t, e) {
|
|
|
191
191
|
),
|
|
192
192
|
document.body
|
|
193
193
|
);
|
|
194
|
-
}, ft = (
|
|
194
|
+
}, ft = (e) => {
|
|
195
195
|
const {
|
|
196
|
-
primaryText:
|
|
196
|
+
primaryText: t,
|
|
197
197
|
cancelText: s,
|
|
198
198
|
onPrimaryClick: r,
|
|
199
199
|
onCancel: i,
|
|
@@ -201,32 +201,32 @@ const At = (t) => t == null ? !1 : `${t}`.length > 0, an = Bt(function(t, e) {
|
|
|
201
201
|
disabled: a = !1,
|
|
202
202
|
primaryType: o = "submit",
|
|
203
203
|
containerClassName: l = "",
|
|
204
|
-
primaryClassName:
|
|
205
|
-
alignEnd:
|
|
206
|
-
primaryName:
|
|
204
|
+
primaryClassName: m = "",
|
|
205
|
+
alignEnd: f = !1,
|
|
206
|
+
primaryName: h,
|
|
207
207
|
primaryAriaLabel: d,
|
|
208
208
|
cancelName: p,
|
|
209
|
-
cancelAriaLabel:
|
|
210
|
-
} =
|
|
211
|
-
return /* @__PURE__ */
|
|
209
|
+
cancelAriaLabel: b
|
|
210
|
+
} = e;
|
|
211
|
+
return /* @__PURE__ */ $(
|
|
212
212
|
"div",
|
|
213
213
|
{
|
|
214
|
-
className: `dialog-actions ${
|
|
214
|
+
className: `dialog-actions ${f ? "end" : ""} ${l}`,
|
|
215
215
|
children: [
|
|
216
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ $(
|
|
217
217
|
ge,
|
|
218
218
|
{
|
|
219
219
|
type: o,
|
|
220
220
|
color: "primary",
|
|
221
221
|
variant: "submit",
|
|
222
|
-
className:
|
|
222
|
+
className: m,
|
|
223
223
|
disabled: a,
|
|
224
224
|
onClick: r,
|
|
225
|
-
name:
|
|
225
|
+
name: h,
|
|
226
226
|
"aria-label": d,
|
|
227
227
|
children: [
|
|
228
228
|
n ? /* @__PURE__ */ g(Le, { color: "stroke-base", loaderClass: "!w-6 mt-1", strokeWidth: "6" }) : null,
|
|
229
|
-
|
|
229
|
+
t
|
|
230
230
|
]
|
|
231
231
|
}
|
|
232
232
|
),
|
|
@@ -238,15 +238,15 @@ const At = (t) => t == null ? !1 : `${t}`.length > 0, an = Bt(function(t, e) {
|
|
|
238
238
|
disabled: a,
|
|
239
239
|
onClick: i,
|
|
240
240
|
name: p,
|
|
241
|
-
"aria-label":
|
|
241
|
+
"aria-label": b,
|
|
242
242
|
children: s
|
|
243
243
|
}
|
|
244
244
|
)
|
|
245
245
|
]
|
|
246
246
|
}
|
|
247
247
|
);
|
|
248
|
-
}, ln = (
|
|
249
|
-
const { t
|
|
248
|
+
}, ln = (e) => {
|
|
249
|
+
const { t } = R(), {
|
|
250
250
|
children: s,
|
|
251
251
|
handleSubmit: r,
|
|
252
252
|
onSubmit: i,
|
|
@@ -254,79 +254,79 @@ const At = (t) => t == null ? !1 : `${t}`.length > 0, an = Bt(function(t, e) {
|
|
|
254
254
|
isLoading: a = !1,
|
|
255
255
|
buttonEnd: o = !0,
|
|
256
256
|
...l
|
|
257
|
-
} =
|
|
258
|
-
return /* @__PURE__ */ g(dt, { ...l, handleClose: n, children: /* @__PURE__ */
|
|
257
|
+
} = e;
|
|
258
|
+
return /* @__PURE__ */ g(dt, { ...l, handleClose: n, children: /* @__PURE__ */ $("form", { onSubmit: r(i), children: [
|
|
259
259
|
/* @__PURE__ */ g("div", { className: "form-container", children: s }),
|
|
260
260
|
/* @__PURE__ */ g(
|
|
261
261
|
ft,
|
|
262
262
|
{
|
|
263
263
|
primaryType: "submit",
|
|
264
|
-
primaryText:
|
|
265
|
-
cancelText:
|
|
264
|
+
primaryText: t("_accessibility:buttons.submit"),
|
|
265
|
+
cancelText: t("_accessibility:buttons.cancel"),
|
|
266
266
|
onCancel: n,
|
|
267
267
|
isLoading: a,
|
|
268
268
|
disabled: a,
|
|
269
269
|
primaryClassName: "dialog-form-primary",
|
|
270
270
|
alignEnd: o,
|
|
271
|
-
primaryName:
|
|
272
|
-
primaryAriaLabel:
|
|
273
|
-
cancelName:
|
|
274
|
-
cancelAriaLabel:
|
|
271
|
+
primaryName: t("_accessibility:buttons.submit"),
|
|
272
|
+
primaryAriaLabel: t("_accessibility:ariaLabels.submit"),
|
|
273
|
+
cancelName: t("_accessibility:buttons.cancel"),
|
|
274
|
+
cancelAriaLabel: t("_accessibility:ariaLabels.cancel")
|
|
275
275
|
}
|
|
276
276
|
)
|
|
277
277
|
] }) });
|
|
278
|
-
}, un = (
|
|
279
|
-
const { t
|
|
278
|
+
}, un = (e) => {
|
|
279
|
+
const { t } = R(), {
|
|
280
280
|
children: s,
|
|
281
281
|
handleSubmit: r,
|
|
282
282
|
handleClose: i,
|
|
283
283
|
isLoading: n = !1,
|
|
284
284
|
...a
|
|
285
|
-
} =
|
|
286
|
-
return /* @__PURE__ */
|
|
285
|
+
} = e;
|
|
286
|
+
return /* @__PURE__ */ $(dt, { ...a, handleClose: i, children: [
|
|
287
287
|
s,
|
|
288
288
|
/* @__PURE__ */ g(
|
|
289
289
|
ft,
|
|
290
290
|
{
|
|
291
|
-
primaryText:
|
|
292
|
-
cancelText:
|
|
291
|
+
primaryText: t("_accessibility:buttons.ok"),
|
|
292
|
+
cancelText: t("_accessibility:buttons.cancel"),
|
|
293
293
|
onPrimaryClick: r,
|
|
294
294
|
onCancel: i,
|
|
295
295
|
isLoading: n,
|
|
296
296
|
disabled: n,
|
|
297
297
|
primaryType: "button",
|
|
298
298
|
containerClassName: "mt-5",
|
|
299
|
-
primaryName:
|
|
300
|
-
primaryAriaLabel:
|
|
301
|
-
cancelName:
|
|
302
|
-
cancelAriaLabel:
|
|
299
|
+
primaryName: t("_accessibility:buttons.ok"),
|
|
300
|
+
primaryAriaLabel: t("_accessibility:ariaLabels.ok"),
|
|
301
|
+
cancelName: t("_accessibility:buttons.cancel"),
|
|
302
|
+
cancelAriaLabel: t("_accessibility:ariaLabels.cancel")
|
|
303
303
|
}
|
|
304
304
|
)
|
|
305
305
|
] });
|
|
306
306
|
};
|
|
307
|
-
function er(
|
|
308
|
-
const { message:
|
|
309
|
-
return /* @__PURE__ */ g("p", { className: `import-error-message ${s}`, children:
|
|
307
|
+
function er(e) {
|
|
308
|
+
const { message: t, className: s = "" } = e, { t: r } = R();
|
|
309
|
+
return /* @__PURE__ */ g("p", { className: `import-error-message ${s}`, children: t ?? r("_messages:errors.parseFile", {
|
|
310
310
|
defaultValue: "Failed to process file"
|
|
311
311
|
}) });
|
|
312
312
|
}
|
|
313
|
-
function tr(
|
|
314
|
-
const { message:
|
|
315
|
-
return /* @__PURE__ */
|
|
313
|
+
function tr(e) {
|
|
314
|
+
const { message: t, className: s = "" } = e, { t: r } = R();
|
|
315
|
+
return /* @__PURE__ */ $("div", { className: `import-loading ${s}`, children: [
|
|
316
316
|
/* @__PURE__ */ g(Le, { loaderClass: "w-5 h-5", className: "!w-auto" }),
|
|
317
|
-
/* @__PURE__ */ g("span", { children:
|
|
317
|
+
/* @__PURE__ */ g("span", { children: t ?? r("_messages:loading.processingFile", {
|
|
318
318
|
defaultValue: "Processing file..."
|
|
319
319
|
}) })
|
|
320
320
|
] });
|
|
321
321
|
}
|
|
322
|
-
function sr(
|
|
323
|
-
const { items:
|
|
324
|
-
if (!
|
|
325
|
-
const n =
|
|
326
|
-
return /* @__PURE__ */
|
|
322
|
+
function sr(e) {
|
|
323
|
+
const { items: t, max: s = 5, className: r = "" } = e, { t: i } = R();
|
|
324
|
+
if (!t || t.length === 0) return null;
|
|
325
|
+
const n = t.slice(0, s);
|
|
326
|
+
return /* @__PURE__ */ $("div", { className: `import-preview ${r}`, children: [
|
|
327
327
|
/* @__PURE__ */ g("p", { className: "import-preview-count", children: i("_pages:common.actions.import.previewCount", {
|
|
328
|
-
count:
|
|
329
|
-
defaultValue: `Preview: ${
|
|
328
|
+
count: t.length,
|
|
329
|
+
defaultValue: `Preview: ${t.length} items`
|
|
330
330
|
}) }),
|
|
331
331
|
/* @__PURE__ */ g("pre", { className: "import-preview-content", children: JSON.stringify(n, null, 2) })
|
|
332
332
|
] });
|
|
@@ -339,24 +339,24 @@ const Gt = () => ({
|
|
|
339
339
|
overrideExisting: !1,
|
|
340
340
|
inputKey: 0
|
|
341
341
|
});
|
|
342
|
-
function rr(
|
|
343
|
-
switch (
|
|
342
|
+
function rr(e, t) {
|
|
343
|
+
switch (t.type) {
|
|
344
344
|
case "SET_FILE":
|
|
345
|
-
return { ...
|
|
345
|
+
return { ...e, file: t.file, previewItems: null, parseError: null, processing: !1 };
|
|
346
346
|
case "START_PROCESSING":
|
|
347
|
-
return { ...
|
|
347
|
+
return { ...e, processing: !0 };
|
|
348
348
|
case "SET_PREVIEW":
|
|
349
|
-
return { ...
|
|
349
|
+
return { ...e, previewItems: t.items, parseError: null, processing: !1 };
|
|
350
350
|
case "SET_ERROR":
|
|
351
|
-
return { ...
|
|
351
|
+
return { ...e, previewItems: null, parseError: t.message, processing: !1 };
|
|
352
352
|
case "SET_OVERRIDE":
|
|
353
|
-
return { ...
|
|
353
|
+
return { ...e, overrideExisting: t.value };
|
|
354
354
|
case "RESET":
|
|
355
|
-
return { ...Gt(), inputKey:
|
|
355
|
+
return { ...Gt(), inputKey: e.inputKey + 1 };
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
const dn = (
|
|
359
|
-
const { t
|
|
358
|
+
const dn = (e) => {
|
|
359
|
+
const { t } = R(), {
|
|
360
360
|
children: s,
|
|
361
361
|
handleSubmit: r,
|
|
362
362
|
handleClose: i,
|
|
@@ -364,23 +364,23 @@ const dn = (t) => {
|
|
|
364
364
|
fileProcessor: a,
|
|
365
365
|
onFileProcessed: o,
|
|
366
366
|
onOverrideChange: l,
|
|
367
|
-
open:
|
|
368
|
-
...
|
|
369
|
-
} =
|
|
367
|
+
open: m,
|
|
368
|
+
...f
|
|
369
|
+
} = e, [h, d] = qt(rr, Gt()), { file: p, previewItems: b, parseError: S, processing: E, overrideExisting: N, inputKey: C } = h, F = Ue(o), x = Ue(a);
|
|
370
370
|
me(() => {
|
|
371
|
-
|
|
371
|
+
F.current = o;
|
|
372
372
|
}, [o]), me(() => {
|
|
373
|
-
|
|
373
|
+
x.current = a;
|
|
374
374
|
}, [a]), me(() => {
|
|
375
|
-
|
|
376
|
-
}, [
|
|
377
|
-
const
|
|
375
|
+
m || d({ type: "RESET" });
|
|
376
|
+
}, [m]);
|
|
377
|
+
const A = D(async (I, O) => {
|
|
378
378
|
var re;
|
|
379
|
-
if (
|
|
379
|
+
if (x.current) {
|
|
380
380
|
d({ type: "START_PROCESSING" });
|
|
381
381
|
try {
|
|
382
|
-
const P = await
|
|
383
|
-
d({ type: "SET_PREVIEW", items: P ?? [] }), (re =
|
|
382
|
+
const P = await x.current(I, { override: O });
|
|
383
|
+
d({ type: "SET_PREVIEW", items: P ?? [] }), (re = F.current) == null || re.call(F, P ?? []);
|
|
384
384
|
} catch (P) {
|
|
385
385
|
console.error(P);
|
|
386
386
|
const ne = P instanceof Error ? P.message : "Failed to parse file";
|
|
@@ -388,76 +388,76 @@ const dn = (t) => {
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
}, []);
|
|
391
|
-
return /* @__PURE__ */
|
|
391
|
+
return /* @__PURE__ */ $(dt, { ...f, open: m, handleClose: i, children: [
|
|
392
392
|
/* @__PURE__ */ g(
|
|
393
|
-
|
|
393
|
+
As,
|
|
394
394
|
{
|
|
395
395
|
onClear: () => {
|
|
396
396
|
var I;
|
|
397
|
-
d({ type: "SET_FILE", file: null }), (I =
|
|
397
|
+
d({ type: "SET_FILE", file: null }), (I = F.current) == null || I.call(F, []);
|
|
398
398
|
},
|
|
399
399
|
onChange: (I) => {
|
|
400
400
|
var re, P;
|
|
401
401
|
const O = (re = I.target.files) == null ? void 0 : re[0];
|
|
402
402
|
if (!O) {
|
|
403
|
-
d({ type: "SET_FILE", file: null }), (P =
|
|
403
|
+
d({ type: "SET_FILE", file: null }), (P = F.current) == null || P.call(F, []);
|
|
404
404
|
return;
|
|
405
405
|
}
|
|
406
|
-
d({ type: "SET_FILE", file: O }),
|
|
406
|
+
d({ type: "SET_FILE", file: O }), A(O, N);
|
|
407
407
|
},
|
|
408
|
-
label:
|
|
408
|
+
label: t("_accessibility:labels.file")
|
|
409
409
|
},
|
|
410
410
|
C
|
|
411
411
|
),
|
|
412
|
-
/* @__PURE__ */
|
|
412
|
+
/* @__PURE__ */ $("label", { className: "import-override-label", children: [
|
|
413
413
|
/* @__PURE__ */ g(
|
|
414
414
|
"input",
|
|
415
415
|
{
|
|
416
416
|
type: "checkbox",
|
|
417
|
-
checked:
|
|
417
|
+
checked: N,
|
|
418
418
|
onChange: (I) => {
|
|
419
419
|
const O = I.target.checked;
|
|
420
|
-
d({ type: "SET_OVERRIDE", value: O }), l == null || l(O), p &&
|
|
420
|
+
d({ type: "SET_OVERRIDE", value: O }), l == null || l(O), p && A(p, O);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
),
|
|
424
|
-
/* @__PURE__ */ g("span", { children:
|
|
424
|
+
/* @__PURE__ */ g("span", { children: t("_pages:common.actions.import.override", {
|
|
425
425
|
defaultValue: "Override existing items"
|
|
426
426
|
}) })
|
|
427
427
|
] }),
|
|
428
428
|
/* @__PURE__ */ g(er, { message: S }),
|
|
429
|
-
|
|
430
|
-
!!
|
|
429
|
+
E && /* @__PURE__ */ g(tr, {}),
|
|
430
|
+
!!b && b.length > 0 && /* @__PURE__ */ g(sr, { items: b }),
|
|
431
431
|
s,
|
|
432
432
|
/* @__PURE__ */ g(
|
|
433
433
|
ft,
|
|
434
434
|
{
|
|
435
|
-
primaryText:
|
|
436
|
-
cancelText:
|
|
435
|
+
primaryText: t("_accessibility:buttons.ok"),
|
|
436
|
+
cancelText: t("_accessibility:buttons.cancel"),
|
|
437
437
|
onPrimaryClick: () => {
|
|
438
|
-
(!a || !!
|
|
438
|
+
(!a || !!b && b.length > 0) && r();
|
|
439
439
|
},
|
|
440
440
|
onCancel: i,
|
|
441
441
|
isLoading: n,
|
|
442
442
|
primaryType: "button",
|
|
443
443
|
containerClassName: "import-dialog-actions",
|
|
444
|
-
primaryName:
|
|
445
|
-
primaryAriaLabel:
|
|
446
|
-
cancelName:
|
|
447
|
-
cancelAriaLabel:
|
|
444
|
+
primaryName: t("_accessibility:buttons.ok"),
|
|
445
|
+
primaryAriaLabel: t("_accessibility:ariaLabels.ok"),
|
|
446
|
+
cancelName: t("_accessibility:buttons.cancel"),
|
|
447
|
+
cancelAriaLabel: t("_accessibility:ariaLabels.cancel")
|
|
448
448
|
}
|
|
449
449
|
)
|
|
450
450
|
] });
|
|
451
451
|
};
|
|
452
|
-
var J = /* @__PURE__ */ ((
|
|
453
|
-
async function at(
|
|
452
|
+
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 || {}), ee = /* @__PURE__ */ ((e) => (e.GET = "GET", e.POST = "POST", e.PUT = "PUT", e.PATCH = "PATCH", e.DELETE = "DELETE", e))(ee || {});
|
|
453
|
+
async function at(e, t = "GET", s, r) {
|
|
454
454
|
const i = {
|
|
455
455
|
...s ? { "Content-Type": "application/json" } : {},
|
|
456
456
|
...r
|
|
457
457
|
};
|
|
458
458
|
try {
|
|
459
|
-
const n = await fetch(
|
|
460
|
-
method:
|
|
459
|
+
const n = await fetch(e, {
|
|
460
|
+
method: t,
|
|
461
461
|
headers: i,
|
|
462
462
|
...s ? { body: JSON.stringify(s) } : {}
|
|
463
463
|
}), a = await n.text();
|
|
@@ -494,19 +494,19 @@ async function at(t, e = "GET", s, r) {
|
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
function nr(
|
|
498
|
-
if (
|
|
499
|
-
const s = Object.entries(
|
|
497
|
+
function nr(e, t) {
|
|
498
|
+
if (t) {
|
|
499
|
+
const s = Object.entries(t).filter(([, r]) => r != null).map(
|
|
500
500
|
([r, i]) => `${encodeURIComponent(r)}=${encodeURIComponent(String(i))}`
|
|
501
501
|
).join("&");
|
|
502
|
-
return s ? `${
|
|
502
|
+
return s ? `${e}?${s}` : e;
|
|
503
503
|
}
|
|
504
|
-
return
|
|
504
|
+
return e;
|
|
505
505
|
}
|
|
506
|
-
const zt = (
|
|
506
|
+
const zt = (e, t, s) => {
|
|
507
507
|
const r = [];
|
|
508
|
-
if (
|
|
509
|
-
const { sortingBy: i, sortingOrder: n, currentPage: a, pageSize: o } =
|
|
508
|
+
if (t) {
|
|
509
|
+
const { sortingBy: i, sortingOrder: n, currentPage: a, pageSize: o } = t;
|
|
510
510
|
i !== void 0 && r.push(`sort=${String(i)}`), n !== void 0 && r.push(`order=${n}`), a !== void 0 && r.push(`page=${a}`), o !== void 0 && r.push(`pageSize=${o}`);
|
|
511
511
|
}
|
|
512
512
|
if (s) {
|
|
@@ -523,15 +523,15 @@ const zt = (t, e, s) => {
|
|
|
523
523
|
});
|
|
524
524
|
i.length > 0 && r.push(`filters=${i.join(",")}`);
|
|
525
525
|
}
|
|
526
|
-
return r.length ? `${
|
|
527
|
-
},
|
|
526
|
+
return r.length ? `${e}?${r.join("&")}` : e;
|
|
527
|
+
}, $e = class $e {
|
|
528
528
|
/**
|
|
529
529
|
* @param baseUrl the base url of the server
|
|
530
530
|
* @param userKey the local storage user key
|
|
531
531
|
* @param secured if the api client requires token
|
|
532
532
|
* @param tokenAcquirer custom token acquirer
|
|
533
533
|
*/
|
|
534
|
-
constructor(
|
|
534
|
+
constructor(t, s = "user", r = !0, i, n = {}) {
|
|
535
535
|
W(this, "baseUrl");
|
|
536
536
|
W(this, "userKey");
|
|
537
537
|
W(this, "rememberKey");
|
|
@@ -541,10 +541,10 @@ const zt = (t, e, s) => {
|
|
|
541
541
|
W(this, "refreshExpirySkewMs");
|
|
542
542
|
W(this, "secured");
|
|
543
543
|
W(this, "tokenAcquirer");
|
|
544
|
-
this.baseUrl =
|
|
544
|
+
this.baseUrl = t, this.secured = r, this.userKey = s, this.rememberKey = n.rememberKey ?? "remember", this.refreshTokenKey = n.refreshTokenKey ?? "refreshToken", this.accessTokenExpiresAtKey = n.accessTokenExpiresAtKey ?? "accessTokenExpiresAt", this.refreshEndpoint = n.refreshEndpoint ?? "auth/refresh", this.refreshExpirySkewMs = n.refreshExpirySkewMs ?? 5e3, this.tokenAcquirer = i ?? this.defaultTokenAcquirer;
|
|
545
545
|
}
|
|
546
|
-
defaultTokenAcquirer(
|
|
547
|
-
if (
|
|
546
|
+
defaultTokenAcquirer(t) {
|
|
547
|
+
if (t) return { credentials: "include" };
|
|
548
548
|
const s = Ce(this.userKey);
|
|
549
549
|
if (s && s.length)
|
|
550
550
|
return { Authorization: `Bearer ${s}` };
|
|
@@ -552,43 +552,43 @@ const zt = (t, e, s) => {
|
|
|
552
552
|
getRefreshLockKey() {
|
|
553
553
|
return `${this.baseUrl}|${this.userKey}|${this.refreshTokenKey}|${this.accessTokenExpiresAtKey}`;
|
|
554
554
|
}
|
|
555
|
-
buildUrl(
|
|
556
|
-
const s = this.baseUrl.endsWith("/") ? this.baseUrl.slice(0, -1) : this.baseUrl, r =
|
|
555
|
+
buildUrl(t) {
|
|
556
|
+
const s = this.baseUrl.endsWith("/") ? this.baseUrl.slice(0, -1) : this.baseUrl, r = t.startsWith("/") ? t : `/${t}`;
|
|
557
557
|
return `${s}${r}`;
|
|
558
558
|
}
|
|
559
559
|
getRefreshToken() {
|
|
560
|
-
const
|
|
561
|
-
if (typeof
|
|
562
|
-
return
|
|
560
|
+
const t = Ce(this.refreshTokenKey);
|
|
561
|
+
if (typeof t == "string" && t.length)
|
|
562
|
+
return t;
|
|
563
563
|
}
|
|
564
564
|
getAccessTokenExpiresAt() {
|
|
565
|
-
const
|
|
566
|
-
if (typeof
|
|
567
|
-
return
|
|
565
|
+
const t = Ce(this.accessTokenExpiresAtKey);
|
|
566
|
+
if (typeof t == "string" && t.length)
|
|
567
|
+
return t;
|
|
568
568
|
}
|
|
569
569
|
canRefresh() {
|
|
570
570
|
return !!this.getRefreshToken();
|
|
571
571
|
}
|
|
572
572
|
shouldRefreshBeforeRequest() {
|
|
573
|
-
const
|
|
574
|
-
if (!
|
|
573
|
+
const t = this.getRefreshToken(), s = this.getAccessTokenExpiresAt();
|
|
574
|
+
if (!t || !s) return !1;
|
|
575
575
|
const r = Date.parse(s);
|
|
576
576
|
return Number.isNaN(r) ? !1 : Date.now() >= r - this.refreshExpirySkewMs;
|
|
577
577
|
}
|
|
578
578
|
clearStoredSession() {
|
|
579
579
|
oe(this.userKey), oe(this.rememberKey), oe(this.refreshTokenKey), oe(this.accessTokenExpiresAtKey);
|
|
580
580
|
}
|
|
581
|
-
storeSession(
|
|
582
|
-
ke(this.userKey,
|
|
581
|
+
storeSession(t) {
|
|
582
|
+
ke(this.userKey, t.token), typeof t.refreshToken == "string" && t.refreshToken.length ? ke(this.refreshTokenKey, t.refreshToken) : oe(this.refreshTokenKey), typeof t.accessTokenExpiresAt == "string" && t.accessTokenExpiresAt.length ? ke(this.accessTokenExpiresAtKey, t.accessTokenExpiresAt) : oe(this.accessTokenExpiresAtKey);
|
|
583
583
|
}
|
|
584
584
|
async refreshAccessTokenWithMutex() {
|
|
585
|
-
const
|
|
586
|
-
if (!
|
|
585
|
+
const t = this.getRefreshToken();
|
|
586
|
+
if (!t)
|
|
587
587
|
throw {
|
|
588
588
|
status: 401,
|
|
589
589
|
message: "Missing refresh token"
|
|
590
590
|
};
|
|
591
|
-
const s = this.getRefreshLockKey(), r =
|
|
591
|
+
const s = this.getRefreshLockKey(), r = $e.refreshInFlight.get(s);
|
|
592
592
|
if (r) {
|
|
593
593
|
await r;
|
|
594
594
|
return;
|
|
@@ -597,7 +597,7 @@ const zt = (t, e, s) => {
|
|
|
597
597
|
const { data: n, status: a, error: o } = await at(
|
|
598
598
|
this.buildUrl(this.refreshEndpoint),
|
|
599
599
|
ee.POST,
|
|
600
|
-
{ refreshToken:
|
|
600
|
+
{ refreshToken: t }
|
|
601
601
|
);
|
|
602
602
|
if (o || !(n != null && n.token) || typeof n.refreshToken != "string" || !n.refreshToken.length)
|
|
603
603
|
throw this.clearStoredSession(), o ?? {
|
|
@@ -606,37 +606,37 @@ const zt = (t, e, s) => {
|
|
|
606
606
|
};
|
|
607
607
|
this.storeSession(n);
|
|
608
608
|
})();
|
|
609
|
-
|
|
609
|
+
$e.refreshInFlight.set(s, i);
|
|
610
610
|
try {
|
|
611
611
|
await i;
|
|
612
612
|
} finally {
|
|
613
|
-
|
|
613
|
+
$e.refreshInFlight.delete(s);
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
mergeHeaders(
|
|
616
|
+
mergeHeaders(t) {
|
|
617
617
|
return {
|
|
618
618
|
...(this.secured ? this.tokenAcquirer() : {}) ?? {},
|
|
619
|
-
...
|
|
619
|
+
...t ?? {}
|
|
620
620
|
};
|
|
621
621
|
}
|
|
622
|
-
async makeRequestWithRefresh(
|
|
622
|
+
async makeRequestWithRefresh(t, s, r, i) {
|
|
623
623
|
this.secured && this.shouldRefreshBeforeRequest() && await this.refreshAccessTokenWithMutex();
|
|
624
624
|
let n = await at(
|
|
625
|
-
this.buildUrl(
|
|
625
|
+
this.buildUrl(t),
|
|
626
626
|
s,
|
|
627
627
|
r,
|
|
628
628
|
this.mergeHeaders(i)
|
|
629
629
|
);
|
|
630
630
|
return this.secured && n.status === 401 && this.canRefresh() && (await this.refreshAccessTokenWithMutex(), n = await at(
|
|
631
|
-
this.buildUrl(
|
|
631
|
+
this.buildUrl(t),
|
|
632
632
|
s,
|
|
633
633
|
r,
|
|
634
634
|
this.mergeHeaders(i)
|
|
635
635
|
)), n;
|
|
636
636
|
}
|
|
637
|
-
async doQuery(
|
|
637
|
+
async doQuery(t, s = ee.GET, r, i) {
|
|
638
638
|
const { data: n, status: a, error: o } = await this.makeRequestWithRefresh(
|
|
639
|
-
|
|
639
|
+
t,
|
|
640
640
|
s,
|
|
641
641
|
r,
|
|
642
642
|
i
|
|
@@ -654,8 +654,8 @@ const zt = (t, e, s) => {
|
|
|
654
654
|
* @param query - query parameters
|
|
655
655
|
* @returns Result list
|
|
656
656
|
*/
|
|
657
|
-
async get(
|
|
658
|
-
const i = zt(
|
|
657
|
+
async get(t, s, r) {
|
|
658
|
+
const i = zt(t, s, r), { data: n, error: a } = await this.makeRequestWithRefresh(
|
|
659
659
|
i,
|
|
660
660
|
ee.GET
|
|
661
661
|
);
|
|
@@ -668,9 +668,9 @@ const zt = (t, e, s) => {
|
|
|
668
668
|
* @param data - data to update
|
|
669
669
|
* @returns updated entity
|
|
670
670
|
*/
|
|
671
|
-
async patch(
|
|
671
|
+
async patch(t, s) {
|
|
672
672
|
const { error: r, data: i, status: n } = await this.makeRequestWithRefresh(
|
|
673
|
-
|
|
673
|
+
t,
|
|
674
674
|
ee.PATCH,
|
|
675
675
|
s
|
|
676
676
|
);
|
|
@@ -686,9 +686,9 @@ const zt = (t, e, s) => {
|
|
|
686
686
|
* @param data - value to insert
|
|
687
687
|
* @returns delete result
|
|
688
688
|
*/
|
|
689
|
-
async delete(
|
|
689
|
+
async delete(t, s) {
|
|
690
690
|
const { error: r, data: i, status: n } = await this.makeRequestWithRefresh(
|
|
691
|
-
|
|
691
|
+
t,
|
|
692
692
|
ee.DELETE,
|
|
693
693
|
s
|
|
694
694
|
);
|
|
@@ -705,9 +705,9 @@ const zt = (t, e, s) => {
|
|
|
705
705
|
* @param data - value to insert
|
|
706
706
|
* @returns inserted item
|
|
707
707
|
*/
|
|
708
|
-
async post(
|
|
708
|
+
async post(t, s) {
|
|
709
709
|
const { error: r, data: i, status: n } = await this.makeRequestWithRefresh(
|
|
710
|
-
|
|
710
|
+
t,
|
|
711
711
|
ee.POST,
|
|
712
712
|
s
|
|
713
713
|
);
|
|
@@ -719,32 +719,32 @@ const zt = (t, e, s) => {
|
|
|
719
719
|
return i;
|
|
720
720
|
}
|
|
721
721
|
};
|
|
722
|
-
W(
|
|
723
|
-
let Ge =
|
|
722
|
+
W($e, "refreshInFlight", /* @__PURE__ */ new Map());
|
|
723
|
+
let Ge = $e;
|
|
724
724
|
class ir {
|
|
725
|
-
constructor(
|
|
725
|
+
constructor(t, s = "user", r = {}) {
|
|
726
726
|
W(this, "api");
|
|
727
|
-
this.api = new Ge(
|
|
727
|
+
this.api = new Ge(t, s, !1, void 0, r);
|
|
728
728
|
}
|
|
729
|
-
async login(
|
|
730
|
-
const s = "auth/sign-in", r =
|
|
729
|
+
async login(t) {
|
|
730
|
+
const s = "auth/sign-in", r = t;
|
|
731
731
|
return await this.api.doQuery(
|
|
732
732
|
s,
|
|
733
733
|
ee.POST,
|
|
734
734
|
r
|
|
735
735
|
);
|
|
736
736
|
}
|
|
737
|
-
async refresh(
|
|
737
|
+
async refresh(t) {
|
|
738
738
|
return await this.api.doQuery(
|
|
739
739
|
"auth/refresh",
|
|
740
740
|
ee.POST,
|
|
741
|
-
|
|
741
|
+
t
|
|
742
742
|
);
|
|
743
743
|
}
|
|
744
|
-
async logout(
|
|
745
|
-
const s = "auth/sign-out", r =
|
|
746
|
-
Authorization: `Bearer ${
|
|
747
|
-
} : void 0, i =
|
|
744
|
+
async logout(t) {
|
|
745
|
+
const s = "auth/sign-out", r = t != null && t.accessToken ? {
|
|
746
|
+
Authorization: `Bearer ${t.accessToken}`
|
|
747
|
+
} : void 0, i = t != null && t.refreshToken ? { refreshToken: t.refreshToken } : void 0;
|
|
748
748
|
return await this.api.doQuery(
|
|
749
749
|
s,
|
|
750
750
|
ee.POST,
|
|
@@ -752,11 +752,11 @@ class ir {
|
|
|
752
752
|
r
|
|
753
753
|
);
|
|
754
754
|
}
|
|
755
|
-
async register(
|
|
755
|
+
async register(t) {
|
|
756
756
|
return await this.api.doQuery(
|
|
757
757
|
"auth/sign-up",
|
|
758
758
|
ee.POST,
|
|
759
|
-
|
|
759
|
+
t
|
|
760
760
|
);
|
|
761
761
|
}
|
|
762
762
|
async getSession() {
|
|
@@ -769,9 +769,9 @@ class ir {
|
|
|
769
769
|
}
|
|
770
770
|
}
|
|
771
771
|
class fn {
|
|
772
|
-
constructor(
|
|
772
|
+
constructor(t, s, r = {}) {
|
|
773
773
|
W(this, "auth");
|
|
774
|
-
this.auth = new ir(
|
|
774
|
+
this.auth = new ir(t, s, r);
|
|
775
775
|
}
|
|
776
776
|
/**
|
|
777
777
|
* @returns auth
|
|
@@ -786,30 +786,30 @@ class hn {
|
|
|
786
786
|
* @param table
|
|
787
787
|
* @param secured to see if the api client requires jwt protection
|
|
788
788
|
*/
|
|
789
|
-
constructor(
|
|
789
|
+
constructor(t, s, r = "user", i = !0, n = {}) {
|
|
790
790
|
W(this, "table");
|
|
791
791
|
W(this, "secured");
|
|
792
792
|
W(this, "api");
|
|
793
|
-
this.table =
|
|
793
|
+
this.table = t, this.secured = i, this.api = new Ge(s, r, i, void 0, n);
|
|
794
794
|
}
|
|
795
795
|
/**
|
|
796
796
|
*
|
|
797
797
|
* @param value
|
|
798
798
|
* @returns inserted item
|
|
799
799
|
*/
|
|
800
|
-
async insert(
|
|
801
|
-
return await this.api.post(`${this.table}`,
|
|
800
|
+
async insert(t) {
|
|
801
|
+
return await this.api.post(`${this.table}`, t);
|
|
802
802
|
}
|
|
803
803
|
/**
|
|
804
804
|
*
|
|
805
805
|
* @param data - values to insert
|
|
806
806
|
* @returns - Query result
|
|
807
807
|
*/
|
|
808
|
-
async insertMany(
|
|
808
|
+
async insertMany(t) {
|
|
809
809
|
return await this.api.doQuery(
|
|
810
810
|
`${this.table}/batch`,
|
|
811
811
|
ee.POST,
|
|
812
|
-
|
|
812
|
+
t
|
|
813
813
|
);
|
|
814
814
|
}
|
|
815
815
|
/**
|
|
@@ -817,10 +817,10 @@ class hn {
|
|
|
817
817
|
* @param value
|
|
818
818
|
* @returns updated item
|
|
819
819
|
*/
|
|
820
|
-
async update(
|
|
820
|
+
async update(t) {
|
|
821
821
|
return await this.api.patch(
|
|
822
|
-
`${this.table}/${
|
|
823
|
-
|
|
822
|
+
`${this.table}/${t.id}`,
|
|
823
|
+
t
|
|
824
824
|
);
|
|
825
825
|
}
|
|
826
826
|
/**
|
|
@@ -829,19 +829,19 @@ class hn {
|
|
|
829
829
|
* @param filters - Filters to apply
|
|
830
830
|
* @returns - Query result
|
|
831
831
|
*/
|
|
832
|
-
async get(
|
|
833
|
-
return await this.api.get(`${this.table}`,
|
|
832
|
+
async get(t, s) {
|
|
833
|
+
return await this.api.get(`${this.table}`, t, s);
|
|
834
834
|
}
|
|
835
835
|
/**
|
|
836
836
|
*
|
|
837
837
|
* @param filters - Filters to apply
|
|
838
838
|
* @returns - List of elements
|
|
839
839
|
*/
|
|
840
|
-
async export(
|
|
840
|
+
async export(t) {
|
|
841
841
|
const s = zt(
|
|
842
842
|
`${this.table}/export`,
|
|
843
843
|
void 0,
|
|
844
|
-
|
|
844
|
+
t
|
|
845
845
|
);
|
|
846
846
|
return await this.api.doQuery(s, ee.GET, void 0);
|
|
847
847
|
}
|
|
@@ -850,11 +850,11 @@ class hn {
|
|
|
850
850
|
* @param data - Import data
|
|
851
851
|
* @returns - List of elements
|
|
852
852
|
*/
|
|
853
|
-
async import(
|
|
853
|
+
async import(t) {
|
|
854
854
|
return await this.api.doQuery(
|
|
855
855
|
`${this.table}/import`,
|
|
856
856
|
ee.POST,
|
|
857
|
-
|
|
857
|
+
t
|
|
858
858
|
);
|
|
859
859
|
}
|
|
860
860
|
/**
|
|
@@ -862,9 +862,9 @@ class hn {
|
|
|
862
862
|
* @param query - Where conditions (key-value)
|
|
863
863
|
* @returns - Query result
|
|
864
864
|
*/
|
|
865
|
-
async commonGet(
|
|
865
|
+
async commonGet(t) {
|
|
866
866
|
return await this.api.doQuery(
|
|
867
|
-
nr(`${this.table}/common`,
|
|
867
|
+
nr(`${this.table}/common`, t),
|
|
868
868
|
ee.GET
|
|
869
869
|
);
|
|
870
870
|
}
|
|
@@ -873,26 +873,26 @@ class hn {
|
|
|
873
873
|
* @param id
|
|
874
874
|
* @returns - Query result
|
|
875
875
|
*/
|
|
876
|
-
async getById(
|
|
877
|
-
return await this.api.doQuery(`${this.table}/${
|
|
876
|
+
async getById(t) {
|
|
877
|
+
return await this.api.doQuery(`${this.table}/${t}`);
|
|
878
878
|
}
|
|
879
|
-
async softDelete(
|
|
880
|
-
return await this.api.delete(`${this.table}`,
|
|
879
|
+
async softDelete(t) {
|
|
880
|
+
return await this.api.delete(`${this.table}`, t);
|
|
881
881
|
}
|
|
882
|
-
async restore(
|
|
883
|
-
return await this.api.patch(`${this.table}/restore`,
|
|
882
|
+
async restore(t) {
|
|
883
|
+
return await this.api.patch(`${this.table}/restore`, t);
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
886
|
class mn {
|
|
887
|
-
constructor(
|
|
887
|
+
constructor(t, s, r = 1) {
|
|
888
888
|
W(this, "table");
|
|
889
889
|
W(this, "dbName");
|
|
890
890
|
W(this, "version");
|
|
891
891
|
W(this, "db", null);
|
|
892
|
-
this.table =
|
|
892
|
+
this.table = t, this.dbName = s, this.version = r;
|
|
893
893
|
}
|
|
894
894
|
open() {
|
|
895
|
-
return this.db ? Promise.resolve(this.db) : new Promise((
|
|
895
|
+
return this.db ? Promise.resolve(this.db) : new Promise((t, s) => {
|
|
896
896
|
const r = indexedDB.open(this.dbName, this.version);
|
|
897
897
|
r.onupgradeneeded = (i) => {
|
|
898
898
|
const n = i.target.result;
|
|
@@ -901,112 +901,112 @@ class mn {
|
|
|
901
901
|
autoIncrement: !0
|
|
902
902
|
});
|
|
903
903
|
}, r.onsuccess = (i) => {
|
|
904
|
-
this.db = i.target.result,
|
|
904
|
+
this.db = i.target.result, t(this.db);
|
|
905
905
|
}, r.onerror = (i) => {
|
|
906
906
|
s(i.target.error);
|
|
907
907
|
};
|
|
908
908
|
});
|
|
909
909
|
}
|
|
910
|
-
async transaction(
|
|
911
|
-
return (await this.open()).transaction(this.table,
|
|
910
|
+
async transaction(t) {
|
|
911
|
+
return (await this.open()).transaction(this.table, t).objectStore(this.table);
|
|
912
912
|
}
|
|
913
|
-
request(
|
|
913
|
+
request(t) {
|
|
914
914
|
return new Promise((s, r) => {
|
|
915
|
-
|
|
915
|
+
t.onsuccess = () => s(t.result), t.onerror = () => r(t.error);
|
|
916
916
|
});
|
|
917
917
|
}
|
|
918
|
-
async insert(
|
|
919
|
-
const s = await this.transaction("readwrite"), r = await this.request(s.add(
|
|
920
|
-
return { ...
|
|
918
|
+
async insert(t) {
|
|
919
|
+
const s = await this.transaction("readwrite"), r = await this.request(s.add(t));
|
|
920
|
+
return { ...t, id: r };
|
|
921
921
|
}
|
|
922
|
-
async insertMany(
|
|
922
|
+
async insertMany(t) {
|
|
923
923
|
const s = await this.transaction("readwrite");
|
|
924
924
|
let r = 0;
|
|
925
|
-
for (const i of
|
|
925
|
+
for (const i of t)
|
|
926
926
|
r = await this.request(s.add(i));
|
|
927
|
-
return { ...
|
|
927
|
+
return { ...t[t.length - 1], id: r };
|
|
928
928
|
}
|
|
929
|
-
async update(
|
|
930
|
-
const
|
|
931
|
-
return await this.request(
|
|
929
|
+
async update(t, s) {
|
|
930
|
+
const r = await this.transaction("readwrite");
|
|
931
|
+
return await this.request(r.put(s)), s;
|
|
932
932
|
}
|
|
933
|
-
async get(
|
|
933
|
+
async get(t, s) {
|
|
934
934
|
var p;
|
|
935
|
-
const r = await this.transaction("readonly"), i = await this.request(r.getAll()), n = this.applyFilter(i, s), a = (
|
|
936
|
-
n.sort((
|
|
937
|
-
const
|
|
938
|
-
return
|
|
935
|
+
const r = await this.transaction("readonly"), i = await this.request(r.getAll()), n = this.applyFilter(i, s), a = (t == null ? void 0 : t.sortingBy) ?? "id", o = ((p = t == null ? void 0 : t.sortingOrder) == null ? void 0 : p.toLowerCase()) ?? "asc";
|
|
936
|
+
n.sort((b, S) => {
|
|
937
|
+
const E = b[a], N = S[a];
|
|
938
|
+
return E < N ? o === "asc" ? -1 : 1 : E > N ? o === "asc" ? 1 : -1 : 0;
|
|
939
939
|
});
|
|
940
|
-
const l = (
|
|
941
|
-
|
|
942
|
-
|
|
940
|
+
const l = (t == null ? void 0 : t.pageSize) ?? 10, m = (t == null ? void 0 : t.currentPage) ?? 0, f = n.length, h = Math.ceil(f / l), d = n.slice(
|
|
941
|
+
m * l,
|
|
942
|
+
m * l + l
|
|
943
943
|
);
|
|
944
944
|
return {
|
|
945
945
|
sort: a,
|
|
946
946
|
order: o,
|
|
947
|
-
currentPage:
|
|
947
|
+
currentPage: m,
|
|
948
948
|
pageSize: l,
|
|
949
|
-
totalElements:
|
|
950
|
-
totalPages:
|
|
949
|
+
totalElements: f,
|
|
950
|
+
totalPages: h,
|
|
951
951
|
items: d
|
|
952
952
|
};
|
|
953
953
|
}
|
|
954
|
-
async export(
|
|
954
|
+
async export(t) {
|
|
955
955
|
const s = await this.transaction("readonly"), r = await this.request(s.getAll());
|
|
956
|
-
return this.applyFilter(r,
|
|
956
|
+
return this.applyFilter(r, t);
|
|
957
957
|
}
|
|
958
|
-
async import(
|
|
958
|
+
async import(t) {
|
|
959
959
|
const s = await this.transaction("readwrite");
|
|
960
960
|
let r = 0;
|
|
961
|
-
for (const i of
|
|
962
|
-
|
|
961
|
+
for (const i of t.items)
|
|
962
|
+
t.override ? await this.request(s.put(i)) : await this.request(s.add(i)), r++;
|
|
963
963
|
return r;
|
|
964
964
|
}
|
|
965
|
-
async commonGet(
|
|
965
|
+
async commonGet(t) {
|
|
966
966
|
const s = await this.transaction("readonly"), r = await this.request(s.getAll());
|
|
967
|
-
return this.applyFilter(r,
|
|
967
|
+
return this.applyFilter(r, t);
|
|
968
968
|
}
|
|
969
|
-
async getById(
|
|
970
|
-
const s = await this.transaction("readonly"), r = await this.request(s.get(
|
|
971
|
-
if (!r) throw new Error(`Record ${
|
|
969
|
+
async getById(t) {
|
|
970
|
+
const s = await this.transaction("readonly"), r = await this.request(s.get(t));
|
|
971
|
+
if (!r) throw new Error(`Record ${t} not found in ${this.table}`);
|
|
972
972
|
return r;
|
|
973
973
|
}
|
|
974
|
-
async softDelete(
|
|
974
|
+
async softDelete(t) {
|
|
975
975
|
const s = await this.transaction("readwrite");
|
|
976
976
|
let r = 0;
|
|
977
|
-
for (const i of
|
|
977
|
+
for (const i of t) {
|
|
978
978
|
const n = await this.request(s.get(i));
|
|
979
979
|
n && (await this.request(s.put({ ...n, deletedAt: /* @__PURE__ */ new Date() })), r++);
|
|
980
980
|
}
|
|
981
981
|
return r;
|
|
982
982
|
}
|
|
983
|
-
async restore(
|
|
983
|
+
async restore(t) {
|
|
984
984
|
const s = await this.transaction("readwrite");
|
|
985
985
|
let r = 0;
|
|
986
|
-
for (const i of
|
|
986
|
+
for (const i of t) {
|
|
987
987
|
const n = await this.request(s.get(i));
|
|
988
988
|
n && (await this.request(s.put({ ...n, deletedAt: null })), r++);
|
|
989
989
|
}
|
|
990
990
|
return r;
|
|
991
991
|
}
|
|
992
|
-
applyFilter(
|
|
993
|
-
return s ?
|
|
992
|
+
applyFilter(t, s) {
|
|
993
|
+
return s ? t.filter(
|
|
994
994
|
(r) => Object.keys(s).every(
|
|
995
995
|
(i) => s[i] === void 0 || r[i] === s[i]
|
|
996
996
|
)
|
|
997
|
-
) :
|
|
997
|
+
) : t;
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
|
-
function yn(
|
|
1001
|
-
return Object.keys(
|
|
1002
|
-
key:
|
|
1003
|
-
value: t
|
|
1000
|
+
function yn(e) {
|
|
1001
|
+
return Object.keys(e).filter((t) => isNaN(Number(t))).map((t) => ({
|
|
1002
|
+
key: t,
|
|
1003
|
+
value: e[t]
|
|
1004
1004
|
}));
|
|
1005
1005
|
}
|
|
1006
|
-
const Ce = (
|
|
1007
|
-
const s = localStorage.getItem(
|
|
1008
|
-
if (s &&
|
|
1009
|
-
switch (
|
|
1006
|
+
const Ce = (e, t = "") => {
|
|
1007
|
+
const s = localStorage.getItem(e) ?? void 0;
|
|
1008
|
+
if (s && t.length)
|
|
1009
|
+
switch (t) {
|
|
1010
1010
|
case "object":
|
|
1011
1011
|
return JSON.parse(s);
|
|
1012
1012
|
case "number":
|
|
@@ -1017,12 +1017,12 @@ const Ce = (t, e = "") => {
|
|
|
1017
1017
|
return s;
|
|
1018
1018
|
}
|
|
1019
1019
|
return s;
|
|
1020
|
-
}, ke = (
|
|
1021
|
-
|
|
1022
|
-
typeof
|
|
1023
|
-
), oe = (
|
|
1024
|
-
function gn(
|
|
1025
|
-
const
|
|
1020
|
+
}, ke = (e, t) => localStorage.setItem(
|
|
1021
|
+
e,
|
|
1022
|
+
typeof t == "object" ? JSON.stringify(t) : t
|
|
1023
|
+
), oe = (e) => localStorage.removeItem(e);
|
|
1024
|
+
function gn(e) {
|
|
1025
|
+
const t = e ? new Date(e) : /* @__PURE__ */ new Date(), s = {
|
|
1026
1026
|
weekday: "long",
|
|
1027
1027
|
// martes
|
|
1028
1028
|
day: "numeric",
|
|
@@ -1038,83 +1038,83 @@ function gn(t) {
|
|
|
1038
1038
|
hour12: !0
|
|
1039
1039
|
// PM
|
|
1040
1040
|
};
|
|
1041
|
-
return
|
|
1041
|
+
return t.toLocaleString(
|
|
1042
1042
|
navigator.language || "es-ES",
|
|
1043
1043
|
s
|
|
1044
1044
|
);
|
|
1045
1045
|
}
|
|
1046
|
-
function pn(
|
|
1047
|
-
const
|
|
1046
|
+
function pn(e) {
|
|
1047
|
+
const t = e ? new Date(e) : /* @__PURE__ */ new Date(), s = String(t.getDate()).padStart(2, "0"), r = String(t.getMonth() + 1).padStart(2, "0"), i = String(t.getFullYear()).slice(-2), n = String(t.getHours()).padStart(2, "0"), a = String(t.getMinutes()).padStart(2, "0");
|
|
1048
1048
|
return `${s}/${r}/${i} ${n}:${a}`;
|
|
1049
1049
|
}
|
|
1050
|
-
function bn(
|
|
1051
|
-
const
|
|
1050
|
+
function bn(e) {
|
|
1051
|
+
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"), a = String(t.getMinutes()).padStart(2, "0");
|
|
1052
1052
|
return `${s}-${r}-${i}T${n}:${a}`;
|
|
1053
1053
|
}
|
|
1054
1054
|
const ar = () => {
|
|
1055
1055
|
var s;
|
|
1056
|
-
const
|
|
1057
|
-
return /Mac|iPhone|iPod|iPad/i.test(
|
|
1056
|
+
const e = navigator, t = ((s = e == null ? void 0 : e.userAgentData) == null ? void 0 : s.platform) || (e == null ? void 0 : e.platform) || "";
|
|
1057
|
+
return /Mac|iPhone|iPod|iPad/i.test(t);
|
|
1058
1058
|
};
|
|
1059
|
-
function Xe(
|
|
1060
|
-
if (!
|
|
1061
|
-
const
|
|
1062
|
-
return Array.isArray(
|
|
1059
|
+
function Xe(e) {
|
|
1060
|
+
if (!e || typeof e != "object") return !1;
|
|
1061
|
+
const t = e;
|
|
1062
|
+
return Array.isArray(t.errors) && t.errors.every(
|
|
1063
1063
|
(s) => Array.isArray(s) && s.length === 2 && typeof s[0] == "string"
|
|
1064
1064
|
);
|
|
1065
1065
|
}
|
|
1066
|
-
function Ze(
|
|
1067
|
-
if (!
|
|
1068
|
-
const
|
|
1069
|
-
return typeof (
|
|
1066
|
+
function Ze(e) {
|
|
1067
|
+
if (!e || typeof e != "object") return !1;
|
|
1068
|
+
const t = e;
|
|
1069
|
+
return typeof (t == null ? void 0 : t.status) == "number" && typeof (t == null ? void 0 : t.message) == "string";
|
|
1070
1070
|
}
|
|
1071
|
-
function wn(
|
|
1072
|
-
return
|
|
1071
|
+
function wn(e, t) {
|
|
1072
|
+
return e != null && e.errors ? e.errors.map(([s, r]) => t(s, r)) : [];
|
|
1073
1073
|
}
|
|
1074
1074
|
const Jt = De(
|
|
1075
1075
|
void 0
|
|
1076
1076
|
);
|
|
1077
|
-
function vn(
|
|
1078
|
-
const { children:
|
|
1079
|
-
(
|
|
1080
|
-
const { type: p, items:
|
|
1077
|
+
function vn(e) {
|
|
1078
|
+
const { children: t } = e, s = Ue(0), [r, i] = qt(
|
|
1079
|
+
(h, d) => {
|
|
1080
|
+
const { type: p, items: b, id: S } = d;
|
|
1081
1081
|
switch (p) {
|
|
1082
1082
|
case "set":
|
|
1083
|
-
return
|
|
1083
|
+
return b ?? [];
|
|
1084
1084
|
case "remove":
|
|
1085
|
-
return S !== void 0 ?
|
|
1085
|
+
return S !== void 0 ? h.filter((E) => E.id !== S) : [];
|
|
1086
1086
|
}
|
|
1087
|
-
return
|
|
1087
|
+
return h;
|
|
1088
1088
|
},
|
|
1089
1089
|
[],
|
|
1090
1090
|
() => []
|
|
1091
|
-
), n = (
|
|
1091
|
+
), n = (h) => h.map((d) => ({ ...d, id: s.current++ })), a = (h) => i({
|
|
1092
1092
|
type: "set",
|
|
1093
|
-
items: n([{ ...
|
|
1094
|
-
}), o = (
|
|
1093
|
+
items: n([{ ...h, type: J.error }])
|
|
1094
|
+
}), o = (h) => i({ type: "set", items: n([{ ...h }]) }), l = (h) => i({ type: "set", items: n(h) }), m = (h) => i({
|
|
1095
1095
|
type: "set",
|
|
1096
|
-
items: n([{ ...
|
|
1097
|
-
}),
|
|
1096
|
+
items: n([{ ...h, type: J.success }])
|
|
1097
|
+
}), f = (h) => i({ type: "remove", id: h });
|
|
1098
1098
|
return /* @__PURE__ */ g(
|
|
1099
1099
|
Jt.Provider,
|
|
1100
1100
|
{
|
|
1101
1101
|
value: {
|
|
1102
1102
|
notification: r,
|
|
1103
|
-
removeNotification:
|
|
1103
|
+
removeNotification: f,
|
|
1104
1104
|
showErrorNotification: a,
|
|
1105
1105
|
showNotification: o,
|
|
1106
|
-
showSuccessNotification:
|
|
1106
|
+
showSuccessNotification: m,
|
|
1107
1107
|
showStackNotifications: l
|
|
1108
1108
|
},
|
|
1109
|
-
children:
|
|
1109
|
+
children: t
|
|
1110
1110
|
}
|
|
1111
1111
|
);
|
|
1112
1112
|
}
|
|
1113
|
-
const
|
|
1114
|
-
const
|
|
1115
|
-
if (!
|
|
1113
|
+
const Ae = () => {
|
|
1114
|
+
const e = Ve(Jt);
|
|
1115
|
+
if (!e)
|
|
1116
1116
|
throw new Error("NotificationContext must be used within a Provider");
|
|
1117
|
-
return
|
|
1117
|
+
return e;
|
|
1118
1118
|
}, we = new Js({
|
|
1119
1119
|
defaultOptions: {
|
|
1120
1120
|
queries: {
|
|
@@ -1129,86 +1129,86 @@ const Ne = () => {
|
|
|
1129
1129
|
}
|
|
1130
1130
|
}), Yt = De(
|
|
1131
1131
|
void 0
|
|
1132
|
-
), kn = (
|
|
1133
|
-
const { children:
|
|
1134
|
-
return /* @__PURE__ */ g(Yt.Provider, { value: { client: s }, children: /* @__PURE__ */ g(Ys, { client: we, children:
|
|
1132
|
+
), kn = (e) => {
|
|
1133
|
+
const { children: t, manager: s } = e;
|
|
1134
|
+
return /* @__PURE__ */ g(Yt.Provider, { value: { client: s }, children: /* @__PURE__ */ g(Ys, { client: we, children: t }) });
|
|
1135
1135
|
}, or = () => {
|
|
1136
|
-
const
|
|
1137
|
-
if (!
|
|
1136
|
+
const e = Ve(Yt);
|
|
1137
|
+
if (!e)
|
|
1138
1138
|
throw new Error("managerContext must be used within a Provider");
|
|
1139
|
-
return
|
|
1139
|
+
return e.client;
|
|
1140
1140
|
}, Xt = De(
|
|
1141
1141
|
void 0
|
|
1142
|
-
), Sn = (
|
|
1142
|
+
), Sn = (e) => {
|
|
1143
1143
|
const {
|
|
1144
|
-
children:
|
|
1144
|
+
children: t,
|
|
1145
1145
|
guestMode: s = "guest_mode",
|
|
1146
1146
|
user: r = "user",
|
|
1147
1147
|
remember: i = "remember",
|
|
1148
1148
|
refreshTokenKey: n = "refreshToken",
|
|
1149
1149
|
accessTokenExpiresAtKey: a = "accessTokenExpiresAt"
|
|
1150
|
-
} =
|
|
1150
|
+
} = e, o = or(), [l, m] = X({}), f = D(() => {
|
|
1151
1151
|
oe(r), oe(i), oe(n), oe(a);
|
|
1152
|
-
}, [a, n, i, r]),
|
|
1153
|
-
ke(s,
|
|
1154
|
-
}, [s]), p = D((
|
|
1155
|
-
if (!
|
|
1156
|
-
const
|
|
1157
|
-
|
|
1152
|
+
}, [a, n, i, r]), h = D(() => !!Ce(s, "boolean") && l.token === void 0, [l.token, s]), d = D((N) => {
|
|
1153
|
+
ke(s, N);
|
|
1154
|
+
}, [s]), p = D((N, C) => {
|
|
1155
|
+
if (!N) return;
|
|
1156
|
+
const F = Ce(i, "boolean"), x = C ?? (typeof F == "boolean" ? F : !1);
|
|
1157
|
+
m(N), oe(s), ke(r, N.token), ke(i, x), typeof N.refreshToken == "string" && N.refreshToken.length ? ke(n, N.refreshToken) : oe(n), typeof N.accessTokenExpiresAt == "string" && N.accessTokenExpiresAt.length ? ke(a, N.accessTokenExpiresAt) : oe(a);
|
|
1158
1158
|
}, [
|
|
1159
1159
|
a,
|
|
1160
1160
|
s,
|
|
1161
1161
|
n,
|
|
1162
1162
|
i,
|
|
1163
1163
|
r
|
|
1164
|
-
]),
|
|
1165
|
-
const
|
|
1164
|
+
]), b = D(async () => {
|
|
1165
|
+
const N = Ce(r) ?? l.token, C = Ce(n) ?? (typeof l.refreshToken == "string" ? l.refreshToken : void 0);
|
|
1166
1166
|
try {
|
|
1167
1167
|
await o.Auth.logout({
|
|
1168
|
-
accessToken:
|
|
1168
|
+
accessToken: N,
|
|
1169
1169
|
refreshToken: C
|
|
1170
1170
|
});
|
|
1171
|
-
} catch (
|
|
1172
|
-
console.error(
|
|
1171
|
+
} catch (F) {
|
|
1172
|
+
console.error(F);
|
|
1173
1173
|
}
|
|
1174
|
-
|
|
1175
|
-
}, [l.refreshToken, l.token,
|
|
1174
|
+
m({}), f();
|
|
1175
|
+
}, [l.refreshToken, l.token, f, o.Auth, n, r]), S = D(async () => {
|
|
1176
1176
|
try {
|
|
1177
|
-
const
|
|
1178
|
-
p(
|
|
1179
|
-
} catch (
|
|
1180
|
-
console.error(
|
|
1177
|
+
const N = await o.Auth.getSession();
|
|
1178
|
+
p(N);
|
|
1179
|
+
} catch (N) {
|
|
1180
|
+
console.error(N), b();
|
|
1181
1181
|
}
|
|
1182
|
-
}, [p,
|
|
1182
|
+
}, [p, b, o.Auth]), E = {
|
|
1183
1183
|
account: l,
|
|
1184
1184
|
logUser: p,
|
|
1185
|
-
logoutUser:
|
|
1185
|
+
logoutUser: b,
|
|
1186
1186
|
logUserFromLocal: S,
|
|
1187
|
-
isInGuestMode:
|
|
1187
|
+
isInGuestMode: h,
|
|
1188
1188
|
setGuestMode: d
|
|
1189
1189
|
};
|
|
1190
|
-
return /* @__PURE__ */ g(Xt.Provider, { value:
|
|
1190
|
+
return /* @__PURE__ */ g(Xt.Provider, { value: E, children: t });
|
|
1191
1191
|
}, Zt = () => {
|
|
1192
|
-
const
|
|
1193
|
-
if (!
|
|
1192
|
+
const e = Ve(Xt);
|
|
1193
|
+
if (!e)
|
|
1194
1194
|
throw new Error("authContext must be used within a Provider");
|
|
1195
|
-
return
|
|
1196
|
-
}, es = De({}),
|
|
1197
|
-
const { children:
|
|
1195
|
+
return e;
|
|
1196
|
+
}, es = De({}), Tn = (e) => {
|
|
1197
|
+
const { children: t, location: s, navigate: r, linkComponent: i, searchComponent: n } = e;
|
|
1198
1198
|
return /* @__PURE__ */ g(
|
|
1199
1199
|
es.Provider,
|
|
1200
1200
|
{
|
|
1201
1201
|
value: { location: s, navigate: r, linkComponent: i, searchComponent: n },
|
|
1202
|
-
children:
|
|
1202
|
+
children: t
|
|
1203
1203
|
}
|
|
1204
1204
|
);
|
|
1205
1205
|
}, Be = () => {
|
|
1206
|
-
const
|
|
1207
|
-
if (
|
|
1206
|
+
const e = Ve(es);
|
|
1207
|
+
if (e === void 0 || Object.keys(e).length === 0)
|
|
1208
1208
|
throw new Error(
|
|
1209
1209
|
"Config provider has not been set. This step is required and cannot be skipped."
|
|
1210
1210
|
);
|
|
1211
|
-
return
|
|
1211
|
+
return e;
|
|
1212
1212
|
}, cr = {
|
|
1213
1213
|
addChildItem: () => {
|
|
1214
1214
|
},
|
|
@@ -1219,25 +1219,25 @@ const Ne = () => {
|
|
|
1219
1219
|
dynamicItems: {}
|
|
1220
1220
|
}, ts = De(
|
|
1221
1221
|
cr
|
|
1222
|
-
),
|
|
1223
|
-
const { children:
|
|
1224
|
-
(l,
|
|
1225
|
-
...
|
|
1226
|
-
[l]: [...
|
|
1222
|
+
), En = (e) => {
|
|
1223
|
+
const { children: t } = e, [s, r] = X({}), i = D(
|
|
1224
|
+
(l, m) => r((f) => ({
|
|
1225
|
+
...f,
|
|
1226
|
+
[l]: [...f[l] ?? [], m]
|
|
1227
1227
|
})),
|
|
1228
1228
|
[]
|
|
1229
1229
|
), n = D(
|
|
1230
|
-
(l,
|
|
1231
|
-
...
|
|
1232
|
-
[l]: (
|
|
1230
|
+
(l, m) => r((f) => ({
|
|
1231
|
+
...f,
|
|
1232
|
+
[l]: (f[l] ?? []).filter((h, d) => d !== m)
|
|
1233
1233
|
})),
|
|
1234
1234
|
[]
|
|
1235
1235
|
), a = D((l) => {
|
|
1236
|
-
r(l ? (
|
|
1237
|
-
...
|
|
1236
|
+
r(l ? (m) => ({
|
|
1237
|
+
...m,
|
|
1238
1238
|
[l]: []
|
|
1239
1239
|
}) : {});
|
|
1240
|
-
}, []), o =
|
|
1240
|
+
}, []), o = xe(
|
|
1241
1241
|
() => ({
|
|
1242
1242
|
dynamicItems: s,
|
|
1243
1243
|
addChildItem: i,
|
|
@@ -1250,17 +1250,17 @@ const Ne = () => {
|
|
|
1250
1250
|
ts.Provider,
|
|
1251
1251
|
{
|
|
1252
1252
|
value: o,
|
|
1253
|
-
children:
|
|
1253
|
+
children: t
|
|
1254
1254
|
}
|
|
1255
1255
|
);
|
|
1256
1256
|
}, lr = () => Ve(ts);
|
|
1257
|
-
function _n(
|
|
1258
|
-
const { t
|
|
1259
|
-
const
|
|
1260
|
-
return
|
|
1257
|
+
function _n(e) {
|
|
1258
|
+
const { t } = R(), { open: s, onClose: r, menuMap: i, logo: n } = e, { account: a } = Zt(), { dynamicItems: o } = lr(), { linkComponent: l, location: m } = Be(), f = l, h = xe(() => i.filter((E) => {
|
|
1259
|
+
const N = E.auth, C = !!(a != null && a.email);
|
|
1260
|
+
return N == null || N && C || !N && !C;
|
|
1261
1261
|
}), [a == null ? void 0 : a.email, i]), d = D(
|
|
1262
|
-
(
|
|
1263
|
-
|
|
1262
|
+
(E) => {
|
|
1263
|
+
E.key === "Escape" && s && r();
|
|
1264
1264
|
},
|
|
1265
1265
|
[r, s]
|
|
1266
1266
|
);
|
|
@@ -1268,87 +1268,87 @@ function _n(t) {
|
|
|
1268
1268
|
document.removeEventListener("keydown", d);
|
|
1269
1269
|
}), [d]);
|
|
1270
1270
|
const p = D(
|
|
1271
|
-
(
|
|
1272
|
-
[
|
|
1273
|
-
),
|
|
1274
|
-
(
|
|
1271
|
+
(E, N) => N ? E === `${m.pathname}${m.search}` : E === m.pathname,
|
|
1272
|
+
[m.pathname, m.search]
|
|
1273
|
+
), b = D(
|
|
1274
|
+
(E) => /* @__PURE__ */ g(
|
|
1275
1275
|
"li",
|
|
1276
1276
|
{
|
|
1277
|
-
className: `drawer-list-item-child ${p(
|
|
1278
|
-
children:
|
|
1279
|
-
|
|
1277
|
+
className: `drawer-list-item-child ${p(E.path, !0) ? "active" : ""} animated`,
|
|
1278
|
+
children: E.path ? /* @__PURE__ */ g(
|
|
1279
|
+
f,
|
|
1280
1280
|
{
|
|
1281
1281
|
tabIndex: s ? 0 : -1,
|
|
1282
|
-
to:
|
|
1283
|
-
"aria-label":
|
|
1284
|
-
defaultValue:
|
|
1282
|
+
to: E.path ?? "/",
|
|
1283
|
+
"aria-label": t(`_accessibility:ariaLabels.${E.id}`, {
|
|
1284
|
+
defaultValue: E.label
|
|
1285
1285
|
}),
|
|
1286
1286
|
className: "drawer-link",
|
|
1287
|
-
children:
|
|
1287
|
+
children: E.label
|
|
1288
1288
|
}
|
|
1289
|
-
) :
|
|
1289
|
+
) : E.label
|
|
1290
1290
|
},
|
|
1291
|
-
|
|
1291
|
+
E.id
|
|
1292
1292
|
),
|
|
1293
|
-
[
|
|
1294
|
-
), S =
|
|
1295
|
-
const C =
|
|
1296
|
-
if (
|
|
1297
|
-
return /* @__PURE__ */ g("li", { className:
|
|
1298
|
-
const
|
|
1299
|
-
return /* @__PURE__ */
|
|
1300
|
-
/* @__PURE__ */
|
|
1301
|
-
|
|
1293
|
+
[f, s, t, p]
|
|
1294
|
+
), S = xe(() => h.map((E, N) => {
|
|
1295
|
+
const C = E.page ?? String(N), F = `drawer-list-item ${p(E.path) ? "active" : ""} animated`;
|
|
1296
|
+
if (E.type === "divider")
|
|
1297
|
+
return /* @__PURE__ */ g("li", { className: F, children: /* @__PURE__ */ g("hr", { className: "drawer-divider" }) }, C);
|
|
1298
|
+
const x = E.children ?? (E.page && o ? o[E.page] : null);
|
|
1299
|
+
return /* @__PURE__ */ $("li", { className: F, children: [
|
|
1300
|
+
/* @__PURE__ */ $(
|
|
1301
|
+
f,
|
|
1302
1302
|
{
|
|
1303
1303
|
tabIndex: s ? 0 : -1,
|
|
1304
|
-
to:
|
|
1305
|
-
"aria-label":
|
|
1306
|
-
defaultValue:
|
|
1304
|
+
to: E.path ?? "/",
|
|
1305
|
+
"aria-label": t(`_accessibility:ariaLabels.${String(E.page)}`, {
|
|
1306
|
+
defaultValue: t(`_pages:${String(E.page)}.title`)
|
|
1307
1307
|
}),
|
|
1308
1308
|
className: "drawer-link",
|
|
1309
1309
|
children: [
|
|
1310
|
-
|
|
1311
|
-
|
|
1310
|
+
E.icon,
|
|
1311
|
+
t(`_pages:${E.page}.title`)
|
|
1312
1312
|
]
|
|
1313
1313
|
}
|
|
1314
1314
|
),
|
|
1315
|
-
|
|
1315
|
+
x && /* @__PURE__ */ g("ul", { className: "drawer-children-list", children: x.map(b) })
|
|
1316
1316
|
] }, C);
|
|
1317
|
-
}), [
|
|
1317
|
+
}), [f, o, p, s, h, b, t]);
|
|
1318
1318
|
return /* @__PURE__ */ g(
|
|
1319
1319
|
"div",
|
|
1320
1320
|
{
|
|
1321
|
-
"aria-label":
|
|
1321
|
+
"aria-label": t("_accessibility:ariaLabels.closeMenu"),
|
|
1322
1322
|
"aria-disabled": !s,
|
|
1323
1323
|
className: `${s ? "opened" : "closed"} drawer-backdrop`,
|
|
1324
1324
|
onClick: () => r(),
|
|
1325
|
-
children: /* @__PURE__ */
|
|
1326
|
-
/* @__PURE__ */
|
|
1325
|
+
children: /* @__PURE__ */ $("aside", { className: `${s ? "opened" : "closed"} drawer animated`, children: [
|
|
1326
|
+
/* @__PURE__ */ $("div", { className: "drawer-header-container", children: [
|
|
1327
1327
|
n,
|
|
1328
|
-
/* @__PURE__ */ g("h2", { className: "drawer-header poppins", children:
|
|
1328
|
+
/* @__PURE__ */ g("h2", { className: "drawer-header poppins", children: t("_pages:home.appName") })
|
|
1329
1329
|
] }),
|
|
1330
1330
|
/* @__PURE__ */ g("ul", { className: "drawer-menu-list", children: S })
|
|
1331
1331
|
] })
|
|
1332
1332
|
}
|
|
1333
1333
|
);
|
|
1334
1334
|
}
|
|
1335
|
-
const
|
|
1336
|
-
var ot,
|
|
1335
|
+
const Te = ({ icon: e, ...t }) => /* @__PURE__ */ g(Fs, { icon: /* @__PURE__ */ g(ue, { icon: e }), ...t });
|
|
1336
|
+
var ot, At;
|
|
1337
1337
|
function ur() {
|
|
1338
|
-
if (
|
|
1339
|
-
|
|
1340
|
-
const
|
|
1338
|
+
if (At) return ot;
|
|
1339
|
+
At = 1;
|
|
1340
|
+
const e = (o, l = "local", m = void 0) => {
|
|
1341
1341
|
if (l === "local") {
|
|
1342
1342
|
if (localStorage.getItem(o) !== void 0 && localStorage.getItem(o) !== "undefined" && localStorage.getItem(o) !== null)
|
|
1343
|
-
return
|
|
1343
|
+
return m === void 0 || m !== void 0 && localStorage.getItem(o) === m;
|
|
1344
1344
|
} else if (l === "session" && sessionStorage.getItem(o) !== void 0 && sessionStorage.getItem(o) !== "undefined" && sessionStorage.getItem(o) !== null)
|
|
1345
|
-
return
|
|
1345
|
+
return m === void 0 || m !== void 0 && sessionStorage.getItem(o) === m;
|
|
1346
1346
|
return !1;
|
|
1347
|
-
},
|
|
1347
|
+
}, t = (o) => {
|
|
1348
1348
|
const l = {};
|
|
1349
|
-
return o.substring(1).split("&").forEach((
|
|
1350
|
-
const [
|
|
1351
|
-
l[
|
|
1349
|
+
return o.substring(1).split("&").forEach((f) => {
|
|
1350
|
+
const [h, d] = f.split("=");
|
|
1351
|
+
l[h] = d;
|
|
1352
1352
|
}), l;
|
|
1353
1353
|
}, s = (o = "") => {
|
|
1354
1354
|
if (n(o) && o.length) return n(o);
|
|
@@ -1358,19 +1358,19 @@ function ur() {
|
|
|
1358
1358
|
return o.length && i(o, 730, l), l;
|
|
1359
1359
|
}
|
|
1360
1360
|
return "en";
|
|
1361
|
-
}, r = (o = 0, l = 0,
|
|
1361
|
+
}, r = (o = 0, l = 0, m = window, f = "smooth") => m.scroll({
|
|
1362
1362
|
top: o,
|
|
1363
1363
|
left: l,
|
|
1364
|
-
behavior:
|
|
1365
|
-
}), i = (o, l,
|
|
1364
|
+
behavior: f
|
|
1365
|
+
}), i = (o, l, m, f = "/", h = "Lax") => {
|
|
1366
1366
|
var d = /* @__PURE__ */ new Date();
|
|
1367
1367
|
d.setTime(d.getTime() + l * 24 * 60 * 60 * 1e3);
|
|
1368
1368
|
const p = "; expires=" + d.toUTCString();
|
|
1369
|
-
document.cookie = `${o}=${
|
|
1369
|
+
document.cookie = `${o}=${m || ""}${p};path=${f};SameSite=${h}`;
|
|
1370
1370
|
}, n = (o) => {
|
|
1371
|
-
const l = `${o}=`,
|
|
1372
|
-
for (let
|
|
1373
|
-
let d = h
|
|
1371
|
+
const l = `${o}=`, f = decodeURIComponent(document.cookie).split(";");
|
|
1372
|
+
for (let h = 0; h < f.length; h += 1) {
|
|
1373
|
+
let d = f[h];
|
|
1374
1374
|
for (; d.charAt(0) === " "; )
|
|
1375
1375
|
d = d.substring(1);
|
|
1376
1376
|
if (d.indexOf(l) === 0)
|
|
@@ -1384,87 +1384,87 @@ function ur() {
|
|
|
1384
1384
|
deleteCookie: (o) => document.cookie = `${o}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`,
|
|
1385
1385
|
getUserLanguage: s,
|
|
1386
1386
|
scrollTo: r,
|
|
1387
|
-
parseQueries:
|
|
1388
|
-
validation:
|
|
1387
|
+
parseQueries: t,
|
|
1388
|
+
validation: e
|
|
1389
1389
|
}, ot;
|
|
1390
1390
|
}
|
|
1391
1391
|
var dr = ur();
|
|
1392
1392
|
function Cn() {
|
|
1393
|
-
const { t, language:
|
|
1393
|
+
const { t: e, language: t } = R();
|
|
1394
1394
|
return { timeAge: D(
|
|
1395
1395
|
(r) => {
|
|
1396
|
-
const n = /* @__PURE__ */ new Date() - r, a = Math.floor(n / (1e3 * 60)), o = Math.floor(a / 60), l =
|
|
1397
|
-
return n < 1e3 * 60 ? S : a < 60 ? `${l ?
|
|
1396
|
+
const n = /* @__PURE__ */ new Date() - r, a = Math.floor(n / (1e3 * 60)), o = Math.floor(a / 60), l = t === "es", m = e("_accessibility:labels.ago"), f = e("_accessibility:labels.minute"), h = e("_accessibility:labels.minutes"), d = e("_accessibility:labels.hour"), p = e("_accessibility:labels.hours"), b = e("_accessibility:labels.yesterday"), S = e("_accessibility:labels.justNow");
|
|
1397
|
+
return n < 1e3 * 60 ? S : a < 60 ? `${l ? m : ""} ${a} ${a === 1 ? f : h} ${l ? "" : m}` : o < 24 ? `${l ? m : ""} ${o} ${o === 1 ? d : p} ${l ? "" : m}` : o < 48 ? b : r.toLocaleDateString(navigator.language || "es-ES", {
|
|
1398
1398
|
day: "2-digit",
|
|
1399
1399
|
month: "2-digit",
|
|
1400
1400
|
year: "numeric"
|
|
1401
1401
|
});
|
|
1402
1402
|
},
|
|
1403
|
-
[
|
|
1403
|
+
[e, t]
|
|
1404
1404
|
) };
|
|
1405
1405
|
}
|
|
1406
|
-
const ss = (
|
|
1407
|
-
const { showSuccessNotification:
|
|
1408
|
-
|
|
1409
|
-
}, d = async (
|
|
1410
|
-
o(
|
|
1406
|
+
const ss = (e) => {
|
|
1407
|
+
const { showSuccessNotification: t } = Ae(), { mutationFn: s, onError: r, onSuccess: i, onSuccessMessage: n } = e, [a, o] = X([]), { open: l, handleClose: m, handleOpen: f } = ds(), h = () => {
|
|
1408
|
+
m(), o([]);
|
|
1409
|
+
}, d = async (b) => {
|
|
1410
|
+
o(b), f();
|
|
1411
1411
|
}, p = Ke({
|
|
1412
1412
|
mutationFn: () => s(
|
|
1413
1413
|
Array.isArray(a) ? a : [a]
|
|
1414
1414
|
),
|
|
1415
|
-
onError: (
|
|
1416
|
-
console.error(
|
|
1415
|
+
onError: (b) => {
|
|
1416
|
+
console.error(b), r && r(b), h();
|
|
1417
1417
|
},
|
|
1418
|
-
onSuccess: async (
|
|
1419
|
-
i && i(
|
|
1418
|
+
onSuccess: async (b) => {
|
|
1419
|
+
i && i(b), t({
|
|
1420
1420
|
message: n
|
|
1421
|
-
}),
|
|
1421
|
+
}), h();
|
|
1422
1422
|
}
|
|
1423
1423
|
});
|
|
1424
|
-
return { open: l, onClick: d, close:
|
|
1424
|
+
return { open: l, onClick: d, close: h, dialogFn: p, isLoading: p.isPending };
|
|
1425
1425
|
};
|
|
1426
|
-
var qe = (
|
|
1427
|
-
const rs = (
|
|
1428
|
-
var H = (
|
|
1429
|
-
const
|
|
1430
|
-
return H(
|
|
1426
|
+
var qe = (e) => e.type === "checkbox", Ne = (e) => e instanceof Date, te = (e) => e == null;
|
|
1427
|
+
const rs = (e) => typeof e == "object";
|
|
1428
|
+
var H = (e) => !te(e) && !Array.isArray(e) && rs(e) && !Ne(e), fr = (e) => H(e) && e.target ? qe(e.target) ? e.target.checked : e.target.value : e, hr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, mr = (e, t) => e.has(hr(t)), yr = (e) => {
|
|
1429
|
+
const t = e.constructor && e.constructor.prototype;
|
|
1430
|
+
return H(t) && t.hasOwnProperty("isPrototypeOf");
|
|
1431
1431
|
}, ht = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
1432
|
-
function z(
|
|
1433
|
-
let
|
|
1434
|
-
const s = Array.isArray(
|
|
1435
|
-
if (
|
|
1436
|
-
|
|
1437
|
-
else if (!(ht && (
|
|
1438
|
-
if (
|
|
1439
|
-
|
|
1432
|
+
function z(e) {
|
|
1433
|
+
let t;
|
|
1434
|
+
const s = Array.isArray(e), r = typeof FileList < "u" ? e instanceof FileList : !1;
|
|
1435
|
+
if (e instanceof Date)
|
|
1436
|
+
t = new Date(e);
|
|
1437
|
+
else if (!(ht && (e instanceof Blob || r)) && (s || H(e)))
|
|
1438
|
+
if (t = s ? [] : {}, !s && !yr(e))
|
|
1439
|
+
t = e;
|
|
1440
1440
|
else
|
|
1441
|
-
for (const i in
|
|
1442
|
-
|
|
1441
|
+
for (const i in e)
|
|
1442
|
+
e.hasOwnProperty(i) && (t[i] = z(e[i]));
|
|
1443
1443
|
else
|
|
1444
|
-
return
|
|
1445
|
-
return
|
|
1444
|
+
return e;
|
|
1445
|
+
return t;
|
|
1446
1446
|
}
|
|
1447
|
-
var et = (
|
|
1448
|
-
if (!
|
|
1447
|
+
var et = (e) => /^\w*$/.test(e), Q = (e) => e === void 0, mt = (e) => Array.isArray(e) ? e.filter(Boolean) : [], yt = (e) => mt(e.replace(/["|']|\]/g, "").split(/\.|\[/)), T = (e, t, s) => {
|
|
1448
|
+
if (!t || !H(e))
|
|
1449
1449
|
return s;
|
|
1450
|
-
const r = (et(
|
|
1451
|
-
return Q(r) || r ===
|
|
1452
|
-
}, ye = (
|
|
1450
|
+
const r = (et(t) ? [t] : yt(t)).reduce((i, n) => te(i) ? i : i[n], e);
|
|
1451
|
+
return Q(r) || r === e ? Q(e[t]) ? s : e[t] : r;
|
|
1452
|
+
}, ye = (e) => typeof e == "boolean", B = (e, t, s) => {
|
|
1453
1453
|
let r = -1;
|
|
1454
|
-
const i = et(
|
|
1454
|
+
const i = et(t) ? [t] : yt(t), n = i.length, a = n - 1;
|
|
1455
1455
|
for (; ++r < n; ) {
|
|
1456
1456
|
const o = i[r];
|
|
1457
1457
|
let l = s;
|
|
1458
1458
|
if (r !== a) {
|
|
1459
|
-
const
|
|
1460
|
-
l = H(
|
|
1459
|
+
const m = e[o];
|
|
1460
|
+
l = H(m) || Array.isArray(m) ? m : isNaN(+i[r + 1]) ? {} : [];
|
|
1461
1461
|
}
|
|
1462
1462
|
if (o === "__proto__" || o === "constructor" || o === "prototype")
|
|
1463
1463
|
return;
|
|
1464
|
-
|
|
1464
|
+
e[o] = l, e = e[o];
|
|
1465
1465
|
}
|
|
1466
1466
|
};
|
|
1467
|
-
const
|
|
1467
|
+
const Ft = {
|
|
1468
1468
|
BLUR: "blur",
|
|
1469
1469
|
FOCUS_OUT: "focusout"
|
|
1470
1470
|
}, fe = {
|
|
@@ -1483,182 +1483,182 @@ const $t = {
|
|
|
1483
1483
|
validate: "validate"
|
|
1484
1484
|
}, gr = ae.createContext(null);
|
|
1485
1485
|
gr.displayName = "HookFormContext";
|
|
1486
|
-
var pr = (
|
|
1486
|
+
var pr = (e, t, s, r = !0) => {
|
|
1487
1487
|
const i = {
|
|
1488
|
-
defaultValues:
|
|
1488
|
+
defaultValues: t._defaultValues
|
|
1489
1489
|
};
|
|
1490
|
-
for (const n in
|
|
1490
|
+
for (const n in e)
|
|
1491
1491
|
Object.defineProperty(i, n, {
|
|
1492
1492
|
get: () => {
|
|
1493
1493
|
const a = n;
|
|
1494
|
-
return
|
|
1494
|
+
return t._proxyFormState[a] !== fe.all && (t._proxyFormState[a] = !r || fe.all), e[a];
|
|
1495
1495
|
}
|
|
1496
1496
|
});
|
|
1497
1497
|
return i;
|
|
1498
1498
|
};
|
|
1499
1499
|
const br = typeof window < "u" ? ae.useLayoutEffect : ae.useEffect;
|
|
1500
|
-
var pe = (
|
|
1501
|
-
function Se(
|
|
1502
|
-
if (ut(
|
|
1503
|
-
return
|
|
1504
|
-
if (
|
|
1505
|
-
return
|
|
1506
|
-
const r = Object.keys(
|
|
1500
|
+
var pe = (e) => typeof e == "string", wr = (e, t, s, r, i) => pe(e) ? (r && t.watch.add(e), T(s, e, i)) : Array.isArray(e) ? e.map((n) => (r && t.watch.add(n), T(s, n))) : (r && (t.watchAll = !0), s), ut = (e) => te(e) || !rs(e);
|
|
1501
|
+
function Se(e, t, s = /* @__PURE__ */ new WeakSet()) {
|
|
1502
|
+
if (ut(e) || ut(t))
|
|
1503
|
+
return e === t;
|
|
1504
|
+
if (Ne(e) && Ne(t))
|
|
1505
|
+
return e.getTime() === t.getTime();
|
|
1506
|
+
const r = Object.keys(e), i = Object.keys(t);
|
|
1507
1507
|
if (r.length !== i.length)
|
|
1508
1508
|
return !1;
|
|
1509
|
-
if (s.has(
|
|
1509
|
+
if (s.has(e) || s.has(t))
|
|
1510
1510
|
return !0;
|
|
1511
|
-
s.add(
|
|
1511
|
+
s.add(e), s.add(t);
|
|
1512
1512
|
for (const n of r) {
|
|
1513
|
-
const a =
|
|
1513
|
+
const a = e[n];
|
|
1514
1514
|
if (!i.includes(n))
|
|
1515
1515
|
return !1;
|
|
1516
1516
|
if (n !== "ref") {
|
|
1517
|
-
const o =
|
|
1518
|
-
if (
|
|
1517
|
+
const o = t[n];
|
|
1518
|
+
if (Ne(a) && Ne(o) || H(a) && H(o) || Array.isArray(a) && Array.isArray(o) ? !Se(a, o, s) : a !== o)
|
|
1519
1519
|
return !1;
|
|
1520
1520
|
}
|
|
1521
1521
|
}
|
|
1522
1522
|
return !0;
|
|
1523
1523
|
}
|
|
1524
|
-
var vr = (
|
|
1525
|
-
...s[
|
|
1524
|
+
var vr = (e, t, s, r, i) => t ? {
|
|
1525
|
+
...s[e],
|
|
1526
1526
|
types: {
|
|
1527
|
-
...s[
|
|
1527
|
+
...s[e] && s[e].types ? s[e].types : {},
|
|
1528
1528
|
[r]: i || !0
|
|
1529
1529
|
}
|
|
1530
|
-
} : {}, Pe = (
|
|
1531
|
-
let
|
|
1530
|
+
} : {}, Pe = (e) => Array.isArray(e) ? e : [e], $t = () => {
|
|
1531
|
+
let e = [];
|
|
1532
1532
|
return {
|
|
1533
1533
|
get observers() {
|
|
1534
|
-
return
|
|
1534
|
+
return e;
|
|
1535
1535
|
},
|
|
1536
1536
|
next: (i) => {
|
|
1537
|
-
for (const n of
|
|
1537
|
+
for (const n of e)
|
|
1538
1538
|
n.next && n.next(i);
|
|
1539
1539
|
},
|
|
1540
|
-
subscribe: (i) => (
|
|
1540
|
+
subscribe: (i) => (e.push(i), {
|
|
1541
1541
|
unsubscribe: () => {
|
|
1542
|
-
|
|
1542
|
+
e = e.filter((n) => n !== i);
|
|
1543
1543
|
}
|
|
1544
1544
|
}),
|
|
1545
1545
|
unsubscribe: () => {
|
|
1546
|
-
|
|
1546
|
+
e = [];
|
|
1547
1547
|
}
|
|
1548
1548
|
};
|
|
1549
|
-
}, se = (
|
|
1549
|
+
}, se = (e) => H(e) && !Object.keys(e).length, gt = (e) => e.type === "file", he = (e) => typeof e == "function", ze = (e) => {
|
|
1550
1550
|
if (!ht)
|
|
1551
1551
|
return !1;
|
|
1552
|
-
const
|
|
1553
|
-
return
|
|
1554
|
-
}, ns = (
|
|
1555
|
-
function Sr(
|
|
1556
|
-
const s =
|
|
1552
|
+
const t = e ? e.ownerDocument : 0;
|
|
1553
|
+
return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
|
|
1554
|
+
}, ns = (e) => e.type === "select-multiple", pt = (e) => e.type === "radio", kr = (e) => pt(e) || qe(e), ct = (e) => ze(e) && e.isConnected;
|
|
1555
|
+
function Sr(e, t) {
|
|
1556
|
+
const s = t.slice(0, -1).length;
|
|
1557
1557
|
let r = 0;
|
|
1558
1558
|
for (; r < s; )
|
|
1559
|
-
|
|
1560
|
-
return
|
|
1559
|
+
e = Q(e) ? r++ : e[t[r++]];
|
|
1560
|
+
return e;
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1563
|
-
for (const
|
|
1564
|
-
if (
|
|
1562
|
+
function Tr(e) {
|
|
1563
|
+
for (const t in e)
|
|
1564
|
+
if (e.hasOwnProperty(t) && !Q(e[t]))
|
|
1565
1565
|
return !1;
|
|
1566
1566
|
return !0;
|
|
1567
1567
|
}
|
|
1568
|
-
function j(
|
|
1569
|
-
const s = Array.isArray(
|
|
1570
|
-
return r && delete r[n], i !== 0 && (H(r) && se(r) || Array.isArray(r) &&
|
|
1568
|
+
function j(e, t) {
|
|
1569
|
+
const s = Array.isArray(t) ? t : et(t) ? [t] : yt(t), r = s.length === 1 ? e : Sr(e, s), i = s.length - 1, n = s[i];
|
|
1570
|
+
return r && delete r[n], i !== 0 && (H(r) && se(r) || Array.isArray(r) && Tr(r)) && j(e, s.slice(0, -1)), e;
|
|
1571
1571
|
}
|
|
1572
|
-
var is = (
|
|
1573
|
-
for (const
|
|
1574
|
-
if (he(t
|
|
1572
|
+
var is = (e) => {
|
|
1573
|
+
for (const t in e)
|
|
1574
|
+
if (he(e[t]))
|
|
1575
1575
|
return !0;
|
|
1576
1576
|
return !1;
|
|
1577
1577
|
};
|
|
1578
|
-
function Je(
|
|
1579
|
-
const s = Array.isArray(
|
|
1580
|
-
if (H(
|
|
1581
|
-
for (const r in
|
|
1582
|
-
Array.isArray(
|
|
1583
|
-
return
|
|
1578
|
+
function Je(e, t = {}) {
|
|
1579
|
+
const s = Array.isArray(e);
|
|
1580
|
+
if (H(e) || s)
|
|
1581
|
+
for (const r in e)
|
|
1582
|
+
Array.isArray(e[r]) || H(e[r]) && !is(e[r]) ? (t[r] = Array.isArray(e[r]) ? [] : {}, Je(e[r], t[r])) : te(e[r]) || (t[r] = !0);
|
|
1583
|
+
return t;
|
|
1584
1584
|
}
|
|
1585
|
-
function as(
|
|
1586
|
-
const r = Array.isArray(
|
|
1587
|
-
if (H(
|
|
1588
|
-
for (const i in
|
|
1589
|
-
Array.isArray(
|
|
1585
|
+
function as(e, t, s) {
|
|
1586
|
+
const r = Array.isArray(e);
|
|
1587
|
+
if (H(e) || r)
|
|
1588
|
+
for (const i in e)
|
|
1589
|
+
Array.isArray(e[i]) || H(e[i]) && !is(e[i]) ? Q(t) || ut(s[i]) ? s[i] = Array.isArray(e[i]) ? Je(e[i], []) : { ...Je(e[i]) } : as(e[i], te(t) ? {} : t[i], s[i]) : s[i] = !Se(e[i], t[i]);
|
|
1590
1590
|
return s;
|
|
1591
1591
|
}
|
|
1592
|
-
var Re = (
|
|
1592
|
+
var Re = (e, t) => as(e, t, Je(t));
|
|
1593
1593
|
const Lt = {
|
|
1594
1594
|
value: !1,
|
|
1595
1595
|
isValid: !1
|
|
1596
1596
|
}, Dt = { value: !0, isValid: !0 };
|
|
1597
|
-
var os = (
|
|
1598
|
-
if (Array.isArray(
|
|
1599
|
-
if (
|
|
1600
|
-
const
|
|
1601
|
-
return { value:
|
|
1597
|
+
var os = (e) => {
|
|
1598
|
+
if (Array.isArray(e)) {
|
|
1599
|
+
if (e.length > 1) {
|
|
1600
|
+
const t = e.filter((s) => s && s.checked && !s.disabled).map((s) => s.value);
|
|
1601
|
+
return { value: t, isValid: !!t.length };
|
|
1602
1602
|
}
|
|
1603
|
-
return
|
|
1603
|
+
return e[0].checked && !e[0].disabled ? (
|
|
1604
1604
|
// @ts-expect-error expected to work in the browser
|
|
1605
|
-
|
|
1605
|
+
e[0].attributes && !Q(e[0].attributes.value) ? Q(e[0].value) || e[0].value === "" ? Dt : { value: e[0].value, isValid: !0 } : Dt
|
|
1606
1606
|
) : Lt;
|
|
1607
1607
|
}
|
|
1608
1608
|
return Lt;
|
|
1609
|
-
}, cs = (
|
|
1609
|
+
}, cs = (e, { valueAsNumber: t, valueAsDate: s, setValueAs: r }) => Q(e) ? e : t ? e === "" ? NaN : e && +e : s && pe(e) ? new Date(e) : r ? r(e) : e;
|
|
1610
1610
|
const Vt = {
|
|
1611
1611
|
isValid: !1,
|
|
1612
1612
|
value: null
|
|
1613
1613
|
};
|
|
1614
|
-
var ls = (
|
|
1614
|
+
var ls = (e) => Array.isArray(e) ? e.reduce((t, s) => s && s.checked && !s.disabled ? {
|
|
1615
1615
|
isValid: !0,
|
|
1616
1616
|
value: s.value
|
|
1617
|
-
} :
|
|
1618
|
-
function Rt(
|
|
1619
|
-
const
|
|
1620
|
-
return gt(
|
|
1617
|
+
} : t, Vt) : Vt;
|
|
1618
|
+
function Rt(e) {
|
|
1619
|
+
const t = e.ref;
|
|
1620
|
+
return gt(t) ? t.files : pt(t) ? ls(e.refs).value : ns(t) ? [...t.selectedOptions].map(({ value: s }) => s) : qe(t) ? os(e.refs).value : cs(Q(t.value) ? e.ref.value : t.value, e);
|
|
1621
1621
|
}
|
|
1622
|
-
var
|
|
1622
|
+
var Er = (e, t, s, r) => {
|
|
1623
1623
|
const i = {};
|
|
1624
|
-
for (const n of
|
|
1625
|
-
const a =
|
|
1624
|
+
for (const n of e) {
|
|
1625
|
+
const a = T(t, n);
|
|
1626
1626
|
a && B(i, n, a._f);
|
|
1627
1627
|
}
|
|
1628
1628
|
return {
|
|
1629
1629
|
criteriaMode: s,
|
|
1630
|
-
names: [...
|
|
1630
|
+
names: [...e],
|
|
1631
1631
|
fields: i,
|
|
1632
1632
|
shouldUseNativeValidation: r
|
|
1633
1633
|
};
|
|
1634
|
-
}, Ye = (
|
|
1635
|
-
isOnSubmit: !
|
|
1636
|
-
isOnBlur:
|
|
1637
|
-
isOnChange:
|
|
1638
|
-
isOnAll:
|
|
1639
|
-
isOnTouch:
|
|
1634
|
+
}, Ye = (e) => e instanceof RegExp, Ie = (e) => Q(e) ? e : Ye(e) ? e.source : H(e) ? Ye(e.value) ? e.value.source : e.value : e, It = (e) => ({
|
|
1635
|
+
isOnSubmit: !e || e === fe.onSubmit,
|
|
1636
|
+
isOnBlur: e === fe.onBlur,
|
|
1637
|
+
isOnChange: e === fe.onChange,
|
|
1638
|
+
isOnAll: e === fe.all,
|
|
1639
|
+
isOnTouch: e === fe.onTouched
|
|
1640
1640
|
});
|
|
1641
1641
|
const Pt = "AsyncFunction";
|
|
1642
|
-
var _r = (
|
|
1643
|
-
const Me = (
|
|
1644
|
-
for (const i of s || Object.keys(
|
|
1645
|
-
const n =
|
|
1642
|
+
var _r = (e) => !!e && !!e.validate && !!(he(e.validate) && e.validate.constructor.name === Pt || H(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === Pt)), Cr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Mt = (e, t, s) => !s && (t.watchAll || t.watch.has(e) || [...t.watch].some((r) => e.startsWith(r) && /^\.\w+/.test(e.slice(r.length))));
|
|
1643
|
+
const Me = (e, t, s, r) => {
|
|
1644
|
+
for (const i of s || Object.keys(e)) {
|
|
1645
|
+
const n = T(e, i);
|
|
1646
1646
|
if (n) {
|
|
1647
1647
|
const { _f: a, ...o } = n;
|
|
1648
1648
|
if (a) {
|
|
1649
|
-
if (a.refs && a.refs[0] &&
|
|
1649
|
+
if (a.refs && a.refs[0] && t(a.refs[0], i) && !r)
|
|
1650
1650
|
return !0;
|
|
1651
|
-
if (a.ref &&
|
|
1651
|
+
if (a.ref && t(a.ref, a.name) && !r)
|
|
1652
1652
|
return !0;
|
|
1653
|
-
if (Me(o,
|
|
1653
|
+
if (Me(o, t))
|
|
1654
1654
|
break;
|
|
1655
|
-
} else if (H(o) && Me(o,
|
|
1655
|
+
} else if (H(o) && Me(o, t))
|
|
1656
1656
|
break;
|
|
1657
1657
|
}
|
|
1658
1658
|
}
|
|
1659
1659
|
};
|
|
1660
|
-
function Ot(
|
|
1661
|
-
const r =
|
|
1660
|
+
function Ot(e, t, s) {
|
|
1661
|
+
const r = T(e, s);
|
|
1662
1662
|
if (r || et(s))
|
|
1663
1663
|
return {
|
|
1664
1664
|
error: r,
|
|
@@ -1666,7 +1666,7 @@ function Ot(t, e, s) {
|
|
|
1666
1666
|
};
|
|
1667
1667
|
const i = s.split(".");
|
|
1668
1668
|
for (; i.length; ) {
|
|
1669
|
-
const n = i.join("."), a =
|
|
1669
|
+
const n = i.join("."), a = T(t, n), o = T(e, n);
|
|
1670
1670
|
if (a && !Array.isArray(a) && s !== n)
|
|
1671
1671
|
return { name: s };
|
|
1672
1672
|
if (o && o.type)
|
|
@@ -1685,34 +1685,34 @@ function Ot(t, e, s) {
|
|
|
1685
1685
|
name: s
|
|
1686
1686
|
};
|
|
1687
1687
|
}
|
|
1688
|
-
var
|
|
1689
|
-
s(
|
|
1690
|
-
const { name: i, ...n } =
|
|
1691
|
-
return se(n) || Object.keys(n).length >= Object.keys(
|
|
1692
|
-
},
|
|
1693
|
-
const r = Pe(
|
|
1694
|
-
return B(r, "root",
|
|
1695
|
-
}, Qe = (
|
|
1696
|
-
function Ut(
|
|
1697
|
-
if (Qe(
|
|
1688
|
+
var Nr = (e, t, s, r) => {
|
|
1689
|
+
s(e);
|
|
1690
|
+
const { name: i, ...n } = e;
|
|
1691
|
+
return se(n) || Object.keys(n).length >= Object.keys(t).length || Object.keys(n).find((a) => t[a] === (!r || fe.all));
|
|
1692
|
+
}, xr = (e, t, s) => !e || !t || e === t || Pe(e).some((r) => r && (s ? r === t : r.startsWith(t) || t.startsWith(r))), Ar = (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, Fr = (e, t) => !mt(T(e, t)).length && j(e, t), $r = (e, t, s) => {
|
|
1693
|
+
const r = Pe(T(e, s));
|
|
1694
|
+
return B(r, "root", t[s]), B(e, s, r), e;
|
|
1695
|
+
}, Qe = (e) => pe(e);
|
|
1696
|
+
function Ut(e, t, s = "validate") {
|
|
1697
|
+
if (Qe(e) || Array.isArray(e) && e.every(Qe) || ye(e) && !e)
|
|
1698
1698
|
return {
|
|
1699
1699
|
type: s,
|
|
1700
|
-
message: Qe(
|
|
1701
|
-
ref:
|
|
1700
|
+
message: Qe(e) ? e : "",
|
|
1701
|
+
ref: t
|
|
1702
1702
|
};
|
|
1703
1703
|
}
|
|
1704
|
-
var
|
|
1705
|
-
value:
|
|
1704
|
+
var Fe = (e) => H(e) && !Ye(e) ? e : {
|
|
1705
|
+
value: e,
|
|
1706
1706
|
message: ""
|
|
1707
|
-
}, Kt = async (
|
|
1708
|
-
const { ref: a, refs: o, required: l, maxLength:
|
|
1709
|
-
if (!
|
|
1707
|
+
}, Kt = async (e, t, s, r, i, n) => {
|
|
1708
|
+
const { ref: a, refs: o, required: l, maxLength: m, minLength: f, min: h, max: d, pattern: p, validate: b, name: S, valueAsNumber: E, mount: N } = e._f, C = T(s, S);
|
|
1709
|
+
if (!N || t.has(S))
|
|
1710
1710
|
return {};
|
|
1711
|
-
const
|
|
1712
|
-
i &&
|
|
1713
|
-
},
|
|
1711
|
+
const F = o ? o[0] : a, x = (L) => {
|
|
1712
|
+
i && F.reportValidity && (F.setCustomValidity(ye(L) ? "" : L || ""), F.reportValidity());
|
|
1713
|
+
}, A = {}, I = pt(a), O = qe(a), re = I || O, P = (E || gt(a)) && Q(a.value) && Q(C) || ze(a) && a.value === "" || C === "" || Array.isArray(C) && !C.length, ne = vr.bind(null, S, r, A), ce = (L, V, q, G = be.maxLength, Y = be.minLength) => {
|
|
1714
1714
|
const U = L ? V : q;
|
|
1715
|
-
|
|
1715
|
+
A[S] = {
|
|
1716
1716
|
type: L ? G : Y,
|
|
1717
1717
|
message: U,
|
|
1718
1718
|
ref: a,
|
|
@@ -1720,18 +1720,18 @@ var $e = (t) => H(t) && !Ye(t) ? t : {
|
|
|
1720
1720
|
};
|
|
1721
1721
|
};
|
|
1722
1722
|
if (n ? !Array.isArray(C) || !C.length : l && (!re && (P || te(C)) || ye(C) && !C || O && !os(o).isValid || I && !ls(o).isValid)) {
|
|
1723
|
-
const { value: L, message: V } = Qe(l) ? { value: !!l, message: l } :
|
|
1724
|
-
if (L && (
|
|
1723
|
+
const { value: L, message: V } = Qe(l) ? { value: !!l, message: l } : Fe(l);
|
|
1724
|
+
if (L && (A[S] = {
|
|
1725
1725
|
type: be.required,
|
|
1726
1726
|
message: V,
|
|
1727
|
-
ref:
|
|
1727
|
+
ref: F,
|
|
1728
1728
|
...ne(be.required, V)
|
|
1729
1729
|
}, !r))
|
|
1730
|
-
return
|
|
1730
|
+
return x(V), A;
|
|
1731
1731
|
}
|
|
1732
|
-
if (!P && (!te(
|
|
1732
|
+
if (!P && (!te(h) || !te(d))) {
|
|
1733
1733
|
let L, V;
|
|
1734
|
-
const q =
|
|
1734
|
+
const q = Fe(d), G = Fe(h);
|
|
1735
1735
|
if (!te(C) && !isNaN(C)) {
|
|
1736
1736
|
const Y = a.valueAsNumber || C && +C;
|
|
1737
1737
|
te(q.value) || (L = Y > q.value), te(G.value) || (V = Y < G.value);
|
|
@@ -1740,65 +1740,65 @@ var $e = (t) => H(t) && !Ye(t) ? t : {
|
|
|
1740
1740
|
pe(q.value) && C && (L = Z ? U(C) > U(q.value) : ie ? C > q.value : Y > new Date(q.value)), pe(G.value) && C && (V = Z ? U(C) < U(G.value) : ie ? C < G.value : Y < new Date(G.value));
|
|
1741
1741
|
}
|
|
1742
1742
|
if ((L || V) && (ce(!!L, q.message, G.message, be.max, be.min), !r))
|
|
1743
|
-
return A
|
|
1743
|
+
return x(A[S].message), A;
|
|
1744
1744
|
}
|
|
1745
|
-
if ((
|
|
1746
|
-
const L =
|
|
1745
|
+
if ((m || f) && !P && (pe(C) || n && Array.isArray(C))) {
|
|
1746
|
+
const L = Fe(m), V = Fe(f), q = !te(L.value) && C.length > +L.value, G = !te(V.value) && C.length < +V.value;
|
|
1747
1747
|
if ((q || G) && (ce(q, L.message, V.message), !r))
|
|
1748
|
-
return A
|
|
1748
|
+
return x(A[S].message), A;
|
|
1749
1749
|
}
|
|
1750
1750
|
if (p && !P && pe(C)) {
|
|
1751
|
-
const { value: L, message: V } =
|
|
1752
|
-
if (Ye(L) && !C.match(L) && (
|
|
1751
|
+
const { value: L, message: V } = Fe(p);
|
|
1752
|
+
if (Ye(L) && !C.match(L) && (A[S] = {
|
|
1753
1753
|
type: be.pattern,
|
|
1754
1754
|
message: V,
|
|
1755
1755
|
ref: a,
|
|
1756
1756
|
...ne(be.pattern, V)
|
|
1757
1757
|
}, !r))
|
|
1758
|
-
return
|
|
1758
|
+
return x(V), A;
|
|
1759
1759
|
}
|
|
1760
|
-
if (
|
|
1761
|
-
if (he(
|
|
1762
|
-
const L = await
|
|
1763
|
-
if (V && (
|
|
1760
|
+
if (b) {
|
|
1761
|
+
if (he(b)) {
|
|
1762
|
+
const L = await b(C, s), V = Ut(L, F);
|
|
1763
|
+
if (V && (A[S] = {
|
|
1764
1764
|
...V,
|
|
1765
1765
|
...ne(be.validate, V.message)
|
|
1766
1766
|
}, !r))
|
|
1767
|
-
return
|
|
1768
|
-
} else if (H(
|
|
1767
|
+
return x(V.message), A;
|
|
1768
|
+
} else if (H(b)) {
|
|
1769
1769
|
let L = {};
|
|
1770
|
-
for (const V in
|
|
1770
|
+
for (const V in b) {
|
|
1771
1771
|
if (!se(L) && !r)
|
|
1772
1772
|
break;
|
|
1773
|
-
const q = Ut(await
|
|
1773
|
+
const q = Ut(await b[V](C, s), F, V);
|
|
1774
1774
|
q && (L = {
|
|
1775
1775
|
...q,
|
|
1776
1776
|
...ne(V, q.message)
|
|
1777
|
-
},
|
|
1777
|
+
}, x(q.message), r && (A[S] = L));
|
|
1778
1778
|
}
|
|
1779
|
-
if (!se(L) && (
|
|
1780
|
-
ref:
|
|
1779
|
+
if (!se(L) && (A[S] = {
|
|
1780
|
+
ref: F,
|
|
1781
1781
|
...L
|
|
1782
1782
|
}, !r))
|
|
1783
|
-
return
|
|
1783
|
+
return A;
|
|
1784
1784
|
}
|
|
1785
1785
|
}
|
|
1786
|
-
return
|
|
1786
|
+
return x(!0), A;
|
|
1787
1787
|
};
|
|
1788
1788
|
const Lr = {
|
|
1789
1789
|
mode: fe.onSubmit,
|
|
1790
1790
|
reValidateMode: fe.onChange,
|
|
1791
1791
|
shouldFocusError: !0
|
|
1792
1792
|
};
|
|
1793
|
-
function Dr(
|
|
1794
|
-
let
|
|
1793
|
+
function Dr(e = {}) {
|
|
1794
|
+
let t = {
|
|
1795
1795
|
...Lr,
|
|
1796
|
-
...
|
|
1796
|
+
...e
|
|
1797
1797
|
}, s = {
|
|
1798
1798
|
submitCount: 0,
|
|
1799
1799
|
isDirty: !1,
|
|
1800
1800
|
isReady: !1,
|
|
1801
|
-
isLoading: he(
|
|
1801
|
+
isLoading: he(t.defaultValues),
|
|
1802
1802
|
isValidating: !1,
|
|
1803
1803
|
isSubmitted: !1,
|
|
1804
1804
|
isSubmitting: !1,
|
|
@@ -1807,9 +1807,9 @@ function Dr(t = {}) {
|
|
|
1807
1807
|
touchedFields: {},
|
|
1808
1808
|
dirtyFields: {},
|
|
1809
1809
|
validatingFields: {},
|
|
1810
|
-
errors:
|
|
1811
|
-
disabled:
|
|
1812
|
-
}, r = {}, i = H(
|
|
1810
|
+
errors: t.errors || {},
|
|
1811
|
+
disabled: t.disabled || !1
|
|
1812
|
+
}, r = {}, i = H(t.defaultValues) || H(t.values) ? z(t.defaultValues || t.values) || {} : {}, n = t.shouldUnregister ? {} : z(i), a = {
|
|
1813
1813
|
action: !1,
|
|
1814
1814
|
mount: !1,
|
|
1815
1815
|
watch: !1
|
|
@@ -1819,8 +1819,8 @@ function Dr(t = {}) {
|
|
|
1819
1819
|
unMount: /* @__PURE__ */ new Set(),
|
|
1820
1820
|
array: /* @__PURE__ */ new Set(),
|
|
1821
1821
|
watch: /* @__PURE__ */ new Set()
|
|
1822
|
-
}, l,
|
|
1823
|
-
const
|
|
1822
|
+
}, l, m = 0;
|
|
1823
|
+
const f = {
|
|
1824
1824
|
isDirty: !1,
|
|
1825
1825
|
dirtyFields: !1,
|
|
1826
1826
|
validatingFields: !1,
|
|
@@ -1829,43 +1829,43 @@ function Dr(t = {}) {
|
|
|
1829
1829
|
isValid: !1,
|
|
1830
1830
|
errors: !1
|
|
1831
1831
|
};
|
|
1832
|
-
let
|
|
1833
|
-
...
|
|
1832
|
+
let h = {
|
|
1833
|
+
...f
|
|
1834
1834
|
};
|
|
1835
1835
|
const d = {
|
|
1836
|
-
array:
|
|
1837
|
-
state:
|
|
1838
|
-
}, p =
|
|
1839
|
-
clearTimeout(
|
|
1836
|
+
array: $t(),
|
|
1837
|
+
state: $t()
|
|
1838
|
+
}, p = t.criteriaMode === fe.all, b = (c) => (u) => {
|
|
1839
|
+
clearTimeout(m), m = setTimeout(c, u);
|
|
1840
1840
|
}, S = async (c) => {
|
|
1841
|
-
if (!
|
|
1842
|
-
const u =
|
|
1841
|
+
if (!t.disabled && (f.isValid || h.isValid || c)) {
|
|
1842
|
+
const u = t.resolver ? se((await O()).errors) : await P(r, !0);
|
|
1843
1843
|
u !== s.isValid && d.state.next({
|
|
1844
1844
|
isValid: u
|
|
1845
1845
|
});
|
|
1846
1846
|
}
|
|
1847
|
-
},
|
|
1848
|
-
!
|
|
1849
|
-
|
|
1847
|
+
}, E = (c, u) => {
|
|
1848
|
+
!t.disabled && (f.isValidating || f.validatingFields || h.isValidating || h.validatingFields) && ((c || Array.from(o.mount)).forEach((y) => {
|
|
1849
|
+
y && (u ? B(s.validatingFields, y, u) : j(s.validatingFields, y));
|
|
1850
1850
|
}), d.state.next({
|
|
1851
1851
|
validatingFields: s.validatingFields,
|
|
1852
1852
|
isValidating: !se(s.validatingFields)
|
|
1853
1853
|
}));
|
|
1854
|
-
},
|
|
1855
|
-
if (k &&
|
|
1856
|
-
if (a.action = !0,
|
|
1857
|
-
const _ =
|
|
1854
|
+
}, N = (c, u = [], y, k, v = !0, w = !0) => {
|
|
1855
|
+
if (k && y && !t.disabled) {
|
|
1856
|
+
if (a.action = !0, w && Array.isArray(T(r, c))) {
|
|
1857
|
+
const _ = y(T(r, c), k.argA, k.argB);
|
|
1858
1858
|
v && B(r, c, _);
|
|
1859
1859
|
}
|
|
1860
|
-
if (
|
|
1861
|
-
const _ =
|
|
1862
|
-
v && B(s.errors, c, _),
|
|
1860
|
+
if (w && Array.isArray(T(s.errors, c))) {
|
|
1861
|
+
const _ = y(T(s.errors, c), k.argA, k.argB);
|
|
1862
|
+
v && B(s.errors, c, _), Fr(s.errors, c);
|
|
1863
1863
|
}
|
|
1864
|
-
if ((
|
|
1865
|
-
const _ =
|
|
1864
|
+
if ((f.touchedFields || h.touchedFields) && w && Array.isArray(T(s.touchedFields, c))) {
|
|
1865
|
+
const _ = y(T(s.touchedFields, c), k.argA, k.argB);
|
|
1866
1866
|
v && B(s.touchedFields, c, _);
|
|
1867
1867
|
}
|
|
1868
|
-
(
|
|
1868
|
+
(f.dirtyFields || h.dirtyFields) && (s.dirtyFields = Re(i, n)), d.state.next({
|
|
1869
1869
|
name: c,
|
|
1870
1870
|
isDirty: ce(c, u),
|
|
1871
1871
|
dirtyFields: s.dirtyFields,
|
|
@@ -1878,41 +1878,41 @@ function Dr(t = {}) {
|
|
|
1878
1878
|
B(s.errors, c, u), d.state.next({
|
|
1879
1879
|
errors: s.errors
|
|
1880
1880
|
});
|
|
1881
|
-
},
|
|
1881
|
+
}, F = (c) => {
|
|
1882
1882
|
s.errors = c, d.state.next({
|
|
1883
1883
|
errors: s.errors,
|
|
1884
1884
|
isValid: !1
|
|
1885
1885
|
});
|
|
1886
|
-
},
|
|
1887
|
-
const v =
|
|
1886
|
+
}, x = (c, u, y, k) => {
|
|
1887
|
+
const v = T(r, c);
|
|
1888
1888
|
if (v) {
|
|
1889
|
-
const
|
|
1890
|
-
Q(
|
|
1889
|
+
const w = T(n, c, Q(y) ? T(i, c) : y);
|
|
1890
|
+
Q(w) || k && k.defaultChecked || u ? B(n, c, u ? w : Rt(v._f)) : q(c, w), a.mount && S();
|
|
1891
1891
|
}
|
|
1892
|
-
},
|
|
1893
|
-
let
|
|
1892
|
+
}, A = (c, u, y, k, v) => {
|
|
1893
|
+
let w = !1, _ = !1;
|
|
1894
1894
|
const M = {
|
|
1895
1895
|
name: c
|
|
1896
1896
|
};
|
|
1897
|
-
if (!
|
|
1898
|
-
if (!
|
|
1899
|
-
(
|
|
1900
|
-
const K = Se(
|
|
1901
|
-
_ = !!
|
|
1897
|
+
if (!t.disabled) {
|
|
1898
|
+
if (!y || k) {
|
|
1899
|
+
(f.isDirty || h.isDirty) && (_ = s.isDirty, s.isDirty = M.isDirty = ce(), w = _ !== M.isDirty);
|
|
1900
|
+
const K = Se(T(i, c), u);
|
|
1901
|
+
_ = !!T(s.dirtyFields, c), K ? j(s.dirtyFields, c) : B(s.dirtyFields, c, !0), M.dirtyFields = s.dirtyFields, w = w || (f.dirtyFields || h.dirtyFields) && _ !== !K;
|
|
1902
1902
|
}
|
|
1903
|
-
if (
|
|
1904
|
-
const K =
|
|
1905
|
-
K || (B(s.touchedFields, c,
|
|
1903
|
+
if (y) {
|
|
1904
|
+
const K = T(s.touchedFields, c);
|
|
1905
|
+
K || (B(s.touchedFields, c, y), M.touchedFields = s.touchedFields, w = w || (f.touchedFields || h.touchedFields) && K !== y);
|
|
1906
1906
|
}
|
|
1907
|
-
|
|
1907
|
+
w && v && d.state.next(M);
|
|
1908
1908
|
}
|
|
1909
|
-
return
|
|
1910
|
-
}, I = (c, u,
|
|
1911
|
-
const v =
|
|
1912
|
-
if (
|
|
1909
|
+
return w ? M : {};
|
|
1910
|
+
}, I = (c, u, y, k) => {
|
|
1911
|
+
const v = T(s.errors, c), w = (f.isValid || h.isValid) && ye(u) && s.isValid !== u;
|
|
1912
|
+
if (t.delayError && y ? (l = b(() => C(c, y)), l(t.delayError)) : (clearTimeout(m), l = null, y ? B(s.errors, c, y) : j(s.errors, c)), (y ? !Se(v, y) : v) || !se(k) || w) {
|
|
1913
1913
|
const _ = {
|
|
1914
1914
|
...k,
|
|
1915
|
-
...
|
|
1915
|
+
...w && ye(u) ? { isValid: u } : {},
|
|
1916
1916
|
errors: s.errors,
|
|
1917
1917
|
name: c
|
|
1918
1918
|
};
|
|
@@ -1922,142 +1922,142 @@ function Dr(t = {}) {
|
|
|
1922
1922
|
}, d.state.next(_);
|
|
1923
1923
|
}
|
|
1924
1924
|
}, O = async (c) => {
|
|
1925
|
-
|
|
1926
|
-
const u = await
|
|
1927
|
-
return
|
|
1925
|
+
E(c, !0);
|
|
1926
|
+
const u = await t.resolver(n, t.context, Er(c || o.mount, r, t.criteriaMode, t.shouldUseNativeValidation));
|
|
1927
|
+
return E(c), u;
|
|
1928
1928
|
}, re = async (c) => {
|
|
1929
1929
|
const { errors: u } = await O(c);
|
|
1930
1930
|
if (c)
|
|
1931
|
-
for (const
|
|
1932
|
-
const k =
|
|
1933
|
-
k ? B(s.errors,
|
|
1931
|
+
for (const y of c) {
|
|
1932
|
+
const k = T(u, y);
|
|
1933
|
+
k ? B(s.errors, y, k) : j(s.errors, y);
|
|
1934
1934
|
}
|
|
1935
1935
|
else
|
|
1936
1936
|
s.errors = u;
|
|
1937
1937
|
return u;
|
|
1938
|
-
}, P = async (c, u,
|
|
1938
|
+
}, P = async (c, u, y = {
|
|
1939
1939
|
valid: !0
|
|
1940
1940
|
}) => {
|
|
1941
1941
|
for (const k in c) {
|
|
1942
1942
|
const v = c[k];
|
|
1943
1943
|
if (v) {
|
|
1944
|
-
const { _f:
|
|
1945
|
-
if (
|
|
1946
|
-
const M = o.array.has(
|
|
1947
|
-
K &&
|
|
1948
|
-
const le = await Kt(v, o.disabled, n, p,
|
|
1949
|
-
if (K &&
|
|
1944
|
+
const { _f: w, ..._ } = v;
|
|
1945
|
+
if (w) {
|
|
1946
|
+
const M = o.array.has(w.name), K = v._f && _r(v._f);
|
|
1947
|
+
K && f.validatingFields && E([k], !0);
|
|
1948
|
+
const le = await Kt(v, o.disabled, n, p, t.shouldUseNativeValidation && !u, M);
|
|
1949
|
+
if (K && f.validatingFields && E([k]), le[w.name] && (y.valid = !1, u))
|
|
1950
1950
|
break;
|
|
1951
|
-
!u && (
|
|
1951
|
+
!u && (T(le, w.name) ? M ? $r(s.errors, le, w.name) : B(s.errors, w.name, le[w.name]) : j(s.errors, w.name));
|
|
1952
1952
|
}
|
|
1953
|
-
!se(_) && await P(_, u,
|
|
1953
|
+
!se(_) && await P(_, u, y);
|
|
1954
1954
|
}
|
|
1955
1955
|
}
|
|
1956
|
-
return
|
|
1956
|
+
return y.valid;
|
|
1957
1957
|
}, ne = () => {
|
|
1958
1958
|
for (const c of o.unMount) {
|
|
1959
|
-
const u =
|
|
1960
|
-
u && (u._f.refs ? u._f.refs.every((
|
|
1959
|
+
const u = T(r, c);
|
|
1960
|
+
u && (u._f.refs ? u._f.refs.every((y) => !ct(y)) : !ct(u._f.ref)) && tt(c);
|
|
1961
1961
|
}
|
|
1962
1962
|
o.unMount = /* @__PURE__ */ new Set();
|
|
1963
|
-
}, ce = (c, u) => !
|
|
1963
|
+
}, ce = (c, u) => !t.disabled && (c && u && B(n, c, u), !Se(de(), i)), L = (c, u, y) => wr(c, o, {
|
|
1964
1964
|
...a.mount ? n : Q(u) ? i : pe(c) ? { [c]: u } : u
|
|
1965
|
-
},
|
|
1966
|
-
const k =
|
|
1965
|
+
}, y, u), V = (c) => mt(T(a.mount ? n : i, c, t.shouldUnregister ? T(i, c, []) : [])), q = (c, u, y = {}) => {
|
|
1966
|
+
const k = T(r, c);
|
|
1967
1967
|
let v = u;
|
|
1968
1968
|
if (k) {
|
|
1969
|
-
const
|
|
1970
|
-
|
|
1969
|
+
const w = k._f;
|
|
1970
|
+
w && (!w.disabled && B(n, c, cs(u, w)), v = ze(w.ref) && te(u) ? "" : u, ns(w.ref) ? [...w.ref.options].forEach((_) => _.selected = v.includes(_.value)) : w.refs ? qe(w.ref) ? w.refs.forEach((_) => {
|
|
1971
1971
|
(!_.defaultChecked || !_.disabled) && (Array.isArray(v) ? _.checked = !!v.find((M) => M === _.value) : _.checked = v === _.value || !!v);
|
|
1972
|
-
}) :
|
|
1972
|
+
}) : w.refs.forEach((_) => _.checked = _.value === v) : gt(w.ref) ? w.ref.value = "" : (w.ref.value = v, w.ref.type || d.state.next({
|
|
1973
1973
|
name: c,
|
|
1974
1974
|
values: z(n)
|
|
1975
1975
|
})));
|
|
1976
1976
|
}
|
|
1977
|
-
(
|
|
1978
|
-
}, G = (c, u,
|
|
1977
|
+
(y.shouldDirty || y.shouldTouch) && A(c, v, y.shouldTouch, y.shouldDirty, !0), y.shouldValidate && ie(c);
|
|
1978
|
+
}, G = (c, u, y) => {
|
|
1979
1979
|
for (const k in u) {
|
|
1980
1980
|
if (!u.hasOwnProperty(k))
|
|
1981
1981
|
return;
|
|
1982
|
-
const v = u[k],
|
|
1983
|
-
(o.array.has(c) || H(v) || _ && !_._f) && !
|
|
1982
|
+
const v = u[k], w = c + "." + k, _ = T(r, w);
|
|
1983
|
+
(o.array.has(c) || H(v) || _ && !_._f) && !Ne(v) ? G(w, v, y) : q(w, v, y);
|
|
1984
1984
|
}
|
|
1985
|
-
}, Y = (c, u,
|
|
1986
|
-
const k =
|
|
1987
|
-
B(n, c,
|
|
1985
|
+
}, Y = (c, u, y = {}) => {
|
|
1986
|
+
const k = T(r, c), v = o.array.has(c), w = z(u);
|
|
1987
|
+
B(n, c, w), v ? (d.array.next({
|
|
1988
1988
|
name: c,
|
|
1989
1989
|
values: z(n)
|
|
1990
|
-
}), (
|
|
1990
|
+
}), (f.isDirty || f.dirtyFields || h.isDirty || h.dirtyFields) && y.shouldDirty && d.state.next({
|
|
1991
1991
|
name: c,
|
|
1992
1992
|
dirtyFields: Re(i, n),
|
|
1993
|
-
isDirty: ce(c,
|
|
1994
|
-
})) : k && !k._f && !te(
|
|
1993
|
+
isDirty: ce(c, w)
|
|
1994
|
+
})) : k && !k._f && !te(w) ? G(c, w, y) : q(c, w, y), Mt(c, o) && d.state.next({ ...s, name: c }), d.state.next({
|
|
1995
1995
|
name: a.mount ? c : void 0,
|
|
1996
1996
|
values: z(n)
|
|
1997
1997
|
});
|
|
1998
1998
|
}, U = async (c) => {
|
|
1999
1999
|
a.mount = !0;
|
|
2000
2000
|
const u = c.target;
|
|
2001
|
-
let
|
|
2002
|
-
const v =
|
|
2003
|
-
k = Number.isNaN(K) ||
|
|
2004
|
-
}, _ = It(
|
|
2001
|
+
let y = u.name, k = !0;
|
|
2002
|
+
const v = T(r, y), w = (K) => {
|
|
2003
|
+
k = Number.isNaN(K) || Ne(K) && isNaN(K.getTime()) || Se(K, T(n, y, K));
|
|
2004
|
+
}, _ = It(t.mode), M = It(t.reValidateMode);
|
|
2005
2005
|
if (v) {
|
|
2006
2006
|
let K, le;
|
|
2007
|
-
const We = u.type ? Rt(v._f) : fr(c), ve = c.type ===
|
|
2008
|
-
B(n,
|
|
2009
|
-
const it =
|
|
2007
|
+
const We = u.type ? Rt(v._f) : fr(c), ve = c.type === Ft.BLUR || c.type === Ft.FOCUS_OUT, ws = !Cr(v._f) && !t.resolver && !T(s.errors, y) && !v._f.deps || Ar(ve, T(s.touchedFields, y), s.isSubmitted, M, _), nt = Mt(y, o, ve);
|
|
2008
|
+
B(n, y, We), ve ? (v._f.onBlur && v._f.onBlur(c), l && l(0)) : v._f.onChange && v._f.onChange(c);
|
|
2009
|
+
const it = A(y, We, ve), vs = !se(it) || nt;
|
|
2010
2010
|
if (!ve && d.state.next({
|
|
2011
|
-
name:
|
|
2011
|
+
name: y,
|
|
2012
2012
|
type: c.type,
|
|
2013
2013
|
values: z(n)
|
|
2014
2014
|
}), ws)
|
|
2015
|
-
return (
|
|
2016
|
-
if (!ve && nt && d.state.next({ ...s }),
|
|
2017
|
-
const { errors: _t } = await O([
|
|
2018
|
-
if (
|
|
2019
|
-
const ks = Ot(s.errors, r,
|
|
2020
|
-
K = Ct.error,
|
|
2015
|
+
return (f.isValid || h.isValid) && (t.mode === "onBlur" ? ve && S() : ve || S()), vs && d.state.next({ name: y, ...nt ? {} : it });
|
|
2016
|
+
if (!ve && nt && d.state.next({ ...s }), t.resolver) {
|
|
2017
|
+
const { errors: _t } = await O([y]);
|
|
2018
|
+
if (w(We), k) {
|
|
2019
|
+
const ks = Ot(s.errors, r, y), Ct = Ot(_t, r, ks.name || y);
|
|
2020
|
+
K = Ct.error, y = Ct.name, le = se(_t);
|
|
2021
2021
|
}
|
|
2022
2022
|
} else
|
|
2023
|
-
|
|
2024
|
-
k && (v._f.deps && ie(v._f.deps), I(
|
|
2023
|
+
E([y], !0), K = (await Kt(v, o.disabled, n, p, t.shouldUseNativeValidation))[y], E([y]), w(We), k && (K ? le = !1 : (f.isValid || h.isValid) && (le = await P(r, !0)));
|
|
2024
|
+
k && (v._f.deps && ie(v._f.deps), I(y, le, K, it));
|
|
2025
2025
|
}
|
|
2026
2026
|
}, Z = (c, u) => {
|
|
2027
|
-
if (
|
|
2027
|
+
if (T(s.errors, u) && c.focus)
|
|
2028
2028
|
return c.focus(), 1;
|
|
2029
2029
|
}, ie = async (c, u = {}) => {
|
|
2030
|
-
let
|
|
2030
|
+
let y, k;
|
|
2031
2031
|
const v = Pe(c);
|
|
2032
|
-
if (
|
|
2033
|
-
const
|
|
2034
|
-
|
|
2035
|
-
} else c ? (k = (await Promise.all(v.map(async (
|
|
2036
|
-
const _ =
|
|
2037
|
-
return await P(_ && _._f ? { [
|
|
2038
|
-
}))).every(Boolean), !(!k && !s.isValid) && S()) : k =
|
|
2032
|
+
if (t.resolver) {
|
|
2033
|
+
const w = await re(Q(c) ? c : v);
|
|
2034
|
+
y = se(w), k = c ? !v.some((_) => T(w, _)) : y;
|
|
2035
|
+
} else c ? (k = (await Promise.all(v.map(async (w) => {
|
|
2036
|
+
const _ = T(r, w);
|
|
2037
|
+
return await P(_ && _._f ? { [w]: _ } : _);
|
|
2038
|
+
}))).every(Boolean), !(!k && !s.isValid) && S()) : k = y = await P(r);
|
|
2039
2039
|
return d.state.next({
|
|
2040
|
-
...!pe(c) || (
|
|
2041
|
-
...
|
|
2040
|
+
...!pe(c) || (f.isValid || h.isValid) && y !== s.isValid ? {} : { name: c },
|
|
2041
|
+
...t.resolver || !c ? { isValid: y } : {},
|
|
2042
2042
|
errors: s.errors
|
|
2043
2043
|
}), u.shouldFocus && !k && Me(r, Z, c ? v : o.mount), k;
|
|
2044
2044
|
}, de = (c) => {
|
|
2045
2045
|
const u = {
|
|
2046
2046
|
...a.mount ? n : i
|
|
2047
2047
|
};
|
|
2048
|
-
return Q(c) ? u : pe(c) ?
|
|
2048
|
+
return Q(c) ? u : pe(c) ? T(u, c) : c.map((y) => T(u, y));
|
|
2049
2049
|
}, He = (c, u) => ({
|
|
2050
|
-
invalid: !!
|
|
2051
|
-
isDirty: !!
|
|
2052
|
-
error:
|
|
2053
|
-
isValidating: !!
|
|
2054
|
-
isTouched: !!
|
|
2050
|
+
invalid: !!T((u || s).errors, c),
|
|
2051
|
+
isDirty: !!T((u || s).dirtyFields, c),
|
|
2052
|
+
error: T((u || s).errors, c),
|
|
2053
|
+
isValidating: !!T(s.validatingFields, c),
|
|
2054
|
+
isTouched: !!T((u || s).touchedFields, c)
|
|
2055
2055
|
}), _e = (c) => {
|
|
2056
2056
|
c && Pe(c).forEach((u) => j(s.errors, u)), d.state.next({
|
|
2057
2057
|
errors: c ? s.errors : {}
|
|
2058
2058
|
});
|
|
2059
|
-
}, bt = (c, u,
|
|
2060
|
-
const k = (
|
|
2059
|
+
}, bt = (c, u, y) => {
|
|
2060
|
+
const k = (T(r, c, { _f: {} })._f || {}).ref, v = T(s.errors, c) || {}, { ref: w, message: _, type: M, ...K } = v;
|
|
2061
2061
|
B(s.errors, c, {
|
|
2062
2062
|
...K,
|
|
2063
2063
|
...u,
|
|
@@ -2066,27 +2066,27 @@ function Dr(t = {}) {
|
|
|
2066
2066
|
name: c,
|
|
2067
2067
|
errors: s.errors,
|
|
2068
2068
|
isValid: !1
|
|
2069
|
-
}),
|
|
2069
|
+
}), y && y.shouldFocus && k && k.focus && k.focus();
|
|
2070
2070
|
}, hs = (c, u) => he(c) ? d.state.subscribe({
|
|
2071
|
-
next: (
|
|
2071
|
+
next: (y) => "values" in y && c(L(void 0, u), y)
|
|
2072
2072
|
}) : L(c, u, !0), wt = (c) => d.state.subscribe({
|
|
2073
2073
|
next: (u) => {
|
|
2074
|
-
|
|
2074
|
+
xr(c.name, u.name, c.exact) && Nr(u, c.formState || f, bs, c.reRenderRoot) && c.callback({
|
|
2075
2075
|
values: { ...n },
|
|
2076
2076
|
...s,
|
|
2077
2077
|
...u,
|
|
2078
2078
|
defaultValues: i
|
|
2079
2079
|
});
|
|
2080
2080
|
}
|
|
2081
|
-
}).unsubscribe, ms = (c) => (a.mount = !0,
|
|
2082
|
-
...
|
|
2081
|
+
}).unsubscribe, ms = (c) => (a.mount = !0, h = {
|
|
2082
|
+
...h,
|
|
2083
2083
|
...c.formState
|
|
2084
2084
|
}, wt({
|
|
2085
2085
|
...c,
|
|
2086
|
-
formState:
|
|
2086
|
+
formState: h
|
|
2087
2087
|
})), tt = (c, u = {}) => {
|
|
2088
|
-
for (const
|
|
2089
|
-
o.mount.delete(
|
|
2088
|
+
for (const y of c ? Pe(c) : o.mount)
|
|
2089
|
+
o.mount.delete(y), o.array.delete(y), u.keepValue || (j(r, y), j(n, y)), !u.keepError && j(s.errors, y), !u.keepDirty && j(s.dirtyFields, y), !u.keepTouched && j(s.touchedFields, y), !u.keepIsValidating && j(s.validatingFields, y), !t.shouldUnregister && !u.keepDefaultValue && j(i, y);
|
|
2090
2090
|
d.state.next({
|
|
2091
2091
|
values: z(n)
|
|
2092
2092
|
}), d.state.next({
|
|
@@ -2096,22 +2096,22 @@ function Dr(t = {}) {
|
|
|
2096
2096
|
}, vt = ({ disabled: c, name: u }) => {
|
|
2097
2097
|
(ye(c) && a.mount || c || o.disabled.has(u)) && (c ? o.disabled.add(u) : o.disabled.delete(u));
|
|
2098
2098
|
}, st = (c, u = {}) => {
|
|
2099
|
-
let
|
|
2100
|
-
const k = ye(u.disabled) || ye(
|
|
2099
|
+
let y = T(r, c);
|
|
2100
|
+
const k = ye(u.disabled) || ye(t.disabled);
|
|
2101
2101
|
return B(r, c, {
|
|
2102
|
-
...
|
|
2102
|
+
...y || {},
|
|
2103
2103
|
_f: {
|
|
2104
|
-
...
|
|
2104
|
+
...y && y._f ? y._f : { ref: { name: c } },
|
|
2105
2105
|
name: c,
|
|
2106
2106
|
mount: !0,
|
|
2107
2107
|
...u
|
|
2108
2108
|
}
|
|
2109
|
-
}), o.mount.add(c),
|
|
2110
|
-
disabled: ye(u.disabled) ? u.disabled :
|
|
2109
|
+
}), o.mount.add(c), y ? vt({
|
|
2110
|
+
disabled: ye(u.disabled) ? u.disabled : t.disabled,
|
|
2111
2111
|
name: c
|
|
2112
|
-
}) :
|
|
2113
|
-
...k ? { disabled: u.disabled ||
|
|
2114
|
-
...
|
|
2112
|
+
}) : x(c, !0, u.value), {
|
|
2113
|
+
...k ? { disabled: u.disabled || t.disabled } : {},
|
|
2114
|
+
...t.progressive ? {
|
|
2115
2115
|
required: !!u.required,
|
|
2116
2116
|
min: Ie(u.min),
|
|
2117
2117
|
max: Ie(u.max),
|
|
@@ -2124,59 +2124,59 @@ function Dr(t = {}) {
|
|
|
2124
2124
|
onBlur: U,
|
|
2125
2125
|
ref: (v) => {
|
|
2126
2126
|
if (v) {
|
|
2127
|
-
st(c, u),
|
|
2128
|
-
const
|
|
2129
|
-
if (_ ? M.find((K) => K ===
|
|
2127
|
+
st(c, u), y = T(r, c);
|
|
2128
|
+
const w = Q(v.value) && v.querySelectorAll && v.querySelectorAll("input,select,textarea")[0] || v, _ = kr(w), M = y._f.refs || [];
|
|
2129
|
+
if (_ ? M.find((K) => K === w) : w === y._f.ref)
|
|
2130
2130
|
return;
|
|
2131
2131
|
B(r, c, {
|
|
2132
2132
|
_f: {
|
|
2133
|
-
...
|
|
2133
|
+
...y._f,
|
|
2134
2134
|
..._ ? {
|
|
2135
2135
|
refs: [
|
|
2136
2136
|
...M.filter(ct),
|
|
2137
|
-
|
|
2138
|
-
...Array.isArray(
|
|
2137
|
+
w,
|
|
2138
|
+
...Array.isArray(T(i, c)) ? [{}] : []
|
|
2139
2139
|
],
|
|
2140
|
-
ref: { type:
|
|
2141
|
-
} : { ref:
|
|
2140
|
+
ref: { type: w.type, name: c }
|
|
2141
|
+
} : { ref: w }
|
|
2142
2142
|
}
|
|
2143
|
-
}),
|
|
2143
|
+
}), x(c, !1, void 0, w);
|
|
2144
2144
|
} else
|
|
2145
|
-
|
|
2145
|
+
y = T(r, c, {}), y._f && (y._f.mount = !1), (t.shouldUnregister || u.shouldUnregister) && !(mr(o.array, c) && a.action) && o.unMount.add(c);
|
|
2146
2146
|
}
|
|
2147
2147
|
};
|
|
2148
|
-
}, rt = () =>
|
|
2149
|
-
ye(c) && (d.state.next({ disabled: c }), Me(r, (u,
|
|
2150
|
-
const k =
|
|
2148
|
+
}, rt = () => t.shouldFocusError && Me(r, Z, o.mount), ys = (c) => {
|
|
2149
|
+
ye(c) && (d.state.next({ disabled: c }), Me(r, (u, y) => {
|
|
2150
|
+
const k = T(r, y);
|
|
2151
2151
|
k && (u.disabled = k._f.disabled || c, Array.isArray(k._f.refs) && k._f.refs.forEach((v) => {
|
|
2152
2152
|
v.disabled = k._f.disabled || c;
|
|
2153
2153
|
}));
|
|
2154
2154
|
}, 0, !1));
|
|
2155
|
-
}, kt = (c, u) => async (
|
|
2155
|
+
}, kt = (c, u) => async (y) => {
|
|
2156
2156
|
let k;
|
|
2157
|
-
|
|
2157
|
+
y && (y.preventDefault && y.preventDefault(), y.persist && y.persist());
|
|
2158
2158
|
let v = z(n);
|
|
2159
2159
|
if (d.state.next({
|
|
2160
2160
|
isSubmitting: !0
|
|
2161
|
-
}),
|
|
2162
|
-
const { errors:
|
|
2163
|
-
s.errors =
|
|
2161
|
+
}), t.resolver) {
|
|
2162
|
+
const { errors: w, values: _ } = await O();
|
|
2163
|
+
s.errors = w, v = z(_);
|
|
2164
2164
|
} else
|
|
2165
2165
|
await P(r);
|
|
2166
2166
|
if (o.disabled.size)
|
|
2167
|
-
for (const
|
|
2168
|
-
j(v,
|
|
2167
|
+
for (const w of o.disabled)
|
|
2168
|
+
j(v, w);
|
|
2169
2169
|
if (j(s.errors, "root"), se(s.errors)) {
|
|
2170
2170
|
d.state.next({
|
|
2171
2171
|
errors: {}
|
|
2172
2172
|
});
|
|
2173
2173
|
try {
|
|
2174
|
-
await c(v,
|
|
2175
|
-
} catch (
|
|
2176
|
-
k =
|
|
2174
|
+
await c(v, y);
|
|
2175
|
+
} catch (w) {
|
|
2176
|
+
k = w;
|
|
2177
2177
|
}
|
|
2178
2178
|
} else
|
|
2179
|
-
u && await u({ ...s.errors },
|
|
2179
|
+
u && await u({ ...s.errors }, y), rt(), setTimeout(rt);
|
|
2180
2180
|
if (d.state.next({
|
|
2181
2181
|
isSubmitted: !0,
|
|
2182
2182
|
isSubmitting: !1,
|
|
@@ -2186,21 +2186,21 @@ function Dr(t = {}) {
|
|
|
2186
2186
|
}), k)
|
|
2187
2187
|
throw k;
|
|
2188
2188
|
}, gs = (c, u = {}) => {
|
|
2189
|
-
|
|
2189
|
+
T(r, c) && (Q(u.defaultValue) ? Y(c, z(T(i, c))) : (Y(c, u.defaultValue), B(i, c, z(u.defaultValue))), u.keepTouched || j(s.touchedFields, c), u.keepDirty || (j(s.dirtyFields, c), s.isDirty = u.defaultValue ? ce(c, z(T(i, c))) : ce()), u.keepError || (j(s.errors, c), f.isValid && S()), d.state.next({ ...s }));
|
|
2190
2190
|
}, St = (c, u = {}) => {
|
|
2191
|
-
const
|
|
2192
|
-
if (u.keepDefaultValues || (i =
|
|
2191
|
+
const y = c ? z(c) : i, k = z(y), v = se(c), w = v ? i : k;
|
|
2192
|
+
if (u.keepDefaultValues || (i = y), !u.keepValues) {
|
|
2193
2193
|
if (u.keepDirtyValues) {
|
|
2194
2194
|
const _ = /* @__PURE__ */ new Set([
|
|
2195
2195
|
...o.mount,
|
|
2196
2196
|
...Object.keys(Re(i, n))
|
|
2197
2197
|
]);
|
|
2198
2198
|
for (const M of Array.from(_))
|
|
2199
|
-
|
|
2199
|
+
T(s.dirtyFields, M) ? B(w, M, T(n, M)) : Y(M, T(w, M));
|
|
2200
2200
|
} else {
|
|
2201
2201
|
if (ht && Q(c))
|
|
2202
2202
|
for (const _ of o.mount) {
|
|
2203
|
-
const M =
|
|
2203
|
+
const M = T(r, _);
|
|
2204
2204
|
if (M && M._f) {
|
|
2205
2205
|
const K = Array.isArray(M._f.refs) ? M._f.refs[0] : M._f.ref;
|
|
2206
2206
|
if (ze(K)) {
|
|
@@ -2214,14 +2214,14 @@ function Dr(t = {}) {
|
|
|
2214
2214
|
}
|
|
2215
2215
|
if (u.keepFieldsRef)
|
|
2216
2216
|
for (const _ of o.mount)
|
|
2217
|
-
Y(_,
|
|
2217
|
+
Y(_, T(w, _));
|
|
2218
2218
|
else
|
|
2219
2219
|
r = {};
|
|
2220
2220
|
}
|
|
2221
|
-
n =
|
|
2222
|
-
values: { ...
|
|
2221
|
+
n = t.shouldUnregister ? u.keepDefaultValues ? z(i) : {} : z(w), d.array.next({
|
|
2222
|
+
values: { ...w }
|
|
2223
2223
|
}), d.state.next({
|
|
2224
|
-
values: { ...
|
|
2224
|
+
values: { ...w }
|
|
2225
2225
|
});
|
|
2226
2226
|
}
|
|
2227
2227
|
o = {
|
|
@@ -2232,7 +2232,7 @@ function Dr(t = {}) {
|
|
|
2232
2232
|
watch: /* @__PURE__ */ new Set(),
|
|
2233
2233
|
watchAll: !1,
|
|
2234
2234
|
focus: ""
|
|
2235
|
-
}, a.mount = !
|
|
2235
|
+
}, a.mount = !f.isValid || !!u.keepIsValid || !!u.keepDirtyValues, a.watch = !!t.shouldUnregister, d.state.next({
|
|
2236
2236
|
submitCount: u.keepSubmitCount ? s.submitCount : 0,
|
|
2237
2237
|
isDirty: v ? !1 : u.keepDirty ? s.isDirty : !!(u.keepDefaultValues && !Se(c, i)),
|
|
2238
2238
|
isSubmitted: u.keepIsSubmitted ? s.isSubmitted : !1,
|
|
@@ -2242,8 +2242,8 @@ function Dr(t = {}) {
|
|
|
2242
2242
|
isSubmitSuccessful: u.keepIsSubmitSuccessful ? s.isSubmitSuccessful : !1,
|
|
2243
2243
|
isSubmitting: !1
|
|
2244
2244
|
});
|
|
2245
|
-
},
|
|
2246
|
-
const
|
|
2245
|
+
}, Tt = (c, u) => St(he(c) ? c(n) : c, u), ps = (c, u = {}) => {
|
|
2246
|
+
const y = T(r, c), k = y && y._f;
|
|
2247
2247
|
if (k) {
|
|
2248
2248
|
const v = k.refs ? k.refs[0] : k.ref;
|
|
2249
2249
|
v.focus && (v.focus(), u.shouldSelect && he(v.select) && v.select());
|
|
@@ -2253,7 +2253,7 @@ function Dr(t = {}) {
|
|
|
2253
2253
|
...s,
|
|
2254
2254
|
...c
|
|
2255
2255
|
};
|
|
2256
|
-
},
|
|
2256
|
+
}, Et = {
|
|
2257
2257
|
control: {
|
|
2258
2258
|
register: st,
|
|
2259
2259
|
unregister: tt,
|
|
@@ -2266,20 +2266,20 @@ function Dr(t = {}) {
|
|
|
2266
2266
|
_getWatch: L,
|
|
2267
2267
|
_getDirty: ce,
|
|
2268
2268
|
_setValid: S,
|
|
2269
|
-
_setFieldArray:
|
|
2269
|
+
_setFieldArray: N,
|
|
2270
2270
|
_setDisabledField: vt,
|
|
2271
|
-
_setErrors:
|
|
2271
|
+
_setErrors: F,
|
|
2272
2272
|
_getFieldArray: V,
|
|
2273
2273
|
_reset: St,
|
|
2274
|
-
_resetDefaultValues: () => he(
|
|
2275
|
-
|
|
2274
|
+
_resetDefaultValues: () => he(t.defaultValues) && t.defaultValues().then((c) => {
|
|
2275
|
+
Tt(c, t.resetOptions), d.state.next({
|
|
2276
2276
|
isLoading: !1
|
|
2277
2277
|
});
|
|
2278
2278
|
}),
|
|
2279
2279
|
_removeUnmounted: ne,
|
|
2280
2280
|
_disableForm: ys,
|
|
2281
2281
|
_subjects: d,
|
|
2282
|
-
_proxyFormState:
|
|
2282
|
+
_proxyFormState: f,
|
|
2283
2283
|
get _fields() {
|
|
2284
2284
|
return r;
|
|
2285
2285
|
},
|
|
@@ -2305,11 +2305,11 @@ function Dr(t = {}) {
|
|
|
2305
2305
|
return s;
|
|
2306
2306
|
},
|
|
2307
2307
|
get _options() {
|
|
2308
|
-
return
|
|
2308
|
+
return t;
|
|
2309
2309
|
},
|
|
2310
2310
|
set _options(c) {
|
|
2311
|
-
|
|
2312
|
-
...
|
|
2311
|
+
t = {
|
|
2312
|
+
...t,
|
|
2313
2313
|
...c
|
|
2314
2314
|
};
|
|
2315
2315
|
}
|
|
@@ -2321,7 +2321,7 @@ function Dr(t = {}) {
|
|
|
2321
2321
|
watch: hs,
|
|
2322
2322
|
setValue: Y,
|
|
2323
2323
|
getValues: de,
|
|
2324
|
-
reset:
|
|
2324
|
+
reset: Tt,
|
|
2325
2325
|
resetField: gs,
|
|
2326
2326
|
clearErrors: _e,
|
|
2327
2327
|
unregister: tt,
|
|
@@ -2330,15 +2330,15 @@ function Dr(t = {}) {
|
|
|
2330
2330
|
getFieldState: He
|
|
2331
2331
|
};
|
|
2332
2332
|
return {
|
|
2333
|
-
...
|
|
2334
|
-
formControl:
|
|
2333
|
+
...Et,
|
|
2334
|
+
formControl: Et
|
|
2335
2335
|
};
|
|
2336
2336
|
}
|
|
2337
|
-
function us(
|
|
2338
|
-
const
|
|
2337
|
+
function us(e = {}) {
|
|
2338
|
+
const t = ae.useRef(void 0), s = ae.useRef(void 0), [r, i] = ae.useState({
|
|
2339
2339
|
isDirty: !1,
|
|
2340
2340
|
isValidating: !1,
|
|
2341
|
-
isLoading: he(
|
|
2341
|
+
isLoading: he(e.defaultValues),
|
|
2342
2342
|
isSubmitted: !1,
|
|
2343
2343
|
isSubmitting: !1,
|
|
2344
2344
|
isSubmitSuccessful: !1,
|
|
@@ -2347,26 +2347,26 @@ function us(t = {}) {
|
|
|
2347
2347
|
dirtyFields: {},
|
|
2348
2348
|
touchedFields: {},
|
|
2349
2349
|
validatingFields: {},
|
|
2350
|
-
errors:
|
|
2351
|
-
disabled:
|
|
2350
|
+
errors: e.errors || {},
|
|
2351
|
+
disabled: e.disabled || !1,
|
|
2352
2352
|
isReady: !1,
|
|
2353
|
-
defaultValues: he(
|
|
2353
|
+
defaultValues: he(e.defaultValues) ? void 0 : e.defaultValues
|
|
2354
2354
|
});
|
|
2355
|
-
if (!
|
|
2356
|
-
if (
|
|
2357
|
-
|
|
2358
|
-
...
|
|
2355
|
+
if (!t.current)
|
|
2356
|
+
if (e.formControl)
|
|
2357
|
+
t.current = {
|
|
2358
|
+
...e.formControl,
|
|
2359
2359
|
formState: r
|
|
2360
|
-
},
|
|
2360
|
+
}, e.defaultValues && !he(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
2361
2361
|
else {
|
|
2362
|
-
const { formControl: a, ...o } = Dr(
|
|
2363
|
-
|
|
2362
|
+
const { formControl: a, ...o } = Dr(e);
|
|
2363
|
+
t.current = {
|
|
2364
2364
|
...o,
|
|
2365
2365
|
formState: r
|
|
2366
2366
|
};
|
|
2367
2367
|
}
|
|
2368
|
-
const n =
|
|
2369
|
-
return n._options =
|
|
2368
|
+
const n = t.current.control;
|
|
2369
|
+
return n._options = e, br(() => {
|
|
2370
2370
|
const a = n._subscribe({
|
|
2371
2371
|
formState: n._proxyFormState,
|
|
2372
2372
|
callback: () => i({ ...n._formState }),
|
|
@@ -2376,15 +2376,15 @@ function us(t = {}) {
|
|
|
2376
2376
|
...o,
|
|
2377
2377
|
isReady: !0
|
|
2378
2378
|
})), n._formState.isReady = !0, a;
|
|
2379
|
-
}, [n]), ae.useEffect(() => n._disableForm(
|
|
2380
|
-
|
|
2381
|
-
}, [n,
|
|
2382
|
-
|
|
2383
|
-
}, [n,
|
|
2384
|
-
|
|
2379
|
+
}, [n]), ae.useEffect(() => n._disableForm(e.disabled), [n, e.disabled]), ae.useEffect(() => {
|
|
2380
|
+
e.mode && (n._options.mode = e.mode), e.reValidateMode && (n._options.reValidateMode = e.reValidateMode);
|
|
2381
|
+
}, [n, e.mode, e.reValidateMode]), ae.useEffect(() => {
|
|
2382
|
+
e.errors && (n._setErrors(e.errors), n._focusError());
|
|
2383
|
+
}, [n, e.errors]), ae.useEffect(() => {
|
|
2384
|
+
e.shouldUnregister && n._subjects.state.next({
|
|
2385
2385
|
values: n._getWatch()
|
|
2386
2386
|
});
|
|
2387
|
-
}, [n,
|
|
2387
|
+
}, [n, e.shouldUnregister]), ae.useEffect(() => {
|
|
2388
2388
|
if (n._proxyFormState.isDirty) {
|
|
2389
2389
|
const a = n._getDirty();
|
|
2390
2390
|
a !== r.isDirty && n._subjects.state.next({
|
|
@@ -2392,47 +2392,47 @@ function us(t = {}) {
|
|
|
2392
2392
|
});
|
|
2393
2393
|
}
|
|
2394
2394
|
}, [n, r.isDirty]), ae.useEffect(() => {
|
|
2395
|
-
|
|
2395
|
+
e.values && !Se(e.values, s.current) ? (n._reset(e.values, {
|
|
2396
2396
|
keepFieldsRef: !0,
|
|
2397
2397
|
...n._options.resetOptions
|
|
2398
|
-
}), s.current =
|
|
2399
|
-
}, [n,
|
|
2398
|
+
}), s.current = e.values, i((a) => ({ ...a }))) : n._resetDefaultValues();
|
|
2399
|
+
}, [n, e.values]), ae.useEffect(() => {
|
|
2400
2400
|
n._state.mount || (n._setValid(), n._state.mount = !0), n._state.watch && (n._state.watch = !1, n._subjects.state.next({ ...n._formState })), n._removeUnmounted();
|
|
2401
|
-
}),
|
|
2401
|
+
}), t.current.formState = pr(r, n), t.current;
|
|
2402
2402
|
}
|
|
2403
|
-
const
|
|
2404
|
-
const { t
|
|
2403
|
+
const Nn = (e) => {
|
|
2404
|
+
const { t } = R(), { showStackNotifications: s, showSuccessNotification: r } = Ae(), {
|
|
2405
2405
|
defaultValues: i,
|
|
2406
2406
|
mutationFn: n,
|
|
2407
2407
|
formToDto: a,
|
|
2408
2408
|
onError: o,
|
|
2409
2409
|
onSuccess: l,
|
|
2410
|
-
queryKey:
|
|
2411
|
-
onSuccessMessage:
|
|
2412
|
-
} =
|
|
2410
|
+
queryKey: m,
|
|
2411
|
+
onSuccessMessage: f
|
|
2412
|
+
} = e, { control: h, handleSubmit: d, reset: p, setError: b, getValues: S, setValue: E } = us({
|
|
2413
2413
|
defaultValues: i
|
|
2414
|
-
}),
|
|
2415
|
-
(
|
|
2416
|
-
const
|
|
2417
|
-
return
|
|
2414
|
+
}), N = D(
|
|
2415
|
+
(x) => {
|
|
2416
|
+
const A = x == null ? void 0 : x.errors, I = [];
|
|
2417
|
+
return A && A.forEach(([O, re]) => {
|
|
2418
2418
|
const P = document.querySelector(`[name="${O}"]`);
|
|
2419
|
-
(P instanceof HTMLInputElement || P instanceof HTMLTextAreaElement || P instanceof HTMLSelectElement) && (P.focus(), P.classList.add("error"), I.push(
|
|
2419
|
+
(P instanceof HTMLInputElement || P instanceof HTMLTextAreaElement || P instanceof HTMLSelectElement) && (P.focus(), P.classList.add("error"), I.push(t(`_entities:${m}.${O}.${re}`)));
|
|
2420
2420
|
}), I;
|
|
2421
2421
|
},
|
|
2422
|
-
[
|
|
2422
|
+
[t, m]
|
|
2423
2423
|
), C = D(() => {
|
|
2424
|
-
document.querySelectorAll("input, textarea, select").forEach((
|
|
2425
|
-
|
|
2424
|
+
document.querySelectorAll("input, textarea, select").forEach((A) => {
|
|
2425
|
+
A.classList.remove("error");
|
|
2426
2426
|
});
|
|
2427
|
-
}, []),
|
|
2427
|
+
}, []), F = Ke(
|
|
2428
2428
|
{
|
|
2429
2429
|
mutationFn: n,
|
|
2430
|
-
onError: (
|
|
2431
|
-
console.error(
|
|
2432
|
-
const
|
|
2433
|
-
if (o) o(
|
|
2434
|
-
else if (Xe(
|
|
2435
|
-
const I =
|
|
2430
|
+
onError: (x) => {
|
|
2431
|
+
console.error(x);
|
|
2432
|
+
const A = x;
|
|
2433
|
+
if (o) o(x);
|
|
2434
|
+
else if (Xe(A)) {
|
|
2435
|
+
const I = N(A);
|
|
2436
2436
|
s(
|
|
2437
2437
|
I.map(
|
|
2438
2438
|
(O) => ({
|
|
@@ -2441,8 +2441,8 @@ const xn = (t) => {
|
|
|
2441
2441
|
})
|
|
2442
2442
|
)
|
|
2443
2443
|
);
|
|
2444
|
-
} else if (Ze(
|
|
2445
|
-
const I =
|
|
2444
|
+
} else if (Ze(A)) {
|
|
2445
|
+
const I = A.message || t("_accessibility:errors.500"), O = t(`_accessibility:errors.${A.status}`);
|
|
2446
2446
|
s([
|
|
2447
2447
|
{
|
|
2448
2448
|
message: O || I,
|
|
@@ -2451,118 +2451,118 @@ const xn = (t) => {
|
|
|
2451
2451
|
]);
|
|
2452
2452
|
}
|
|
2453
2453
|
},
|
|
2454
|
-
onSuccess: async (
|
|
2455
|
-
we && await we.invalidateQueries({ queryKey:
|
|
2456
|
-
message:
|
|
2454
|
+
onSuccess: async (x) => {
|
|
2455
|
+
we && await we.invalidateQueries({ queryKey: m }), l && l(x), f && r({
|
|
2456
|
+
message: f
|
|
2457
2457
|
});
|
|
2458
2458
|
}
|
|
2459
2459
|
}
|
|
2460
2460
|
);
|
|
2461
2461
|
return {
|
|
2462
|
-
control:
|
|
2462
|
+
control: h,
|
|
2463
2463
|
getValues: S,
|
|
2464
|
-
setValue:
|
|
2464
|
+
setValue: E,
|
|
2465
2465
|
handleSubmit: d,
|
|
2466
|
-
onSubmit: (
|
|
2467
|
-
C(),
|
|
2468
|
-
a ? a(
|
|
2466
|
+
onSubmit: (x) => {
|
|
2467
|
+
C(), F.mutate(
|
|
2468
|
+
a ? a(x) : x
|
|
2469
2469
|
);
|
|
2470
2470
|
},
|
|
2471
2471
|
reset: p,
|
|
2472
|
-
setError:
|
|
2473
|
-
isLoading:
|
|
2472
|
+
setError: b,
|
|
2473
|
+
isLoading: F.isPending
|
|
2474
2474
|
};
|
|
2475
|
-
}, Vr = (
|
|
2476
|
-
const { t
|
|
2475
|
+
}, Vr = (e) => {
|
|
2476
|
+
const { t } = R(), {
|
|
2477
2477
|
onClick: s,
|
|
2478
2478
|
icon: r = Os,
|
|
2479
2479
|
sticky: i = !0,
|
|
2480
2480
|
hidden: n = !1,
|
|
2481
2481
|
multiple: a = !0,
|
|
2482
2482
|
disabled: o = !1,
|
|
2483
|
-
id: l =
|
|
2484
|
-
tooltip:
|
|
2485
|
-
} =
|
|
2483
|
+
id: l = Ee.Delete,
|
|
2484
|
+
tooltip: m = t("_pages:common.actions.delete.text")
|
|
2485
|
+
} = e;
|
|
2486
2486
|
return {
|
|
2487
2487
|
action: D(
|
|
2488
|
-
(
|
|
2488
|
+
(h) => ({
|
|
2489
2489
|
id: l,
|
|
2490
2490
|
sticky: i,
|
|
2491
|
-
tooltip:
|
|
2491
|
+
tooltip: m,
|
|
2492
2492
|
multiple: a,
|
|
2493
|
-
onClick: () => s([
|
|
2494
|
-
hidden: !!
|
|
2495
|
-
disabled: !!
|
|
2493
|
+
onClick: () => s([h == null ? void 0 : h.id]),
|
|
2494
|
+
hidden: !!h.deletedAt || n,
|
|
2495
|
+
disabled: !!h.deletedAt || o,
|
|
2496
2496
|
icon: /* @__PURE__ */ g(ue, { className: "text-bg-error", icon: r }),
|
|
2497
2497
|
onMultipleClick: (d) => s(d.map((p) => p.id))
|
|
2498
2498
|
}),
|
|
2499
|
-
[o, n, r, l, a, s, i,
|
|
2499
|
+
[o, n, r, l, a, s, i, m]
|
|
2500
2500
|
)
|
|
2501
2501
|
};
|
|
2502
|
-
}, Rr = (
|
|
2503
|
-
const { t
|
|
2502
|
+
}, Rr = (e) => {
|
|
2503
|
+
const { t } = R(), {
|
|
2504
2504
|
onClick: s,
|
|
2505
2505
|
sticky: r = !0,
|
|
2506
2506
|
hidden: i = !1,
|
|
2507
2507
|
disabled: n = !1,
|
|
2508
2508
|
multiple: a = !1,
|
|
2509
2509
|
icon: o = Wt,
|
|
2510
|
-
id: l =
|
|
2511
|
-
tooltip:
|
|
2512
|
-
} =
|
|
2510
|
+
id: l = Ee.Restore,
|
|
2511
|
+
tooltip: m = t("_pages:common.actions.restore.text")
|
|
2512
|
+
} = e;
|
|
2513
2513
|
return {
|
|
2514
2514
|
action: D(
|
|
2515
|
-
(
|
|
2515
|
+
(h) => ({
|
|
2516
2516
|
id: l,
|
|
2517
2517
|
sticky: r,
|
|
2518
|
-
tooltip:
|
|
2518
|
+
tooltip: m,
|
|
2519
2519
|
multiple: a,
|
|
2520
|
-
onClick: () => s([
|
|
2521
|
-
hidden: !
|
|
2522
|
-
disabled: !
|
|
2520
|
+
onClick: () => s([h == null ? void 0 : h.id]),
|
|
2521
|
+
hidden: !h.deletedAt || i,
|
|
2522
|
+
disabled: !h.deletedAt || n,
|
|
2523
2523
|
icon: /* @__PURE__ */ g(ue, { className: "text-bg-error", icon: o }),
|
|
2524
2524
|
onMultipleClick: (d) => s(d.map((p) => p.id))
|
|
2525
2525
|
}),
|
|
2526
|
-
[n, i, o, l, a, s, r,
|
|
2526
|
+
[n, i, o, l, a, s, r, m]
|
|
2527
2527
|
)
|
|
2528
2528
|
};
|
|
2529
|
-
},
|
|
2530
|
-
const { t
|
|
2529
|
+
}, xn = (e) => {
|
|
2530
|
+
const { t } = R(), {
|
|
2531
2531
|
onClick: s,
|
|
2532
2532
|
hidden: r = !1,
|
|
2533
2533
|
sticky: i = !0,
|
|
2534
2534
|
disabled: n = !1,
|
|
2535
|
-
id: a =
|
|
2535
|
+
id: a = Ee.Edit,
|
|
2536
2536
|
icon: o = Us,
|
|
2537
|
-
tooltip: l =
|
|
2538
|
-
} =
|
|
2537
|
+
tooltip: l = t("_pages:common.actions.edit.text")
|
|
2538
|
+
} = e;
|
|
2539
2539
|
return {
|
|
2540
2540
|
action: D(
|
|
2541
|
-
(
|
|
2541
|
+
(f) => ({
|
|
2542
2542
|
id: a,
|
|
2543
2543
|
sticky: i,
|
|
2544
2544
|
tooltip: l,
|
|
2545
|
-
onClick: () => s(
|
|
2546
|
-
hidden: !!
|
|
2547
|
-
disabled: !!
|
|
2545
|
+
onClick: () => s(f == null ? void 0 : f.id),
|
|
2546
|
+
hidden: !!f.deletedAt || r,
|
|
2547
|
+
disabled: !!f.deletedAt || n,
|
|
2548
2548
|
icon: /* @__PURE__ */ g(ue, { className: "primary", icon: o })
|
|
2549
2549
|
}),
|
|
2550
2550
|
[n, r, o, a, s, i, l]
|
|
2551
2551
|
)
|
|
2552
2552
|
};
|
|
2553
2553
|
};
|
|
2554
|
-
var
|
|
2555
|
-
const Ir = (
|
|
2556
|
-
const { t
|
|
2554
|
+
var Ee = /* @__PURE__ */ ((e) => (e.Add = "add", e.Edit = "edit", e.Delete = "delete", e.Restore = "restore", e.Refresh = "refresh", e.Export = "export", e.Import = "import", e))(Ee || {});
|
|
2555
|
+
const Ir = (e) => {
|
|
2556
|
+
const { t } = R(), {
|
|
2557
2557
|
onClick: s,
|
|
2558
2558
|
hidden: r = !1,
|
|
2559
2559
|
disabled: i = !1,
|
|
2560
2560
|
isLoading: n = !1
|
|
2561
|
-
} =
|
|
2561
|
+
} = e;
|
|
2562
2562
|
return {
|
|
2563
2563
|
action: D(
|
|
2564
2564
|
() => ({
|
|
2565
|
-
id:
|
|
2565
|
+
id: Ee.Export,
|
|
2566
2566
|
hidden: r,
|
|
2567
2567
|
disabled: i,
|
|
2568
2568
|
icon: /* @__PURE__ */ g(
|
|
@@ -2572,23 +2572,23 @@ const Ir = (t) => {
|
|
|
2572
2572
|
icon: n ? jt : Ks
|
|
2573
2573
|
}
|
|
2574
2574
|
),
|
|
2575
|
-
tooltip:
|
|
2575
|
+
tooltip: t("_pages:common.actions.export.text"),
|
|
2576
2576
|
onClick: s
|
|
2577
2577
|
}),
|
|
2578
|
-
[i, r, n, s,
|
|
2578
|
+
[i, r, n, s, t]
|
|
2579
2579
|
)
|
|
2580
2580
|
};
|
|
2581
|
-
}, Pr = (
|
|
2582
|
-
const { t
|
|
2581
|
+
}, Pr = (e) => {
|
|
2582
|
+
const { t } = R(), {
|
|
2583
2583
|
onClick: s,
|
|
2584
2584
|
hidden: r = !1,
|
|
2585
2585
|
disabled: i = !1,
|
|
2586
2586
|
isLoading: n = !1
|
|
2587
|
-
} =
|
|
2587
|
+
} = e;
|
|
2588
2588
|
return {
|
|
2589
2589
|
action: D(
|
|
2590
2590
|
() => ({
|
|
2591
|
-
id:
|
|
2591
|
+
id: Ee.Import,
|
|
2592
2592
|
hidden: r,
|
|
2593
2593
|
disabled: i,
|
|
2594
2594
|
icon: /* @__PURE__ */ g(
|
|
@@ -2598,70 +2598,70 @@ const Ir = (t) => {
|
|
|
2598
2598
|
icon: n ? jt : Bs
|
|
2599
2599
|
}
|
|
2600
2600
|
),
|
|
2601
|
-
tooltip:
|
|
2601
|
+
tooltip: t("_pages:common.actions.import.text"),
|
|
2602
2602
|
onClick: s
|
|
2603
2603
|
}),
|
|
2604
|
-
[i, r, n, s,
|
|
2604
|
+
[i, r, n, s, t]
|
|
2605
2605
|
)
|
|
2606
2606
|
};
|
|
2607
|
-
},
|
|
2608
|
-
const { queryKey:
|
|
2607
|
+
}, An = (e) => {
|
|
2608
|
+
const { queryKey: t, onSuccess: s, ...r } = e, { showStackNotifications: i } = Ae(), { t: n } = R(), { open: a, onClick: o, close: l, dialogFn: m, isLoading: f } = ss({
|
|
2609
2609
|
onSuccessMessage: n("_pages:common.actions.delete.successMessage"),
|
|
2610
2610
|
onError: (d) => {
|
|
2611
2611
|
const p = d;
|
|
2612
2612
|
if (Xe(p))
|
|
2613
2613
|
i(
|
|
2614
2614
|
p.errors.map(
|
|
2615
|
-
([
|
|
2616
|
-
message: n(`_pages:${
|
|
2615
|
+
([b, S]) => ({
|
|
2616
|
+
message: n(`_pages:${b}.errors.${S}`),
|
|
2617
2617
|
type: J.error
|
|
2618
2618
|
})
|
|
2619
2619
|
)
|
|
2620
2620
|
);
|
|
2621
2621
|
else if (Ze(p)) {
|
|
2622
|
-
const
|
|
2622
|
+
const b = p.message || n("_accessibility:errors.500"), S = n(`_accessibility:errors.${p.status}`);
|
|
2623
2623
|
i([
|
|
2624
2624
|
{
|
|
2625
|
-
message: S ||
|
|
2625
|
+
message: S || b,
|
|
2626
2626
|
type: J.error
|
|
2627
2627
|
}
|
|
2628
2628
|
]);
|
|
2629
2629
|
}
|
|
2630
2630
|
},
|
|
2631
2631
|
onSuccess: async (d) => {
|
|
2632
|
-
await we.invalidateQueries({ queryKey:
|
|
2632
|
+
await we.invalidateQueries({ queryKey: t }), s && s(d);
|
|
2633
2633
|
},
|
|
2634
2634
|
...r
|
|
2635
|
-
}), { action:
|
|
2635
|
+
}), { action: h } = Vr({ onClick: o });
|
|
2636
2636
|
return {
|
|
2637
2637
|
onClick: o,
|
|
2638
2638
|
title: n("_pages:common.actions.delete.dialog.title"),
|
|
2639
2639
|
open: a,
|
|
2640
|
-
isLoading:
|
|
2641
|
-
handleSubmit: () =>
|
|
2640
|
+
isLoading: f,
|
|
2641
|
+
handleSubmit: () => m.mutate(),
|
|
2642
2642
|
handleClose: l,
|
|
2643
|
-
action:
|
|
2643
|
+
action: h
|
|
2644
2644
|
};
|
|
2645
2645
|
}, ds = () => {
|
|
2646
|
-
const [
|
|
2647
|
-
return { open:
|
|
2648
|
-
},
|
|
2649
|
-
const { t
|
|
2646
|
+
const [e, t] = X(!1);
|
|
2647
|
+
return { open: e, setOpen: t, handleClose: () => t(!1), handleOpen: () => t(!0) };
|
|
2648
|
+
}, Fn = (e) => {
|
|
2649
|
+
const { t } = R(), {
|
|
2650
2650
|
showErrorNotification: s,
|
|
2651
2651
|
showStackNotifications: r,
|
|
2652
2652
|
showSuccessNotification: i
|
|
2653
|
-
} =
|
|
2653
|
+
} = Ae(), {
|
|
2654
2654
|
defaultValues: n,
|
|
2655
2655
|
getFunction: a,
|
|
2656
2656
|
mutationFn: o,
|
|
2657
2657
|
formToDto: l,
|
|
2658
|
-
dtoToForm:
|
|
2659
|
-
onError:
|
|
2660
|
-
onSuccess:
|
|
2658
|
+
dtoToForm: m,
|
|
2659
|
+
onError: f,
|
|
2660
|
+
onSuccess: h,
|
|
2661
2661
|
queryKey: d,
|
|
2662
2662
|
onSuccessMessage: p,
|
|
2663
|
-
title:
|
|
2664
|
-
} =
|
|
2663
|
+
title: b
|
|
2664
|
+
} = e, [S, E] = X(0), { open: N, handleClose: C, handleOpen: F } = ds(), { control: x, handleSubmit: A, reset: I, setError: O, getValues: re, setValue: P } = us({
|
|
2665
2665
|
defaultValues: n
|
|
2666
2666
|
}), { data: ne, isLoading: ce } = Xs({
|
|
2667
2667
|
queryFn: () => a == null ? void 0 : a(S),
|
|
@@ -2669,32 +2669,32 @@ const Ir = (t) => {
|
|
|
2669
2669
|
enabled: !!a && !!d && !!S
|
|
2670
2670
|
});
|
|
2671
2671
|
me(() => {
|
|
2672
|
-
ne &&
|
|
2672
|
+
ne && m && I({ ...m(ne) });
|
|
2673
2673
|
}, [ne]);
|
|
2674
2674
|
const L = D(
|
|
2675
2675
|
(U) => {
|
|
2676
2676
|
const Z = U == null ? void 0 : U.errors, ie = [];
|
|
2677
2677
|
return Z && Z.forEach(([de, He]) => {
|
|
2678
2678
|
const _e = document.querySelector(`[name="${de}"]`);
|
|
2679
|
-
(_e instanceof HTMLInputElement || _e instanceof HTMLTextAreaElement || _e instanceof HTMLSelectElement) && (_e.focus(), _e.classList.add("error"), ie.push(
|
|
2679
|
+
(_e instanceof HTMLInputElement || _e instanceof HTMLTextAreaElement || _e instanceof HTMLSelectElement) && (_e.focus(), _e.classList.add("error"), ie.push(t(`_entities:${d}.${de}.${He}`)));
|
|
2680
2680
|
}), ie;
|
|
2681
2681
|
},
|
|
2682
|
-
[
|
|
2682
|
+
[t, d]
|
|
2683
2683
|
), V = D(() => {
|
|
2684
2684
|
document.querySelectorAll("input, textarea, select").forEach((Z) => {
|
|
2685
2685
|
Z.classList.remove("error");
|
|
2686
2686
|
});
|
|
2687
2687
|
}, []), q = D(
|
|
2688
2688
|
(U) => {
|
|
2689
|
-
|
|
2689
|
+
E(U ?? 0), F();
|
|
2690
2690
|
},
|
|
2691
|
-
[
|
|
2691
|
+
[F]
|
|
2692
2692
|
), G = D(() => {
|
|
2693
2693
|
V(), C(), I();
|
|
2694
2694
|
}, [I, V, C]), Y = Ke({
|
|
2695
2695
|
mutationFn: o,
|
|
2696
2696
|
onError: (U) => {
|
|
2697
|
-
if (console.error(U),
|
|
2697
|
+
if (console.error(U), f) f(U);
|
|
2698
2698
|
else {
|
|
2699
2699
|
const Z = U;
|
|
2700
2700
|
if (Xe(Z)) {
|
|
@@ -2708,75 +2708,75 @@ const Ir = (t) => {
|
|
|
2708
2708
|
)
|
|
2709
2709
|
);
|
|
2710
2710
|
} else if (Ze(Z)) {
|
|
2711
|
-
const ie = Z.message ||
|
|
2711
|
+
const ie = Z.message || t("_accessibility:errors.500"), de = t(`_accessibility:errors.${Z.status}`);
|
|
2712
2712
|
s({ message: de || ie });
|
|
2713
2713
|
} else
|
|
2714
|
-
s({ message:
|
|
2714
|
+
s({ message: t("_accessibility:errors.500") });
|
|
2715
2715
|
}
|
|
2716
2716
|
},
|
|
2717
2717
|
onSuccess: async (U) => {
|
|
2718
|
-
await we.invalidateQueries({ queryKey: d }),
|
|
2718
|
+
await we.invalidateQueries({ queryKey: d }), h && h(U), i({
|
|
2719
2719
|
message: p
|
|
2720
2720
|
}), G();
|
|
2721
2721
|
}
|
|
2722
2722
|
});
|
|
2723
2723
|
return {
|
|
2724
|
-
open:
|
|
2724
|
+
open: N,
|
|
2725
2725
|
openDialog: q,
|
|
2726
2726
|
handleClose: G,
|
|
2727
|
-
control:
|
|
2727
|
+
control: x,
|
|
2728
2728
|
getValues: re,
|
|
2729
2729
|
setValue: P,
|
|
2730
|
-
handleSubmit:
|
|
2730
|
+
handleSubmit: A,
|
|
2731
2731
|
onSubmit: (U) => Y.mutate(
|
|
2732
2732
|
l ? l(U) : U
|
|
2733
2733
|
),
|
|
2734
2734
|
reset: I,
|
|
2735
2735
|
setError: O,
|
|
2736
|
-
title:
|
|
2736
|
+
title: b,
|
|
2737
2737
|
isLoading: ce || Y.isPending
|
|
2738
2738
|
};
|
|
2739
|
-
},
|
|
2740
|
-
const { queryKey:
|
|
2739
|
+
}, $n = (e) => {
|
|
2740
|
+
const { queryKey: t, onSuccess: s, ...r } = e, { showStackNotifications: i } = Ae(), { t: n } = R(), { open: a, onClick: o, close: l, dialogFn: m, isLoading: f } = ss({
|
|
2741
2741
|
onSuccessMessage: n("_pages:common.actions.restore.successMessage"),
|
|
2742
2742
|
onError: (d) => {
|
|
2743
2743
|
const p = d;
|
|
2744
2744
|
if (Xe(p))
|
|
2745
2745
|
i(
|
|
2746
2746
|
p.errors.map(
|
|
2747
|
-
([
|
|
2748
|
-
message: n(`_pages:${
|
|
2747
|
+
([b, S]) => ({
|
|
2748
|
+
message: n(`_pages:${b}.errors.${S}`),
|
|
2749
2749
|
type: J.error
|
|
2750
2750
|
})
|
|
2751
2751
|
)
|
|
2752
2752
|
);
|
|
2753
2753
|
else if (Ze(p)) {
|
|
2754
|
-
const
|
|
2754
|
+
const b = p.message || n("_accessibility:errors.500"), S = n(`_accessibility:errors.${p.status}`);
|
|
2755
2755
|
i([
|
|
2756
2756
|
{
|
|
2757
|
-
message: S ||
|
|
2757
|
+
message: S || b,
|
|
2758
2758
|
type: J.error
|
|
2759
2759
|
}
|
|
2760
2760
|
]);
|
|
2761
2761
|
}
|
|
2762
2762
|
},
|
|
2763
2763
|
onSuccess: async (d) => {
|
|
2764
|
-
await we.invalidateQueries({ queryKey:
|
|
2764
|
+
await we.invalidateQueries({ queryKey: t }), s && s(d);
|
|
2765
2765
|
},
|
|
2766
2766
|
...r
|
|
2767
|
-
}), { action:
|
|
2767
|
+
}), { action: h } = Rr({ onClick: o });
|
|
2768
2768
|
return {
|
|
2769
2769
|
onClick: o,
|
|
2770
2770
|
title: n("_pages:common.actions.restore.dialog.title"),
|
|
2771
2771
|
open: a,
|
|
2772
|
-
isLoading:
|
|
2773
|
-
handleSubmit: () =>
|
|
2772
|
+
isLoading: f,
|
|
2773
|
+
handleSubmit: () => m.mutate(),
|
|
2774
2774
|
handleClose: l,
|
|
2775
|
-
action:
|
|
2775
|
+
action: h
|
|
2776
2776
|
};
|
|
2777
2777
|
};
|
|
2778
|
-
function Ln(
|
|
2779
|
-
const { t
|
|
2778
|
+
function Ln(e) {
|
|
2779
|
+
const { t } = R(), { queryKey: s, mutationFn: r, entity: i, fileProcessor: n, onError: a } = e, [o, l] = X(!1), [m, f] = X(null), [h, d] = X(!1), p = Ke({
|
|
2780
2780
|
mutationFn: r,
|
|
2781
2781
|
onError: (S) => {
|
|
2782
2782
|
console.error(S), a == null || a(S);
|
|
@@ -2784,92 +2784,92 @@ function Ln(t) {
|
|
|
2784
2784
|
onSuccess: async () => {
|
|
2785
2785
|
we && await we.invalidateQueries({ queryKey: s });
|
|
2786
2786
|
}
|
|
2787
|
-
}), { action:
|
|
2787
|
+
}), { action: b } = Pr({
|
|
2788
2788
|
onClick: () => l(!0)
|
|
2789
2789
|
});
|
|
2790
2790
|
return {
|
|
2791
2791
|
handleSubmit: async () => {
|
|
2792
|
-
if (!(!
|
|
2792
|
+
if (!(!m || m.length === 0))
|
|
2793
2793
|
try {
|
|
2794
2794
|
await p.mutateAsync({
|
|
2795
|
-
items:
|
|
2796
|
-
override:
|
|
2797
|
-
}), l(!1),
|
|
2795
|
+
items: m,
|
|
2796
|
+
override: h
|
|
2797
|
+
}), l(!1), f(null), d(!1);
|
|
2798
2798
|
} catch (S) {
|
|
2799
2799
|
console.error(S);
|
|
2800
2800
|
}
|
|
2801
2801
|
},
|
|
2802
2802
|
isLoading: p.isPending,
|
|
2803
2803
|
fileProcessor: n,
|
|
2804
|
-
onFileProcessed: (S) =>
|
|
2804
|
+
onFileProcessed: (S) => f(S),
|
|
2805
2805
|
onOverrideChange: (S) => d(S),
|
|
2806
2806
|
open: o,
|
|
2807
|
-
title:
|
|
2808
|
-
entity:
|
|
2807
|
+
title: t("_pages:common.actions.import.dialog.title", {
|
|
2808
|
+
entity: t(`_pages:${i}.title`)
|
|
2809
2809
|
}),
|
|
2810
2810
|
handleClose: () => {
|
|
2811
|
-
l(!1),
|
|
2811
|
+
l(!1), f(null);
|
|
2812
2812
|
},
|
|
2813
|
-
action:
|
|
2813
|
+
action: b
|
|
2814
2814
|
};
|
|
2815
2815
|
}
|
|
2816
|
-
const Dn = (
|
|
2817
|
-
const { showSuccessNotification:
|
|
2816
|
+
const Dn = (e) => {
|
|
2817
|
+
const { showSuccessNotification: t } = Ae(), { t: s } = R(), {
|
|
2818
2818
|
entity: r,
|
|
2819
2819
|
mutationFn: i,
|
|
2820
2820
|
onError: n,
|
|
2821
2821
|
onSuccess: a,
|
|
2822
2822
|
onSuccessMessage: o = s("_pages:common.actions.export.successMessage")
|
|
2823
|
-
} =
|
|
2823
|
+
} = e, l = Ke({
|
|
2824
2824
|
mutationFn: () => i(),
|
|
2825
|
-
onError: (
|
|
2826
|
-
console.error(
|
|
2825
|
+
onError: (h) => {
|
|
2826
|
+
console.error(h), n && n(h);
|
|
2827
2827
|
},
|
|
2828
|
-
onSuccess: async (
|
|
2829
|
-
const d = JSON.stringify(
|
|
2830
|
-
S.href =
|
|
2828
|
+
onSuccess: async (h) => {
|
|
2829
|
+
const d = JSON.stringify(h, null, 2), p = new Blob([d], { type: "application/json" }), b = URL.createObjectURL(p), S = document.createElement("a");
|
|
2830
|
+
S.href = b, S.download = `${r}.json`, S.click(), URL.revokeObjectURL(b), a && a(h), t({
|
|
2831
2831
|
message: o
|
|
2832
2832
|
});
|
|
2833
2833
|
}
|
|
2834
|
-
}),
|
|
2834
|
+
}), m = D(() => {
|
|
2835
2835
|
l.mutate();
|
|
2836
|
-
}, [l]), { action:
|
|
2837
|
-
onClick:
|
|
2836
|
+
}, [l]), { action: f } = Ir({
|
|
2837
|
+
onClick: m,
|
|
2838
2838
|
isLoading: l.isPending
|
|
2839
2839
|
});
|
|
2840
2840
|
return {
|
|
2841
|
-
action:
|
|
2841
|
+
action: f
|
|
2842
2842
|
};
|
|
2843
2843
|
};
|
|
2844
|
-
function Mr(
|
|
2845
|
-
const [
|
|
2846
|
-
const i = window.scrollY >
|
|
2844
|
+
function Mr(e) {
|
|
2845
|
+
const [t, s] = X(!1), r = D(() => {
|
|
2846
|
+
const i = window.scrollY > e;
|
|
2847
2847
|
s(i);
|
|
2848
|
-
}, [
|
|
2848
|
+
}, [e]);
|
|
2849
2849
|
return me(() => (window.addEventListener("scroll", r), () => {
|
|
2850
2850
|
window.removeEventListener("scroll", r);
|
|
2851
|
-
}), [r]),
|
|
2851
|
+
}), [r]), t;
|
|
2852
2852
|
}
|
|
2853
2853
|
const Vn = () => {
|
|
2854
|
-
const { t } = R(),
|
|
2854
|
+
const { t: e } = R(), t = Mr(200);
|
|
2855
2855
|
return /* @__PURE__ */ g(
|
|
2856
|
-
|
|
2856
|
+
Te,
|
|
2857
2857
|
{
|
|
2858
2858
|
variant: "submit",
|
|
2859
2859
|
color: "primary",
|
|
2860
2860
|
icon: qs,
|
|
2861
2861
|
"data-tooltip-id": "tooltip",
|
|
2862
2862
|
onClick: () => dr.scrollTo(0, 0),
|
|
2863
|
-
className: `to-top ${
|
|
2864
|
-
"data-tooltip-content":
|
|
2863
|
+
className: `to-top ${t ? "show" : "hide"}`,
|
|
2864
|
+
"data-tooltip-content": e("_accessibility:buttons.toTop")
|
|
2865
2865
|
}
|
|
2866
2866
|
);
|
|
2867
2867
|
};
|
|
2868
|
-
function Rn(
|
|
2869
|
-
const { t
|
|
2870
|
-
if ("children" in
|
|
2871
|
-
const { children:
|
|
2872
|
-
return /* @__PURE__ */ g("div", { className: `error-container${
|
|
2868
|
+
function Rn(e) {
|
|
2869
|
+
const { t } = R();
|
|
2870
|
+
if ("children" in e) {
|
|
2871
|
+
const { children: x, className: A } = e;
|
|
2872
|
+
return /* @__PURE__ */ g("div", { className: `error-container${A ? ` ${A}` : ""}`, children: x });
|
|
2873
2873
|
}
|
|
2874
2874
|
const {
|
|
2875
2875
|
error: r,
|
|
@@ -2878,17 +2878,17 @@ function Rn(t) {
|
|
|
2878
2878
|
onRetry: a,
|
|
2879
2879
|
retryLabel: o,
|
|
2880
2880
|
retryButtonProps: l,
|
|
2881
|
-
messageProps:
|
|
2882
|
-
className:
|
|
2883
|
-
resetErrorBoundary:
|
|
2884
|
-
} =
|
|
2881
|
+
messageProps: m,
|
|
2882
|
+
className: f,
|
|
2883
|
+
resetErrorBoundary: h
|
|
2884
|
+
} = e, d = a ?? h, {
|
|
2885
2885
|
className: p,
|
|
2886
|
-
children:
|
|
2886
|
+
children: b,
|
|
2887
2887
|
onClick: S,
|
|
2888
|
-
...
|
|
2889
|
-
} = l ?? {}, { className:
|
|
2890
|
-
return /* @__PURE__ */
|
|
2891
|
-
|
|
2888
|
+
...E
|
|
2889
|
+
} = l ?? {}, { className: N, ...C } = m ?? {}, F = n !== null;
|
|
2890
|
+
return /* @__PURE__ */ $("div", { className: `error-container${f ? ` ${f}` : ""}`, children: [
|
|
2891
|
+
F && /* @__PURE__ */ g(
|
|
2892
2892
|
ue,
|
|
2893
2893
|
{
|
|
2894
2894
|
...n,
|
|
@@ -2900,8 +2900,8 @@ function Rn(t) {
|
|
|
2900
2900
|
"p",
|
|
2901
2901
|
{
|
|
2902
2902
|
...C,
|
|
2903
|
-
className: `error-message${
|
|
2904
|
-
children: i ?? (r == null ? void 0 : r.message) ??
|
|
2903
|
+
className: `error-message${N ? ` ${N}` : ""}`,
|
|
2904
|
+
children: i ?? (r == null ? void 0 : r.message) ?? t("_accessibility:errors.unknownError")
|
|
2905
2905
|
}
|
|
2906
2906
|
),
|
|
2907
2907
|
d && /* @__PURE__ */ g(
|
|
@@ -2910,22 +2910,22 @@ function Rn(t) {
|
|
|
2910
2910
|
type: "button",
|
|
2911
2911
|
variant: "submit",
|
|
2912
2912
|
color: "primary",
|
|
2913
|
-
...
|
|
2913
|
+
...E,
|
|
2914
2914
|
className: `error-retry ${p ? ` ${p}` : ""}`,
|
|
2915
|
-
onClick: (
|
|
2916
|
-
S == null || S(
|
|
2915
|
+
onClick: (x) => {
|
|
2916
|
+
S == null || S(x), x.defaultPrevented || d();
|
|
2917
2917
|
},
|
|
2918
|
-
children:
|
|
2918
|
+
children: b ?? o ?? t("_accessibility:actions.retry", { defaultValue: "Retry" })
|
|
2919
2919
|
}
|
|
2920
2920
|
)
|
|
2921
2921
|
] });
|
|
2922
2922
|
}
|
|
2923
|
-
const Or = (
|
|
2924
|
-
const { showBackButton:
|
|
2925
|
-
return /* @__PURE__ */
|
|
2926
|
-
/* @__PURE__ */
|
|
2927
|
-
|
|
2928
|
-
|
|
2923
|
+
const Or = (e) => {
|
|
2924
|
+
const { showBackButton: t, title: s, actions: r } = e, { t: i } = R(), { navigate: n } = Be();
|
|
2925
|
+
return /* @__PURE__ */ $("div", { className: "page-header", children: [
|
|
2926
|
+
/* @__PURE__ */ $("div", { className: "page-header-left", children: [
|
|
2927
|
+
t && /* @__PURE__ */ g(
|
|
2928
|
+
Te,
|
|
2929
2929
|
{
|
|
2930
2930
|
icon: Hs,
|
|
2931
2931
|
onClick: () => n(-1),
|
|
@@ -2936,14 +2936,14 @@ const Or = (t) => {
|
|
|
2936
2936
|
),
|
|
2937
2937
|
/* @__PURE__ */ g("h2", { className: "page-header-title", children: s })
|
|
2938
2938
|
] }),
|
|
2939
|
-
/* @__PURE__ */
|
|
2940
|
-
/* @__PURE__ */ g(
|
|
2939
|
+
/* @__PURE__ */ $("div", { children: [
|
|
2940
|
+
/* @__PURE__ */ g($s, { className: "page-header-actions-desktop", actions: r ?? [] }),
|
|
2941
2941
|
/* @__PURE__ */ g(Ls, { className: "page-header-actions-mobile", actions: r ?? [] })
|
|
2942
2942
|
] })
|
|
2943
2943
|
] });
|
|
2944
|
-
}, In = (
|
|
2944
|
+
}, In = (e) => {
|
|
2945
2945
|
const {
|
|
2946
|
-
title:
|
|
2946
|
+
title: t,
|
|
2947
2947
|
children: s,
|
|
2948
2948
|
addOptions: r,
|
|
2949
2949
|
filterOptions: i,
|
|
@@ -2951,57 +2951,57 @@ const Or = (t) => {
|
|
|
2951
2951
|
queryKey: a,
|
|
2952
2952
|
isLoading: o = !1,
|
|
2953
2953
|
isAnimated: l = !0,
|
|
2954
|
-
showBackButton:
|
|
2955
|
-
} =
|
|
2954
|
+
showBackButton: m = !1
|
|
2955
|
+
} = e, { t: f } = R(), { countOfFilters: h } = Ds(), d = xe(() => {
|
|
2956
2956
|
const p = Array.isArray(n) ? [...n] : [];
|
|
2957
2957
|
if (a) {
|
|
2958
|
-
const
|
|
2959
|
-
id:
|
|
2958
|
+
const b = {
|
|
2959
|
+
id: Ee.Refresh,
|
|
2960
2960
|
onClick: () => we.invalidateQueries({ queryKey: a }),
|
|
2961
2961
|
icon: /* @__PURE__ */ g(ue, { icon: Wt }),
|
|
2962
|
-
tooltip:
|
|
2962
|
+
tooltip: f("_pages:common.actions.refresh.text")
|
|
2963
2963
|
};
|
|
2964
|
-
p.unshift(
|
|
2964
|
+
p.unshift(b);
|
|
2965
2965
|
}
|
|
2966
2966
|
if (r) {
|
|
2967
|
-
const
|
|
2967
|
+
const b = {
|
|
2968
2968
|
...r,
|
|
2969
|
-
id:
|
|
2970
|
-
icon: /* @__PURE__ */ g(ue, { icon:
|
|
2969
|
+
id: Ee.Add,
|
|
2970
|
+
icon: /* @__PURE__ */ g(ue, { icon: Nt })
|
|
2971
2971
|
};
|
|
2972
|
-
p.unshift(
|
|
2972
|
+
p.unshift(b);
|
|
2973
2973
|
}
|
|
2974
2974
|
if (i) {
|
|
2975
|
-
const
|
|
2975
|
+
const b = {
|
|
2976
2976
|
...i,
|
|
2977
2977
|
id: "filter",
|
|
2978
2978
|
icon: /* @__PURE__ */ g(ue, { icon: Ws }),
|
|
2979
2979
|
children: /* @__PURE__ */ g(
|
|
2980
2980
|
Vs,
|
|
2981
2981
|
{
|
|
2982
|
-
className: `${
|
|
2983
|
-
count:
|
|
2982
|
+
className: `${h > 0 ? "show" : "hide"} `,
|
|
2983
|
+
count: h
|
|
2984
2984
|
}
|
|
2985
2985
|
)
|
|
2986
2986
|
};
|
|
2987
|
-
p.push(
|
|
2987
|
+
p.push(b);
|
|
2988
2988
|
}
|
|
2989
2989
|
return p;
|
|
2990
|
-
}, [n, r,
|
|
2991
|
-
return /* @__PURE__ */
|
|
2990
|
+
}, [n, r, h, i, a, f]);
|
|
2991
|
+
return /* @__PURE__ */ $("main", { className: "page-main", children: [
|
|
2992
2992
|
/* @__PURE__ */ g(
|
|
2993
2993
|
Or,
|
|
2994
2994
|
{
|
|
2995
|
-
showBackButton:
|
|
2995
|
+
showBackButton: m,
|
|
2996
2996
|
actions: d,
|
|
2997
|
-
title:
|
|
2997
|
+
title: t
|
|
2998
2998
|
}
|
|
2999
2999
|
),
|
|
3000
3000
|
/* @__PURE__ */ g("div", { className: `page-main-content ${l ? "appear" : ""}`, children: o ? /* @__PURE__ */ g(Le, { className: "page-loading" }) : s }),
|
|
3001
3001
|
r && /* @__PURE__ */ g(
|
|
3002
|
-
|
|
3002
|
+
Te,
|
|
3003
3003
|
{
|
|
3004
|
-
icon: r.icon ??
|
|
3004
|
+
icon: r.icon ?? Nt,
|
|
3005
3005
|
color: r.color ?? "primary",
|
|
3006
3006
|
variant: r.variant ?? "submit",
|
|
3007
3007
|
onClick: () => {
|
|
@@ -3012,17 +3012,17 @@ const Or = (t) => {
|
|
|
3012
3012
|
}
|
|
3013
3013
|
)
|
|
3014
3014
|
] });
|
|
3015
|
-
}, Pn = (
|
|
3016
|
-
const { t
|
|
3015
|
+
}, Pn = (e) => {
|
|
3016
|
+
const { t } = R(), {
|
|
3017
3017
|
className: s = "",
|
|
3018
3018
|
itemClassName: r = "",
|
|
3019
3019
|
loading: i = !1,
|
|
3020
3020
|
emptyComponent: n = null,
|
|
3021
|
-
emptyMessage: a =
|
|
3021
|
+
emptyMessage: a = t("_accessibility:messages.empty"),
|
|
3022
3022
|
renderComponent: o,
|
|
3023
3023
|
data: l = []
|
|
3024
|
-
} =
|
|
3025
|
-
return i ? /* @__PURE__ */ g(Le, {}) : /* @__PURE__ */ g(Oe, { children: l != null && l.length ? /* @__PURE__ */ g("ul", { className: `pretty-grid-main ${s}`, children: l == null ? void 0 : l.map((
|
|
3024
|
+
} = e;
|
|
3025
|
+
return i ? /* @__PURE__ */ g(Le, {}) : /* @__PURE__ */ g(Oe, { children: l != null && l.length ? /* @__PURE__ */ g("ul", { className: `pretty-grid-main ${s}`, children: l == null ? void 0 : l.map((m) => /* @__PURE__ */ g("li", { className: `pretty-grid-item ${r}`, children: o(m) }, m.id)) }) : /* @__PURE__ */ g(Oe, { children: n || /* @__PURE__ */ g(Qr, { message: a }) }) });
|
|
3026
3026
|
}, fs = De({
|
|
3027
3027
|
title: "",
|
|
3028
3028
|
setTitle: () => {
|
|
@@ -3030,12 +3030,12 @@ const Or = (t) => {
|
|
|
3030
3030
|
rightContent: null,
|
|
3031
3031
|
setRightContent: () => {
|
|
3032
3032
|
}
|
|
3033
|
-
}), Mn = (
|
|
3034
|
-
const { children:
|
|
3035
|
-
r(
|
|
3036
|
-
}, []), o = D((
|
|
3037
|
-
n(
|
|
3038
|
-
}, []), l =
|
|
3033
|
+
}), Mn = (e) => {
|
|
3034
|
+
const { children: t } = e, [s, r] = X(""), [i, n] = X(null), a = D((m) => {
|
|
3035
|
+
r(m);
|
|
3036
|
+
}, []), o = D((m) => {
|
|
3037
|
+
n(m);
|
|
3038
|
+
}, []), l = xe(
|
|
3039
3039
|
() => ({
|
|
3040
3040
|
title: s,
|
|
3041
3041
|
setTitle: a,
|
|
@@ -3044,60 +3044,60 @@ const Or = (t) => {
|
|
|
3044
3044
|
}),
|
|
3045
3045
|
[s, a, i, o]
|
|
3046
3046
|
);
|
|
3047
|
-
return /* @__PURE__ */ g(fs.Provider, { value: l, children:
|
|
3047
|
+
return /* @__PURE__ */ g(fs.Provider, { value: l, children: t });
|
|
3048
3048
|
}, Ur = () => Ve(fs);
|
|
3049
|
-
function On(
|
|
3050
|
-
const { t
|
|
3051
|
-
(ar() ? p.metaKey : p.ctrlKey) && p.shiftKey && p.key.toLowerCase() === "f" && (
|
|
3049
|
+
function On(e) {
|
|
3050
|
+
const { t } = R(), { openDrawer: s, showSearch: r = !0, menuButtonProps: i } = e, { searchComponent: n, location: a } = Be(), { title: o, rightContent: l } = Ur(), [m, f] = X(!1), h = D((p) => {
|
|
3051
|
+
(ar() ? p.metaKey : p.ctrlKey) && p.shiftKey && p.key.toLowerCase() === "f" && (f(!0), p.preventDefault());
|
|
3052
3052
|
}, []);
|
|
3053
|
-
me(() => (window.addEventListener("keydown",
|
|
3054
|
-
window.removeEventListener("keydown",
|
|
3055
|
-
}), [
|
|
3053
|
+
me(() => (window.addEventListener("keydown", h), () => {
|
|
3054
|
+
window.removeEventListener("keydown", h);
|
|
3055
|
+
}), [h]);
|
|
3056
3056
|
const d = n;
|
|
3057
|
-
return /* @__PURE__ */
|
|
3058
|
-
a.pathname !== "/" && !!d && /* @__PURE__ */ g(d, { open:
|
|
3059
|
-
/* @__PURE__ */
|
|
3060
|
-
/* @__PURE__ */
|
|
3057
|
+
return /* @__PURE__ */ $(Oe, { children: [
|
|
3058
|
+
a.pathname !== "/" && !!d && /* @__PURE__ */ g(d, { open: m, onClose: () => f(!1) }),
|
|
3059
|
+
/* @__PURE__ */ $("header", { id: "header", className: "header", children: [
|
|
3060
|
+
/* @__PURE__ */ $("div", { className: "navbar-left", children: [
|
|
3061
3061
|
/* @__PURE__ */ g(
|
|
3062
|
-
|
|
3062
|
+
Te,
|
|
3063
3063
|
{
|
|
3064
3064
|
...i,
|
|
3065
3065
|
type: (i == null ? void 0 : i.type) ?? "button",
|
|
3066
3066
|
icon: (i == null ? void 0 : i.icon) ?? js,
|
|
3067
3067
|
onClick: (p) => {
|
|
3068
|
-
var
|
|
3069
|
-
(
|
|
3068
|
+
var b;
|
|
3069
|
+
(b = i == null ? void 0 : i.onClick) == null || b.call(i, p), s();
|
|
3070
3070
|
},
|
|
3071
|
-
name: (i == null ? void 0 : i.name) ??
|
|
3072
|
-
"aria-label": (i == null ? void 0 : i["aria-label"]) ??
|
|
3071
|
+
name: (i == null ? void 0 : i.name) ?? t("_accessibility:buttons.openMenu"),
|
|
3072
|
+
"aria-label": (i == null ? void 0 : i["aria-label"]) ?? t("_accessibility:ariaLabels.openMenu"),
|
|
3073
3073
|
className: `navbar-menu animated ${(i == null ? void 0 : i.className) ?? ""}`
|
|
3074
3074
|
}
|
|
3075
3075
|
),
|
|
3076
|
-
/* @__PURE__ */ g("h1", { className: "poppins navbar-title", children: o ||
|
|
3076
|
+
/* @__PURE__ */ g("h1", { className: "poppins navbar-title", children: o || t("_pages:home.appName") })
|
|
3077
3077
|
] }),
|
|
3078
|
-
/* @__PURE__ */
|
|
3078
|
+
/* @__PURE__ */ $("div", { className: "navbar-right", children: [
|
|
3079
3079
|
l,
|
|
3080
3080
|
r && /* @__PURE__ */ g(
|
|
3081
|
-
|
|
3081
|
+
Te,
|
|
3082
3082
|
{
|
|
3083
3083
|
icon: Qs,
|
|
3084
3084
|
className: "navbar-search-btn",
|
|
3085
|
-
onClick: () =>
|
|
3085
|
+
onClick: () => f(!0)
|
|
3086
3086
|
}
|
|
3087
3087
|
)
|
|
3088
3088
|
] })
|
|
3089
3089
|
] })
|
|
3090
3090
|
] });
|
|
3091
3091
|
}
|
|
3092
|
-
const je = 300, Kr = (
|
|
3093
|
-
switch (
|
|
3092
|
+
const je = 300, Kr = (e) => e ?? J.error, Br = (e) => {
|
|
3093
|
+
switch (e) {
|
|
3094
3094
|
case J.error:
|
|
3095
3095
|
return zs;
|
|
3096
3096
|
default:
|
|
3097
3097
|
return Gs;
|
|
3098
3098
|
}
|
|
3099
|
-
}, lt = (
|
|
3100
|
-
switch (
|
|
3099
|
+
}, lt = (e) => {
|
|
3100
|
+
switch (e) {
|
|
3101
3101
|
case J.success:
|
|
3102
3102
|
return "!text-success";
|
|
3103
3103
|
case J.error:
|
|
@@ -3107,8 +3107,8 @@ const je = 300, Kr = (t) => t ?? J.error, Br = (t) => {
|
|
|
3107
3107
|
default:
|
|
3108
3108
|
return "!text-info";
|
|
3109
3109
|
}
|
|
3110
|
-
}, qr = (
|
|
3111
|
-
switch (
|
|
3110
|
+
}, qr = (e) => {
|
|
3111
|
+
switch (e) {
|
|
3112
3112
|
case J.success:
|
|
3113
3113
|
return "bg-bg-success";
|
|
3114
3114
|
case J.error:
|
|
@@ -3120,16 +3120,16 @@ const je = 300, Kr = (t) => t ?? J.error, Br = (t) => {
|
|
|
3120
3120
|
}
|
|
3121
3121
|
};
|
|
3122
3122
|
function Un() {
|
|
3123
|
-
const { t } = R(), { notification:
|
|
3123
|
+
const { t: e } = R(), { notification: t, removeNotification: s } = Ae(), [r, i] = X([]), n = Ue(r);
|
|
3124
3124
|
Is(() => {
|
|
3125
3125
|
n.current = r;
|
|
3126
3126
|
});
|
|
3127
3127
|
const a = Ue(null), o = D(
|
|
3128
3128
|
(l) => {
|
|
3129
3129
|
i(
|
|
3130
|
-
(
|
|
3130
|
+
(m) => l !== void 0 ? m.map((f) => f.id === l ? { ...f, closing: !0 } : f) : m.map((f) => ({ ...f, closing: !0 }))
|
|
3131
3131
|
), l !== void 0 ? setTimeout(() => {
|
|
3132
|
-
s(l), i((
|
|
3132
|
+
s(l), i((m) => m.filter((f) => f.id !== l));
|
|
3133
3133
|
}, je) : (a.current && clearTimeout(a.current), a.current = setTimeout(() => {
|
|
3134
3134
|
s(), i([]), a.current = null;
|
|
3135
3135
|
}, je));
|
|
@@ -3138,57 +3138,57 @@ function Un() {
|
|
|
3138
3138
|
);
|
|
3139
3139
|
return me(() => {
|
|
3140
3140
|
let l = null;
|
|
3141
|
-
const
|
|
3141
|
+
const m = () => {
|
|
3142
3142
|
l && clearTimeout(l), a.current && (clearTimeout(a.current), a.current = null);
|
|
3143
3143
|
};
|
|
3144
|
-
if (
|
|
3144
|
+
if (t.length === 0)
|
|
3145
3145
|
return n.current.length === 0 ? void 0 : (a.current && clearTimeout(a.current), l = setTimeout(() => {
|
|
3146
|
-
i((p) => p.map((
|
|
3146
|
+
i((p) => p.map((b) => ({ ...b, closing: !0 }))), l = null;
|
|
3147
3147
|
}, 0), a.current = setTimeout(() => {
|
|
3148
3148
|
i([]), a.current = null;
|
|
3149
|
-
}, je),
|
|
3150
|
-
const
|
|
3151
|
-
if (!
|
|
3152
|
-
(p) => p.id !== void 0 && !
|
|
3149
|
+
}, je), m);
|
|
3150
|
+
const f = new Set(n.current.map((p) => p.id));
|
|
3151
|
+
if (!t.some(
|
|
3152
|
+
(p) => p.id !== void 0 && !f.has(p.id)
|
|
3153
3153
|
)) return;
|
|
3154
3154
|
if (n.current.length === 0) {
|
|
3155
|
-
const p = [...
|
|
3155
|
+
const p = [...t];
|
|
3156
3156
|
return l = setTimeout(() => {
|
|
3157
|
-
i(p.map((
|
|
3157
|
+
i(p.map((b) => ({ ...b, closing: !1 }))), l = null;
|
|
3158
3158
|
}, 0), () => {
|
|
3159
3159
|
l && clearTimeout(l);
|
|
3160
3160
|
};
|
|
3161
3161
|
}
|
|
3162
3162
|
a.current && clearTimeout(a.current), l = setTimeout(() => {
|
|
3163
3163
|
i(
|
|
3164
|
-
(p) => p.every((
|
|
3164
|
+
(p) => p.every((b) => b.closing) ? p : p.map((b) => ({ ...b, closing: !0 }))
|
|
3165
3165
|
), l = null;
|
|
3166
3166
|
}, 0);
|
|
3167
|
-
const d = [...
|
|
3167
|
+
const d = [...t];
|
|
3168
3168
|
return a.current = setTimeout(() => {
|
|
3169
3169
|
i(d.map((p) => ({ ...p, closing: !1 }))), a.current = null;
|
|
3170
|
-
}, je),
|
|
3171
|
-
}, [
|
|
3170
|
+
}, je), m;
|
|
3171
|
+
}, [t]), me(() => {
|
|
3172
3172
|
if (!r.length) return;
|
|
3173
3173
|
let l;
|
|
3174
|
-
const
|
|
3174
|
+
const m = window.setTimeout(() => {
|
|
3175
3175
|
l = () => o(), window.addEventListener("click", l);
|
|
3176
|
-
}, 0),
|
|
3177
|
-
|
|
3176
|
+
}, 0), f = (h) => {
|
|
3177
|
+
h.key === "Escape" && o();
|
|
3178
3178
|
};
|
|
3179
|
-
return window.addEventListener("keydown",
|
|
3180
|
-
window.clearTimeout(
|
|
3179
|
+
return window.addEventListener("keydown", f), () => {
|
|
3180
|
+
window.clearTimeout(m), l && window.removeEventListener("click", l), window.removeEventListener("keydown", f);
|
|
3181
3181
|
};
|
|
3182
3182
|
}, [r.length, o]), Qt(
|
|
3183
|
-
/* @__PURE__ */ g("div", { className: `notification-portal ${r.length ? "active" : ""}`, children: r.map(({ id: l, type:
|
|
3184
|
-
const d = Kr(
|
|
3185
|
-
return /* @__PURE__ */
|
|
3183
|
+
/* @__PURE__ */ g("div", { className: `notification-portal ${r.length ? "active" : ""}`, children: r.map(({ id: l, type: m, message: f, closing: h }) => {
|
|
3184
|
+
const d = Kr(m);
|
|
3185
|
+
return /* @__PURE__ */ $(
|
|
3186
3186
|
"div",
|
|
3187
3187
|
{
|
|
3188
|
-
className: `notification ${
|
|
3188
|
+
className: `notification ${h ? "closing" : ""} ${qr(d)}`,
|
|
3189
3189
|
onClick: (p) => p.stopPropagation(),
|
|
3190
3190
|
children: [
|
|
3191
|
-
/* @__PURE__ */
|
|
3191
|
+
/* @__PURE__ */ $("div", { className: "notification-body", children: [
|
|
3192
3192
|
/* @__PURE__ */ g(
|
|
3193
3193
|
ue,
|
|
3194
3194
|
{
|
|
@@ -3196,10 +3196,10 @@ function Un() {
|
|
|
3196
3196
|
className: `notification-icon ${lt(d)}`
|
|
3197
3197
|
}
|
|
3198
3198
|
),
|
|
3199
|
-
/* @__PURE__ */ g("p", { className: `notification-text ${lt(d)}`, children:
|
|
3199
|
+
/* @__PURE__ */ g("p", { className: `notification-text ${lt(d)}`, children: f })
|
|
3200
3200
|
] }),
|
|
3201
3201
|
/* @__PURE__ */ g(
|
|
3202
|
-
|
|
3202
|
+
Te,
|
|
3203
3203
|
{
|
|
3204
3204
|
type: "button",
|
|
3205
3205
|
icon: Ht,
|
|
@@ -3209,8 +3209,8 @@ function Un() {
|
|
|
3209
3209
|
p.stopPropagation(), l !== void 0 && o(l);
|
|
3210
3210
|
},
|
|
3211
3211
|
iconClassName: `${lt(d)} notification-close-icon`,
|
|
3212
|
-
name:
|
|
3213
|
-
"aria-label":
|
|
3212
|
+
name: e("_accessibility:buttons.closeNotification"),
|
|
3213
|
+
"aria-label": e("_accessibility:ariaLabels.closeNotification")
|
|
3214
3214
|
}
|
|
3215
3215
|
)
|
|
3216
3216
|
]
|
|
@@ -3221,18 +3221,18 @@ function Un() {
|
|
|
3221
3221
|
document.body
|
|
3222
3222
|
);
|
|
3223
3223
|
}
|
|
3224
|
-
function Kn(
|
|
3225
|
-
const { className:
|
|
3226
|
-
return /* @__PURE__ */ g("div", { className: "splash-screen", children: /* @__PURE__ */ g(Le, { className: `blur-appear ${
|
|
3224
|
+
function Kn(e) {
|
|
3225
|
+
const { className: t, ...s } = e;
|
|
3226
|
+
return /* @__PURE__ */ g("div", { className: "splash-screen", children: /* @__PURE__ */ g(Le, { className: `blur-appear ${t ? ` ${t}` : ""}`, ...s }) });
|
|
3227
3227
|
}
|
|
3228
|
-
const Hr = (
|
|
3229
|
-
const { id:
|
|
3228
|
+
const Hr = (e) => {
|
|
3229
|
+
const { id: t, active: s, onClick: r, children: i, to: n, useLinks: a = !0, tabButtonProps: o } = e, { linkComponent: l } = Be(), m = l;
|
|
3230
3230
|
if (!a) {
|
|
3231
3231
|
const {
|
|
3232
|
-
className:
|
|
3232
|
+
className: h = "",
|
|
3233
3233
|
variant: d = s ? "submit" : "outlined",
|
|
3234
3234
|
color: p = s ? "primary" : "default",
|
|
3235
|
-
...
|
|
3235
|
+
...b
|
|
3236
3236
|
} = o ?? {};
|
|
3237
3237
|
return /* @__PURE__ */ g(
|
|
3238
3238
|
ge,
|
|
@@ -3240,68 +3240,75 @@ const Hr = (t) => {
|
|
|
3240
3240
|
type: "button",
|
|
3241
3241
|
variant: d,
|
|
3242
3242
|
color: p,
|
|
3243
|
-
className: `tab ${
|
|
3243
|
+
className: `tab ${h}`,
|
|
3244
3244
|
onClick: r,
|
|
3245
|
-
...
|
|
3245
|
+
...b,
|
|
3246
3246
|
children: i
|
|
3247
3247
|
}
|
|
3248
3248
|
);
|
|
3249
3249
|
}
|
|
3250
|
-
const
|
|
3250
|
+
const f = `button submit tab ${s ? "primary" : "outlined"} ${(o == null ? void 0 : o.className) ?? ""}`.trim();
|
|
3251
3251
|
return /* @__PURE__ */ g(
|
|
3252
|
-
|
|
3252
|
+
m,
|
|
3253
3253
|
{
|
|
3254
|
-
to: n ?? `#${
|
|
3254
|
+
to: n ?? `#${t}`,
|
|
3255
3255
|
onClick: () => r(),
|
|
3256
|
-
className:
|
|
3256
|
+
className: f,
|
|
3257
3257
|
children: i
|
|
3258
3258
|
}
|
|
3259
3259
|
);
|
|
3260
|
-
}, Wr = (
|
|
3261
|
-
var
|
|
3260
|
+
}, Wr = (e) => {
|
|
3261
|
+
var p;
|
|
3262
3262
|
const {
|
|
3263
|
-
tabs:
|
|
3263
|
+
tabs: t = [],
|
|
3264
3264
|
defaultTab: s,
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3265
|
+
currentTab: r,
|
|
3266
|
+
onTabChange: i,
|
|
3267
|
+
className: n = "",
|
|
3268
|
+
tabsContainerClassName: a = "",
|
|
3269
|
+
useLinks: o = !0,
|
|
3270
|
+
tabButtonProps: l
|
|
3271
|
+
} = e, [m, f] = X(s ?? ((p = t[0]) == null ? void 0 : p.id)), h = r ?? m, d = xe(() => t.find((b) => b.id === h), [t, h]);
|
|
3272
|
+
return /* @__PURE__ */ $("div", { className: `tabs-layout-main ${n}`, children: [
|
|
3271
3273
|
/* @__PURE__ */ g(
|
|
3272
3274
|
"ul",
|
|
3273
3275
|
{
|
|
3274
|
-
className: `horizontal tabs tabs-container ${
|
|
3275
|
-
children:
|
|
3276
|
+
className: `horizontal tabs tabs-container ${a}`,
|
|
3277
|
+
children: t.map(({ id: b, to: S, label: E }) => /* @__PURE__ */ g("li", { children: /* @__PURE__ */ g(
|
|
3276
3278
|
Hr,
|
|
3277
3279
|
{
|
|
3278
|
-
onClick: () =>
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3280
|
+
onClick: () => {
|
|
3281
|
+
f(b), i == null || i(b);
|
|
3282
|
+
},
|
|
3283
|
+
id: b,
|
|
3284
|
+
to: S ?? "",
|
|
3285
|
+
siblings: t.length > 1,
|
|
3286
|
+
active: h === b,
|
|
3287
|
+
useLinks: o,
|
|
3288
|
+
tabButtonProps: l,
|
|
3289
|
+
children: E
|
|
3286
3290
|
}
|
|
3287
|
-
) },
|
|
3291
|
+
) }, b))
|
|
3288
3292
|
}
|
|
3289
3293
|
),
|
|
3290
|
-
|
|
3294
|
+
d == null ? void 0 : d.content
|
|
3291
3295
|
] });
|
|
3292
|
-
}, jr = (
|
|
3296
|
+
}, jr = (e) => {
|
|
3293
3297
|
const {
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
/* @__PURE__ */ g("
|
|
3304
|
-
/* @__PURE__ */ g("
|
|
3298
|
+
title: t,
|
|
3299
|
+
body: s,
|
|
3300
|
+
content: r,
|
|
3301
|
+
onClickNext: i,
|
|
3302
|
+
image: n = "",
|
|
3303
|
+
alt: a = "",
|
|
3304
|
+
final: o = !1
|
|
3305
|
+
} = e, { setGuestMode: l } = Zt(), { navigate: m } = Be(), { t: f } = R();
|
|
3306
|
+
return /* @__PURE__ */ $("div", { className: "big-appear step-container", children: [
|
|
3307
|
+
n && /* @__PURE__ */ g("img", { src: n, alt: a }),
|
|
3308
|
+
t != null && /* @__PURE__ */ g("h2", { className: "step-title", children: t }),
|
|
3309
|
+
s != null && /* @__PURE__ */ g("div", { className: "step-body", children: s }),
|
|
3310
|
+
r != null && /* @__PURE__ */ g("div", { className: "step-content", children: r }),
|
|
3311
|
+
/* @__PURE__ */ g("div", { className: "step-actions", children: o ? /* @__PURE__ */ $(Oe, { children: [
|
|
3305
3312
|
/* @__PURE__ */ g(
|
|
3306
3313
|
ge,
|
|
3307
3314
|
{
|
|
@@ -3309,10 +3316,10 @@ const Hr = (t) => {
|
|
|
3309
3316
|
className: "step-button",
|
|
3310
3317
|
variant: "outlined",
|
|
3311
3318
|
onClick: () => {
|
|
3312
|
-
|
|
3319
|
+
l(!0), m("/");
|
|
3313
3320
|
},
|
|
3314
|
-
"aria-label":
|
|
3315
|
-
children:
|
|
3321
|
+
"aria-label": f("_accessibility:ariaLabels.start"),
|
|
3322
|
+
children: f("_accessibility:buttons.startAsGuest")
|
|
3316
3323
|
}
|
|
3317
3324
|
),
|
|
3318
3325
|
/* @__PURE__ */ g(
|
|
@@ -3321,21 +3328,21 @@ const Hr = (t) => {
|
|
|
3321
3328
|
color: "primary",
|
|
3322
3329
|
variant: "submit",
|
|
3323
3330
|
className: "step-button",
|
|
3324
|
-
"aria-label":
|
|
3325
|
-
onClick: () =>
|
|
3326
|
-
children:
|
|
3331
|
+
"aria-label": f("_accessibility:ariaLabels.start"),
|
|
3332
|
+
onClick: () => m("/auth/sign-in"),
|
|
3333
|
+
children: f("_accessibility:buttons.signIn")
|
|
3327
3334
|
}
|
|
3328
3335
|
)
|
|
3329
|
-
] }) : /* @__PURE__ */
|
|
3336
|
+
] }) : /* @__PURE__ */ $(Oe, { children: [
|
|
3330
3337
|
/* @__PURE__ */ g(
|
|
3331
3338
|
ge,
|
|
3332
3339
|
{
|
|
3333
3340
|
color: "primary",
|
|
3334
3341
|
className: "step-button",
|
|
3335
3342
|
variant: "outlined",
|
|
3336
|
-
onClick: () =>
|
|
3337
|
-
"aria-label":
|
|
3338
|
-
children:
|
|
3343
|
+
onClick: () => m("/auth/sign-in"),
|
|
3344
|
+
"aria-label": f("_accessibility:ariaLabels.skip"),
|
|
3345
|
+
children: f("_accessibility:buttons.skip")
|
|
3339
3346
|
}
|
|
3340
3347
|
),
|
|
3341
3348
|
/* @__PURE__ */ g(
|
|
@@ -3344,37 +3351,45 @@ const Hr = (t) => {
|
|
|
3344
3351
|
color: "primary",
|
|
3345
3352
|
className: "step-button",
|
|
3346
3353
|
variant: "outlined",
|
|
3347
|
-
onClick: () =>
|
|
3348
|
-
"aria-label":
|
|
3349
|
-
children:
|
|
3354
|
+
onClick: () => i(),
|
|
3355
|
+
"aria-label": f("_accessibility:ariaLabels.next"),
|
|
3356
|
+
children: f("_accessibility:buttons.next")
|
|
3350
3357
|
}
|
|
3351
3358
|
)
|
|
3352
3359
|
] }) })
|
|
3353
3360
|
] });
|
|
3354
|
-
}, Bn = (
|
|
3355
|
-
const { steps:
|
|
3361
|
+
}, Bn = (e) => {
|
|
3362
|
+
const { steps: t } = e, [s, r] = X(1), i = xe(() => t.map((n, a) => ({
|
|
3356
3363
|
id: a + 1,
|
|
3357
3364
|
label: "",
|
|
3358
3365
|
content: /* @__PURE__ */ g(
|
|
3359
3366
|
jr,
|
|
3360
3367
|
{
|
|
3361
|
-
|
|
3362
|
-
final: a ===
|
|
3368
|
+
...n,
|
|
3369
|
+
final: a === t.length - 1,
|
|
3363
3370
|
onClickNext: () => r((o) => o + 1)
|
|
3364
3371
|
}
|
|
3365
3372
|
)
|
|
3366
|
-
})), [
|
|
3367
|
-
return /* @__PURE__ */ g("div", { className: "onboarding-main", children: /* @__PURE__ */ g(
|
|
3368
|
-
|
|
3373
|
+
})), [t]);
|
|
3374
|
+
return /* @__PURE__ */ g("div", { className: "onboarding-main", children: /* @__PURE__ */ g(
|
|
3375
|
+
Wr,
|
|
3376
|
+
{
|
|
3377
|
+
currentTab: s,
|
|
3378
|
+
onTabChange: (n) => r(Number(n)),
|
|
3379
|
+
tabs: i,
|
|
3380
|
+
useLinks: !1
|
|
3381
|
+
}
|
|
3382
|
+
) });
|
|
3383
|
+
}, Qr = (e) => {
|
|
3369
3384
|
const {
|
|
3370
|
-
message:
|
|
3385
|
+
message: t,
|
|
3371
3386
|
messageProps: s = { className: "empty-message" },
|
|
3372
3387
|
action: r,
|
|
3373
3388
|
iconProps: i
|
|
3374
|
-
} =
|
|
3375
|
-
return /* @__PURE__ */
|
|
3389
|
+
} = e;
|
|
3390
|
+
return /* @__PURE__ */ $("div", { className: "empty-container", children: [
|
|
3376
3391
|
i && /* @__PURE__ */ g(ue, { ...i }),
|
|
3377
|
-
/* @__PURE__ */ g("p", { ...s, children:
|
|
3392
|
+
/* @__PURE__ */ g("p", { ...s, children: t }),
|
|
3378
3393
|
r && /* @__PURE__ */ g(Rs, { showTooltips: !1, showText: !0, ...r })
|
|
3379
3394
|
] });
|
|
3380
3395
|
};
|
|
@@ -3383,25 +3398,25 @@ export {
|
|
|
3383
3398
|
jn as Action,
|
|
3384
3399
|
Qn as Actions,
|
|
3385
3400
|
Gn as ActionsDropdown,
|
|
3386
|
-
|
|
3401
|
+
Te as AppIconButton,
|
|
3387
3402
|
ir as AuthClient,
|
|
3388
3403
|
Sn as AuthProvider,
|
|
3389
3404
|
hn as BaseClient,
|
|
3390
3405
|
zn as Button,
|
|
3391
|
-
|
|
3406
|
+
Tn as ConfigProvider,
|
|
3392
3407
|
un as ConfirmationDialog,
|
|
3393
3408
|
dt as Dialog,
|
|
3394
3409
|
ft as DialogActions,
|
|
3395
3410
|
_n as Drawer,
|
|
3396
3411
|
ts as DrawerMenuContext,
|
|
3397
|
-
|
|
3412
|
+
En as DrawerMenuProvider,
|
|
3398
3413
|
Qr as Empty,
|
|
3399
3414
|
Rn as Error,
|
|
3400
3415
|
on as FormContainer,
|
|
3401
3416
|
ln as FormDialog,
|
|
3402
|
-
|
|
3417
|
+
Ee as GlobalActions,
|
|
3403
3418
|
fn as IManager,
|
|
3404
|
-
|
|
3419
|
+
Te as IconButton,
|
|
3405
3420
|
dn as ImportDialog,
|
|
3406
3421
|
mn as IndexedDBClient,
|
|
3407
3422
|
kn as ManagerProvider,
|
|
@@ -3441,21 +3456,21 @@ export {
|
|
|
3441
3456
|
Be as useConfig,
|
|
3442
3457
|
ss as useConfirmationForm,
|
|
3443
3458
|
Vr as useDeleteAction,
|
|
3444
|
-
|
|
3459
|
+
An as useDeleteDialog,
|
|
3445
3460
|
ds as useDialog,
|
|
3446
3461
|
lr as useDrawerMenu,
|
|
3447
|
-
|
|
3462
|
+
xn as useEditAction,
|
|
3448
3463
|
Ir as useExportAction,
|
|
3449
3464
|
Dn as useExportActionMutate,
|
|
3450
|
-
|
|
3465
|
+
Fn as useFormDialog,
|
|
3451
3466
|
Pr as useImportAction,
|
|
3452
3467
|
Ln as useImportDialog,
|
|
3453
3468
|
or as useManager,
|
|
3454
3469
|
Ur as useNavbar,
|
|
3455
|
-
|
|
3456
|
-
|
|
3470
|
+
Ae as useNotification,
|
|
3471
|
+
Nn as usePostForm,
|
|
3457
3472
|
Rr as useRestoreAction,
|
|
3458
|
-
|
|
3473
|
+
$n as useRestoreDialog,
|
|
3459
3474
|
Mr as useScrollTrigger,
|
|
3460
3475
|
Cn as useTimeAge
|
|
3461
3476
|
};
|