@sheetxl/utils-mui 0.7.26 → 0.7.28-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cjs/CMDyOaq_TZmhbR3R.cjs +1 -0
- package/browser/cjs/GeHQP4M_1ydWv9v4.cjs +3 -0
- package/browser/cjs/index.cjs +4 -7
- package/browser/esm/CS_JzxfpVf9TlNsZ.mjs +96 -0
- package/browser/esm/DTtDTwN0K4atO3Er.mjs +2544 -0
- package/browser/esm/index.mjs +2688 -72
- package/licenses/dependencies.txt +60 -198
- package/node/esm/CbmHouxoPCCNwqGT.mjs +97 -0
- package/node/esm/index.mjs +3354 -981
- package/package.json +12 -14
- package/resources/contents.json +18 -0
- package/resources/locales/contents.json +16 -0
- package/resources/locales/de/ui.msg.json +22 -0
- package/resources/locales/en/ui.msg.json +22 -0
- package/types/index.d.ts +2 -1068
- package/types/src/button/ButtonContent.d.ts +17 -0
- package/types/src/button/ExhibitIconButton.d.ts +31 -0
- package/types/src/button/ExhibitMenuHeader.d.ts +15 -0
- package/types/src/button/ExhibitMenuItem.d.ts +24 -0
- package/types/src/button/ExhibitOptionButton.d.ts +16 -0
- package/types/src/button/ExhibitPopupIconButton.d.ts +18 -0
- package/types/src/button/ExhibitPopupMenuItem.d.ts +8 -0
- package/types/src/button/ExhibitTooltip.d.ts +26 -0
- package/types/src/button/OverflowPalette.d.ts +29 -0
- package/types/src/button/SelectedIcon.d.ts +18 -0
- package/types/src/button/index.d.ts +11 -0
- package/types/src/command/CommandButton.d.ts +4 -0
- package/types/src/command/CommandGroup.d.ts +71 -0
- package/types/src/command/CommandPopupButton.d.ts +34 -0
- package/types/src/command/CommandToolbar.d.ts +51 -0
- package/types/src/command/CommandTooltip.d.ts +22 -0
- package/types/src/command/InputCommandButton.d.ts +20 -0
- package/types/src/command/ToggleGroupButton.d.ts +33 -0
- package/types/src/command/index.d.ts +8 -0
- package/types/src/command/useManagedRipple.d.ts +23 -0
- package/types/src/components/AnimatedLoadingPanel.d.ts +45 -0
- package/types/src/components/ChipStrip.d.ts +9 -0
- package/types/src/components/ContextMenu.d.ts +32 -0
- package/types/src/components/ExhibitDivider.d.ts +6 -0
- package/types/src/components/NestingPopupButton.d.ts +11 -0
- package/types/src/components/ScrollButtons.d.ts +7 -0
- package/types/src/components/SimpleTooltip.d.ts +15 -0
- package/types/src/components/StackTrace.d.ts +20 -0
- package/types/src/components/StackTraceErrorPanel.d.ts +28 -0
- package/types/src/components/index.d.ts +10 -0
- package/types/src/dialog/InputDialog.d.ts +8 -0
- package/types/src/dialog/InternalWindow.d.ts +142 -0
- package/types/src/dialog/OptionsDialog.d.ts +19 -0
- package/types/src/dialog/index.d.ts +10 -0
- package/types/src/dialog/useInputDialog.d.ts +6 -0
- package/types/src/dialog/useLazyWindow.d.ts +14 -0
- package/types/src/dialog/useOptionsDialog.d.ts +8 -0
- package/types/src/float/ExhibitFloatPanel.d.ts +22 -0
- package/types/src/float/ExhibitFloatProvider.d.ts +17 -0
- package/types/src/float/ExhibitPopup.d.ts +97 -0
- package/types/src/float/index.d.ts +4 -0
- package/types/src/index.d.ts +8 -0
- package/types/src/locales/index.d.ts +3 -0
- package/types/src/theme/ExhibitTheme.d.ts +71 -0
- package/types/src/theme/IconSupport.d.ts +11 -0
- package/types/src/theme/ScrollbarTheming.d.ts +12 -0
- package/types/src/theme/index.d.ts +4 -0
- package/browser/cjs/Buzj_RuBZDULt78F.cjs +0 -11
- package/browser/cjs/DvRQUuQp6BSo_oUy.cjs +0 -6
- package/browser/esm/BNnvsy-BNmkD2vU1.mjs +0 -44
- package/browser/esm/D1zL4el7EI4boIdP.mjs +0 -2891
- package/node/assets/style.css +0 -1
- package/node/esm/DACH-8zNFkXeTBDb.mjs +0 -45
|
@@ -0,0 +1,2544 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/utils-mui - Utilities MUI - Utilities for MUI Components needed for all SheetXL components. - v0.7.28-beta.1
|
|
3
|
+
*
|
|
4
|
+
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import { Backdrop as e, Box as t, Button as n, Chip as r, CircularProgress as i, DialogActions as a, DialogContent as o, DialogTitle as s, Fade as c, IconButton as l, Paper as u, Tooltip as d, Typography as f, Unstable_TrapFocus as p, createTheme as m, useTheme as h, useThemeProps as g } from "@mui/material";
|
|
8
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
9
|
+
import * as b from "react";
|
|
10
|
+
import x, { Fragment as S, cloneElement as ee, forwardRef as C, memo as w, useEffect as T, useId as te, useLayoutEffect as E, useMemo as D, useRef as O, useState as k, version as A } from "react";
|
|
11
|
+
import { alpha as j, darken as M, lighten as N } from "@mui/system";
|
|
12
|
+
import { CommonUtils as P } from "@sheetxl/utils";
|
|
13
|
+
import { Command as ne, DynamicIcon as re, KeyCodes as ie, KeyModifiers as F, ReactUtils as ae, floatThemeScopeProps as oe, getScrollbarCssVariables as se, useCallbackRef as I, useFloatSurface as ce, useFullscreenPortal as le, useImperativeElement as ue, useTranslator as de } from "@sheetxl/utils-react";
|
|
14
|
+
import { deepmerge as L } from "@mui/utils";
|
|
15
|
+
import fe, { createPortal as pe } from "react-dom";
|
|
16
|
+
var me = Object.create, he = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, _e = Object.getOwnPropertyNames, ve = Object.getPrototypeOf, ye = Object.prototype.hasOwnProperty, be = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), xe = (e, t, n) => (n = e == null ? {} : me(ve(e)), ((e, t, n, r) => {
|
|
17
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i, a = _e(t), o = 0, s = a.length; o < s; o++) i = a[o], ye.call(e, i) || i === n || he(e, i, {
|
|
18
|
+
get: ((e) => t[e]).bind(null, i),
|
|
19
|
+
enumerable: !(r = ge(t, i)) || r.enumerable
|
|
20
|
+
});
|
|
21
|
+
return e;
|
|
22
|
+
})(!t && e && e.__esModule ? n : he(n, "default", {
|
|
23
|
+
value: e,
|
|
24
|
+
enumerable: !0
|
|
25
|
+
}), e));
|
|
26
|
+
function Se(e) {
|
|
27
|
+
var t, n, r = "";
|
|
28
|
+
if (typeof e == "string" || typeof e == "number") r += e;
|
|
29
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
30
|
+
var i = e.length;
|
|
31
|
+
for (t = 0; t < i; t++) e[t] && (n = Se(e[t])) && (r && (r += " "), r += n);
|
|
32
|
+
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
33
|
+
return r;
|
|
34
|
+
}
|
|
35
|
+
function Ce() {
|
|
36
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = Se(e)) && (r && (r += " "), r += t);
|
|
37
|
+
return r;
|
|
38
|
+
}
|
|
39
|
+
function we(e, t) {
|
|
40
|
+
if (typeof e == "function") return e(t);
|
|
41
|
+
e && (e.current = t);
|
|
42
|
+
}
|
|
43
|
+
var Te = parseInt(A.split(".")[0], 10) >= 19 ? function(e) {
|
|
44
|
+
return (t) => {
|
|
45
|
+
let n = [];
|
|
46
|
+
for (let r of e) {
|
|
47
|
+
let e = we(r, t), i = typeof e == "function";
|
|
48
|
+
n.push(i ? e : () => we(r, null));
|
|
49
|
+
}
|
|
50
|
+
return () => {
|
|
51
|
+
for (let e of n) e();
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
} : function(e) {
|
|
55
|
+
return (t) => {
|
|
56
|
+
for (let n of e) we(n, t);
|
|
57
|
+
};
|
|
58
|
+
}, Ee = function() {}, De = typeof window < "u", Oe = De ? E : T, ke = {
|
|
59
|
+
x: 0,
|
|
60
|
+
y: 0,
|
|
61
|
+
width: 0,
|
|
62
|
+
height: 0,
|
|
63
|
+
top: 0,
|
|
64
|
+
left: 0,
|
|
65
|
+
bottom: 0,
|
|
66
|
+
right: 0
|
|
67
|
+
}, Ae = De && window.ResizeObserver !== void 0 ? function() {
|
|
68
|
+
var e = k(null), t = e[0], n = e[1], r = k(ke), i = r[0], a = r[1], o = D(function() {
|
|
69
|
+
return new window.ResizeObserver(function(e) {
|
|
70
|
+
if (e[0]) {
|
|
71
|
+
var t = e[0].contentRect, n = t.x, r = t.y, i = t.width, o = t.height, s = t.top, c = t.left, l = t.bottom, u = t.right;
|
|
72
|
+
a({
|
|
73
|
+
x: n,
|
|
74
|
+
y: r,
|
|
75
|
+
width: i,
|
|
76
|
+
height: o,
|
|
77
|
+
top: s,
|
|
78
|
+
left: c,
|
|
79
|
+
bottom: l,
|
|
80
|
+
right: u
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}, []);
|
|
85
|
+
return Oe(function() {
|
|
86
|
+
if (t) return o.observe(t), function() {
|
|
87
|
+
o.disconnect();
|
|
88
|
+
};
|
|
89
|
+
}, [t]), [n, i];
|
|
90
|
+
} : function() {
|
|
91
|
+
return [Ee, ke];
|
|
92
|
+
}, je = w(C((e, n) => {
|
|
93
|
+
let { chips: i, sx: a, ...o } = e, s = D(() => {
|
|
94
|
+
if (!i) return null;
|
|
95
|
+
let e = Array.isArray(i) ? i : [i], t = [], n = e.length;
|
|
96
|
+
for (let i = 0; i < n; i++) {
|
|
97
|
+
let n = e[i], a = null;
|
|
98
|
+
typeof n == "string" ? a = v(r, {
|
|
99
|
+
label: n,
|
|
100
|
+
color: "primary",
|
|
101
|
+
size: "small",
|
|
102
|
+
sx: { scale: "0.8" }
|
|
103
|
+
}, "chip-" + i) : ee(n, { key: "chip-" + i }), t.push(a);
|
|
104
|
+
}
|
|
105
|
+
return t;
|
|
106
|
+
}, [i]);
|
|
107
|
+
return v(t, {
|
|
108
|
+
ref: n,
|
|
109
|
+
sx: {
|
|
110
|
+
display: "flex",
|
|
111
|
+
flexDirection: "row",
|
|
112
|
+
marginLeft: "4px",
|
|
113
|
+
gap: "2px",
|
|
114
|
+
...a
|
|
115
|
+
},
|
|
116
|
+
...o,
|
|
117
|
+
children: s
|
|
118
|
+
});
|
|
119
|
+
})), Me = (e) => {
|
|
120
|
+
if (e.palette.mode === "dark") return `drop-shadow(0px 0px 1px ${e.palette.mode === "dark" ? e.palette.text.primary : e.palette.divider})`;
|
|
121
|
+
}, Ne = (e = 1) => (t) => {
|
|
122
|
+
if (t.palette.mode === "dark") return `drop-shadow(0px 0px ${e}px ${t.palette.mode === "dark" ? t.palette.text.primary : t.palette.divider})`;
|
|
123
|
+
}, Pe = (e) => v(re, {
|
|
124
|
+
...e,
|
|
125
|
+
iconKey: "ArrowDownOutline"
|
|
126
|
+
}), Fe = (e) => v(re, {
|
|
127
|
+
...e,
|
|
128
|
+
iconKey: "ArrowRightOutline"
|
|
129
|
+
}), Ie = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, Le = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, Re = function(e, t = null) {
|
|
130
|
+
if (!e) return e;
|
|
131
|
+
e = e.replace(Ie, function(e, t, n, r) {
|
|
132
|
+
return t + t + n + n + r + r;
|
|
133
|
+
});
|
|
134
|
+
let n = Le.exec(e);
|
|
135
|
+
return n ? t === null ? `rgb(${parseInt(n[1], 16)}, ${parseInt(n[2], 16)}, ${parseInt(n[3], 16)})` : `rgb(${parseInt(n[1], 16)} ${parseInt(n[2], 16)} ${parseInt(n[3], 16)} / ${100 * t}%)` : e;
|
|
136
|
+
}, R = function(e, t = .2, n = "light") {
|
|
137
|
+
if (!e) return e;
|
|
138
|
+
let r = n !== "dark";
|
|
139
|
+
t < 0 && (r = !r, t *= -1), e = Re(e);
|
|
140
|
+
try {
|
|
141
|
+
return r ? M(e, Math.max(0, Math.min(1, 1 * t))) : N(e, Math.max(0, Math.min(1, 1.5 * t)));
|
|
142
|
+
} catch {
|
|
143
|
+
return e;
|
|
144
|
+
}
|
|
145
|
+
}, ze = function(e) {
|
|
146
|
+
let t = 0;
|
|
147
|
+
return t = e < 1 ? 5.11916 * e ** 2 : 4.5 * Math.log(e + 1) + 2, Number((t / 100).toFixed(2));
|
|
148
|
+
}, Be = (e) => (t) => {
|
|
149
|
+
if (t.palette.mode !== "dark") return "var(--sxl-surface-raised, none)";
|
|
150
|
+
let n = j("#fff", ze(e));
|
|
151
|
+
return `var(--sxl-surface-raised, linear-gradient(${n}, ${n}))`;
|
|
152
|
+
}, Ve = Be(2), He = Be(8), Ue = (e, t) => {
|
|
153
|
+
let n = m({ palette: { mode: e ? "dark" : "light" } }), r = {
|
|
154
|
+
"--icon-shadow": e ? n.palette.text.primary : n.palette.divider,
|
|
155
|
+
"--icon-size": "1.25rem",
|
|
156
|
+
"@media (pointer: coarse)": { "--icon-size": "1.75rem" }
|
|
157
|
+
}, i = {
|
|
158
|
+
typography: {},
|
|
159
|
+
palette: {
|
|
160
|
+
mode: e ? "dark" : "light",
|
|
161
|
+
text: {
|
|
162
|
+
secondary: e ? n.palette.text.secondary : j(n.palette.text.secondary, .75),
|
|
163
|
+
icon: e ? j(n.palette.text.secondary, .7) : j(n.palette.text.primary, .75)
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
components: {
|
|
167
|
+
MuiDialogTitle: { styleOverrides: { root: { fontWeight: "normal" } } },
|
|
168
|
+
MuiSelect: {
|
|
169
|
+
defaultProps: {
|
|
170
|
+
IconComponent: Pe,
|
|
171
|
+
MenuProps: { container: () => document.fullscreenElement }
|
|
172
|
+
},
|
|
173
|
+
styleOverrides: { icon: { top: "unset" } }
|
|
174
|
+
},
|
|
175
|
+
MuiListItemIcon: { styleOverrides: { root: {
|
|
176
|
+
minWidth: "0px !important",
|
|
177
|
+
overflow: "hidden",
|
|
178
|
+
marginLeft: "0px",
|
|
179
|
+
marginRight: "6px",
|
|
180
|
+
padding: "1px 1px",
|
|
181
|
+
border: "solid transparent 1px",
|
|
182
|
+
color: "unset"
|
|
183
|
+
} } },
|
|
184
|
+
MuiMenuItem: { styleOverrides: { root: {
|
|
185
|
+
paddingTop: "2px",
|
|
186
|
+
paddingBottom: "2px",
|
|
187
|
+
marginLeft: "4px",
|
|
188
|
+
marginRight: "4px",
|
|
189
|
+
paddingLeft: "6px",
|
|
190
|
+
paddingRight: "18px",
|
|
191
|
+
borderRadius: "4px",
|
|
192
|
+
fontSize: "0.875em",
|
|
193
|
+
"@media (pointer: coarse)": { fontSize: "1em" },
|
|
194
|
+
"&.Mui-selected": {}
|
|
195
|
+
} } },
|
|
196
|
+
MuiMenu: {
|
|
197
|
+
defaultProps: { container: () => document.fullscreenElement },
|
|
198
|
+
styleOverrides: { root: {
|
|
199
|
+
paddingTop: "2px",
|
|
200
|
+
paddingBottom: "2px",
|
|
201
|
+
marginLeft: "4px",
|
|
202
|
+
marginRight: "4px",
|
|
203
|
+
paddingLeft: "6px",
|
|
204
|
+
paddingRight: "18px",
|
|
205
|
+
borderRadius: "4px",
|
|
206
|
+
fontSize: "0.875em",
|
|
207
|
+
"@media (pointer: coarse)": { fontSize: "1em" },
|
|
208
|
+
"&.Mui-selected": {}
|
|
209
|
+
} }
|
|
210
|
+
},
|
|
211
|
+
MuiToolbar: { styleOverrides: { root: {
|
|
212
|
+
paddingTop: "4px",
|
|
213
|
+
paddingBottom: "4px",
|
|
214
|
+
"@media (min-width: 600px)": {
|
|
215
|
+
paddingTop: "4px",
|
|
216
|
+
paddingBottom: "4px"
|
|
217
|
+
}
|
|
218
|
+
} } },
|
|
219
|
+
MuiDivider: { styleOverrides: { root: {
|
|
220
|
+
marginTop: "4px !important",
|
|
221
|
+
marginBottom: "4px !important",
|
|
222
|
+
marginLeft: "0px",
|
|
223
|
+
marginRight: "0px"
|
|
224
|
+
} } },
|
|
225
|
+
MuiInputBase: { styleOverrides: { root: {} } },
|
|
226
|
+
MuiPaper: { styleOverrides: { root: {
|
|
227
|
+
...r,
|
|
228
|
+
backgroundImage: "var(--sxl-surface-raised, var(--Paper-overlay))"
|
|
229
|
+
} } },
|
|
230
|
+
MuiPopover: { styleOverrides: { paper: {
|
|
231
|
+
backgroundColor: `var(--sxl-color-elevated, var(--sxl-color-base-100, ${n.palette.background.paper}))`,
|
|
232
|
+
border: "1px solid var(--sxl-color-elevated-border, transparent)"
|
|
233
|
+
} } },
|
|
234
|
+
MuiPopper: { styleOverrides: { root: { "& .menu": {
|
|
235
|
+
marginTop: "4px",
|
|
236
|
+
marginBottom: "4px",
|
|
237
|
+
borderRadius: "4px"
|
|
238
|
+
} } } },
|
|
239
|
+
SmartInputField: { styleOverrides: {
|
|
240
|
+
automatic: {
|
|
241
|
+
transition: "opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
|
|
242
|
+
color: function() {
|
|
243
|
+
return n.palette.text.secondary;
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
dirty: {
|
|
247
|
+
fontStyle: "italic",
|
|
248
|
+
color: function() {
|
|
249
|
+
return n.palette.text.secondary;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
} }
|
|
253
|
+
}
|
|
254
|
+
}, a = i;
|
|
255
|
+
return t && (a = L(i, t)), m(a);
|
|
256
|
+
};
|
|
257
|
+
function We(e, t) {
|
|
258
|
+
return t = L({
|
|
259
|
+
track: R(e.palette.background.paper, .05, e?.palette.mode),
|
|
260
|
+
thumb: R(e.palette.background.paper, .3, e?.palette.mode),
|
|
261
|
+
active: e.palette.primary.main,
|
|
262
|
+
corner: e.palette.background.paper,
|
|
263
|
+
outline: !1
|
|
264
|
+
}, t || {}), se({
|
|
265
|
+
track: j(t.track, .2),
|
|
266
|
+
thumb: t.thumb,
|
|
267
|
+
button: t.button,
|
|
268
|
+
active: t.active,
|
|
269
|
+
corner: t.corner || t.thumb,
|
|
270
|
+
border: t.track
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
function Ge(e, t) {
|
|
274
|
+
let n = We(e, t), r = {
|
|
275
|
+
...n,
|
|
276
|
+
"& .scrollbar, & .vsb-track, & .vsb-thumb": { ...n },
|
|
277
|
+
"&::-webkit-scrollbar, & *::-webkit-scrollbar": {
|
|
278
|
+
backgroundColor: "var(--scrollbar-track-color)",
|
|
279
|
+
width: "var(--scrollbar-width)",
|
|
280
|
+
height: "var(--scrollbar-height)"
|
|
281
|
+
},
|
|
282
|
+
"&::-webkit-scrollbar-button": { display: "none" },
|
|
283
|
+
"& .scrollbar-button": {
|
|
284
|
+
fill: "var(--scrollbar-thumb-color)",
|
|
285
|
+
backgroundColor: "transparent",
|
|
286
|
+
transition: "fill opacity 260ms ease",
|
|
287
|
+
width: "var(--scrollbar-width)",
|
|
288
|
+
height: "var(--scrollbar-height)"
|
|
289
|
+
},
|
|
290
|
+
"& .scrollbar-button:hover:not([disabled])": { fill: "var(--scrollbar-active-color)" },
|
|
291
|
+
"& .scrollbar-button:disabled": { opacity: .8 },
|
|
292
|
+
"&::-webkit-scrollbar-track, & *::-webkit-scrollbar-track": {},
|
|
293
|
+
"&::-webkit-scrollbar-track-piece, & *::-webkit-scrollbar-track-piece": {},
|
|
294
|
+
"&::-webkit-scrollbar-thumb, & *::-webkit-scrollbar-thumb": {
|
|
295
|
+
borderRadius: "var(--scrollbar-border-radius)",
|
|
296
|
+
backgroundColor: "var(--scrollbar-thumb-color)",
|
|
297
|
+
minHeight: "var(--scrollbar-min-thumb-size)",
|
|
298
|
+
minWidth: "var(--scrollbar-min-thumb-size)",
|
|
299
|
+
border: "var(--scrollbar-border-width) solid var(--scrollbar-border-color)"
|
|
300
|
+
},
|
|
301
|
+
"&::-webkit-scrollbar-thumb:focus, & *::-webkit-scrollbar-thumb:focus": {
|
|
302
|
+
backgroundColor: "var(--scrollbar-active-color)",
|
|
303
|
+
border: t?.outline ? t.outline : void 0
|
|
304
|
+
},
|
|
305
|
+
"&::-webkit-scrollbar-thumb:active, & *::-webkit-scrollbar-thumb:active": {
|
|
306
|
+
backgroundColor: "var(--scrollbar-active-color)",
|
|
307
|
+
border: t?.outline ? t.outline : void 0
|
|
308
|
+
},
|
|
309
|
+
"&::-webkit-scrollbar-thumb:hover, & *::-webkit-scrollbar-thumb:hover": {
|
|
310
|
+
backgroundColor: "var(--scrollbar-active-color)",
|
|
311
|
+
border: t?.outline ? t.outline : void 0
|
|
312
|
+
},
|
|
313
|
+
"&::-webkit-scrollbar-corner, & *::-webkit-scrollbar-corner": { backgroundColor: "var(--scrollbar-corner-color)" }
|
|
314
|
+
};
|
|
315
|
+
return P.getPlatform() === P.OSType.Firefox && (r["* .pseudo-scrollbar"] = { scrollbarColor: "var(--scrollbar-thumb-color) transparent" }, r["* .pseudo-scrollbar:hover:not([disabled])"] = { scrollbarColor: "var(--scrollbar-active-color) transparent" }), r;
|
|
316
|
+
}
|
|
317
|
+
var Ke = C((e, t) => {
|
|
318
|
+
let { slotProps: n, ...r } = e, { getPortalContainer: i, isFullscreen: a } = le();
|
|
319
|
+
return v(d, {
|
|
320
|
+
ref: t,
|
|
321
|
+
slotProps: {
|
|
322
|
+
...n,
|
|
323
|
+
popper: {
|
|
324
|
+
container: a ? i : void 0,
|
|
325
|
+
...n?.popper || {}
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
...r
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
Ke.displayName = "SimpleTooltip";
|
|
332
|
+
var qe = w((e) => {
|
|
333
|
+
let { modifier: n, sx: r, ...i } = e;
|
|
334
|
+
return v(t, {
|
|
335
|
+
sx: {
|
|
336
|
+
marginLeft: "1px",
|
|
337
|
+
marginRight: "1px",
|
|
338
|
+
borderRadius: "4px",
|
|
339
|
+
borderStyle: "solid",
|
|
340
|
+
borderTopWidth: "1px",
|
|
341
|
+
borderLeftWidth: "1px",
|
|
342
|
+
borderRightWidth: "1px",
|
|
343
|
+
borderBottomWidth: "2px",
|
|
344
|
+
borderTopColor: (e) => j(e.palette.background.paper, e.palette.action.disabledOpacity),
|
|
345
|
+
borderLeftColor: (e) => j(e.palette.background.paper, e.palette.action.disabledOpacity),
|
|
346
|
+
borderRightColor: (e) => j(e.palette.background.paper, e.palette.action.disabledOpacity),
|
|
347
|
+
borderBottomColor: (e) => j(e.palette.background.paper, 1 - e.palette.action.disabledOpacity),
|
|
348
|
+
backgroundColor: (e) => j(e.palette.action.hover, e.palette.action.disabledOpacity),
|
|
349
|
+
paddingLeft: "4px",
|
|
350
|
+
paddingRight: "4px",
|
|
351
|
+
minHeight: "1.6em",
|
|
352
|
+
display: "flex",
|
|
353
|
+
justifyContent: "center",
|
|
354
|
+
alignItems: "center",
|
|
355
|
+
boxSizing: "content-box",
|
|
356
|
+
overflow: "hidden",
|
|
357
|
+
...r
|
|
358
|
+
},
|
|
359
|
+
...i,
|
|
360
|
+
children: v(t, {
|
|
361
|
+
sx: {
|
|
362
|
+
display: "flex",
|
|
363
|
+
alignItems: "center",
|
|
364
|
+
justifyContent: "center",
|
|
365
|
+
textAlign: "center",
|
|
366
|
+
"& *": { fontWeight: "500" }
|
|
367
|
+
},
|
|
368
|
+
children: n
|
|
369
|
+
})
|
|
370
|
+
});
|
|
371
|
+
}), Je = (e, n, r = !1, i = null) => {
|
|
372
|
+
if (Array.isArray(e)) {
|
|
373
|
+
let a = [], o = e;
|
|
374
|
+
for (let e = 0; e < o.length; e++) a.push(Je(o[e], n, r, i ?? "" + e));
|
|
375
|
+
return v(t, {
|
|
376
|
+
sx: {
|
|
377
|
+
display: "flex",
|
|
378
|
+
alignItems: "center",
|
|
379
|
+
flexDirection: "column"
|
|
380
|
+
},
|
|
381
|
+
children: a
|
|
382
|
+
}, i);
|
|
383
|
+
}
|
|
384
|
+
if (!e?.key) return null;
|
|
385
|
+
let a = {};
|
|
386
|
+
for (let t = 0; e.modifiers && t < e.modifiers.length; t++) a[e.modifiers[t]] = !0;
|
|
387
|
+
let o = [], s = P.getPlatform() === P.OSType.MacOS || P.getPlatform() === P.OSType.IOS ? n("shortcut.modifier.cmd") : n("shortcut.modifier.ctrl");
|
|
388
|
+
return a?.[F.Ctrl] && (o.push(v(qe, { modifier: r ? "^" : v("div", {
|
|
389
|
+
style: { paddingRight: "1px" },
|
|
390
|
+
children: s
|
|
391
|
+
}) }, "ctrl")), o.push("+")), a?.[F.Alt] && (o.push(v(qe, { modifier: r ? "⌥" : n("shortcut.modifier.alt") }, "alt")), o.push("+")), a?.[F.Shift] && (o.push(v(qe, { modifier: r ? "⇧" : v("div", {
|
|
392
|
+
style: { paddingRight: "1px" },
|
|
393
|
+
children: n("shortcut.modifier.shift")
|
|
394
|
+
}) }, "shift")), o.push("+")), a?.[F.Meta] && (o.push(v(qe, { modifier: r ? v("div", {
|
|
395
|
+
style: { paddingTop: "1px" },
|
|
396
|
+
children: "⌘"
|
|
397
|
+
}) : n("shortcut.modifier.meta") }, "meta")), o.push("+")), o.push(v(qe, { modifier: ae.toPrettyKeyCode(e.key) }, "character")), v(t, {
|
|
398
|
+
sx: {
|
|
399
|
+
display: "flex",
|
|
400
|
+
alignItems: "center"
|
|
401
|
+
},
|
|
402
|
+
children: o
|
|
403
|
+
}, i);
|
|
404
|
+
}, Ye = w(C((e, n) => {
|
|
405
|
+
let { disabled: r = !1, label: i, shortcut: a, chips: o, description: s, maxWidth: c = 280, useModifierSymbols: l = !1, children: u, simple: d, componentDisabled: p = !1, sx: m, ...h } = e, g = de(), b = null;
|
|
406
|
+
a && (b = Je(a, g, l));
|
|
407
|
+
let [x, S] = k(null);
|
|
408
|
+
return T(() => {
|
|
409
|
+
Promise.resolve(i).then((e) => {
|
|
410
|
+
S(e);
|
|
411
|
+
});
|
|
412
|
+
}, [i]), v(Ke, {
|
|
413
|
+
slotProps: { popper: {
|
|
414
|
+
sx: {
|
|
415
|
+
"& .MuiTooltip-tooltip": { marginTop: "0px !important" },
|
|
416
|
+
...m
|
|
417
|
+
},
|
|
418
|
+
modifiers: [{
|
|
419
|
+
name: "offset",
|
|
420
|
+
options: { offset: [0, 14] }
|
|
421
|
+
}]
|
|
422
|
+
} },
|
|
423
|
+
className: "tooltip-wrapper",
|
|
424
|
+
tabIndex: -1,
|
|
425
|
+
title: !r && x ? y(t, {
|
|
426
|
+
sx: { maxWidth: `${c}px` },
|
|
427
|
+
ref: n,
|
|
428
|
+
children: [y(t, {
|
|
429
|
+
sx: {
|
|
430
|
+
display: "flex",
|
|
431
|
+
flexDirection: "row",
|
|
432
|
+
marginBottom: s ? "4px" : "0px"
|
|
433
|
+
},
|
|
434
|
+
children: [
|
|
435
|
+
v(f, {
|
|
436
|
+
variant: "subtitle1",
|
|
437
|
+
component: "div",
|
|
438
|
+
sx: { flex: "1 1 100%" },
|
|
439
|
+
children: x
|
|
440
|
+
}),
|
|
441
|
+
o ? v(je, { chips: o }) : null,
|
|
442
|
+
b ? v(t, { sx: { marginLeft: "8px" } }, "leadingSpace") : v(_, {}),
|
|
443
|
+
b
|
|
444
|
+
]
|
|
445
|
+
}), s ? v(f, {
|
|
446
|
+
variant: "caption",
|
|
447
|
+
sx: {
|
|
448
|
+
whiteSpace: "pre-line",
|
|
449
|
+
lineHeight: "1.4"
|
|
450
|
+
},
|
|
451
|
+
children: s
|
|
452
|
+
}) : v(_, {})]
|
|
453
|
+
}) : "",
|
|
454
|
+
enterDelay: 260,
|
|
455
|
+
enterNextDelay: 130,
|
|
456
|
+
leaveDelay: 230,
|
|
457
|
+
disableInteractive: !0,
|
|
458
|
+
...h,
|
|
459
|
+
children: v("div", {
|
|
460
|
+
style: {
|
|
461
|
+
display: "flex",
|
|
462
|
+
alignItems: "stretch",
|
|
463
|
+
justifyContent: "stretch"
|
|
464
|
+
},
|
|
465
|
+
children: u
|
|
466
|
+
})
|
|
467
|
+
});
|
|
468
|
+
})), Xe = {
|
|
469
|
+
"dialog.cancel": "Cancel",
|
|
470
|
+
"dialog.ok": "Ok",
|
|
471
|
+
"overflow.more": "More",
|
|
472
|
+
"overflow.moreDescription": "More toolbar options…",
|
|
473
|
+
"scroll.edgeBottom": " Bottom: ''Ctrl+Click'' to scroll to the end",
|
|
474
|
+
"scroll.edgeLeft": " Left: ''Ctrl+Click'' to scroll to the beginning",
|
|
475
|
+
"scroll.edgeRight": " Right: ''Ctrl+Click'' to scroll to the end",
|
|
476
|
+
"scroll.edgeTop": " Top: ''Ctrl+Click'' to scroll to the beginning",
|
|
477
|
+
"shortcut.modifier.alt": "Alt",
|
|
478
|
+
"shortcut.modifier.cmd": "Cmd",
|
|
479
|
+
"shortcut.modifier.ctrl": "Ctrl",
|
|
480
|
+
"shortcut.modifier.meta": "Meta",
|
|
481
|
+
"shortcut.modifier.shift": "Shift",
|
|
482
|
+
"stackTrace.causedBy": "Caused by: {cause}",
|
|
483
|
+
"stackTrace.copy": "Copy stack trace",
|
|
484
|
+
"stackTrace.heading": "Stack Trace",
|
|
485
|
+
"stackTrace.headingFrames": "Stack Trace ({count} frames)",
|
|
486
|
+
"stackTrace.log": "Log error to console",
|
|
487
|
+
"stackTrace.moreFrames": "... and {count} more frames",
|
|
488
|
+
"window.close": "Close"
|
|
489
|
+
}, { DefaultCommandCatalogService: Ze } = ne, Qe = !1;
|
|
490
|
+
function $e() {
|
|
491
|
+
Qe || (Qe = !0, Ze.registerFromManifest("@sheetxl/utils-mui", import.meta.url, { messages: Xe }));
|
|
492
|
+
}
|
|
493
|
+
var et = be((e, t) => {
|
|
494
|
+
t.exports = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
495
|
+
}), tt = be((e, t) => {
|
|
496
|
+
var n = et();
|
|
497
|
+
function r() {}
|
|
498
|
+
function i() {}
|
|
499
|
+
i.resetWarningCache = r, t.exports = function() {
|
|
500
|
+
function e(e, t, r, i, a, o) {
|
|
501
|
+
if (o !== n) {
|
|
502
|
+
var s = /* @__PURE__ */ Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");
|
|
503
|
+
throw s.name = "Invariant Violation", s;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
function t() {
|
|
507
|
+
return e;
|
|
508
|
+
}
|
|
509
|
+
e.isRequired = e;
|
|
510
|
+
var a = {
|
|
511
|
+
array: e,
|
|
512
|
+
bigint: e,
|
|
513
|
+
bool: e,
|
|
514
|
+
func: e,
|
|
515
|
+
number: e,
|
|
516
|
+
object: e,
|
|
517
|
+
string: e,
|
|
518
|
+
symbol: e,
|
|
519
|
+
any: e,
|
|
520
|
+
arrayOf: t,
|
|
521
|
+
element: e,
|
|
522
|
+
elementType: e,
|
|
523
|
+
instanceOf: t,
|
|
524
|
+
node: e,
|
|
525
|
+
objectOf: t,
|
|
526
|
+
oneOf: t,
|
|
527
|
+
oneOfType: t,
|
|
528
|
+
shape: t,
|
|
529
|
+
exact: t,
|
|
530
|
+
checkPropTypes: i,
|
|
531
|
+
resetWarningCache: r
|
|
532
|
+
};
|
|
533
|
+
return a.PropTypes = a, a;
|
|
534
|
+
};
|
|
535
|
+
}), z = xe(be((e, t) => {
|
|
536
|
+
t.exports = tt()();
|
|
537
|
+
})(), 1);
|
|
538
|
+
function nt(e, t) {
|
|
539
|
+
for (let n = 0, r = e.length; n < r; n++) if (t.apply(t, [
|
|
540
|
+
e[n],
|
|
541
|
+
n,
|
|
542
|
+
e
|
|
543
|
+
])) return e[n];
|
|
544
|
+
}
|
|
545
|
+
function rt(e) {
|
|
546
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Function]";
|
|
547
|
+
}
|
|
548
|
+
function it(e) {
|
|
549
|
+
return typeof e == "number" && !isNaN(e);
|
|
550
|
+
}
|
|
551
|
+
function B(e) {
|
|
552
|
+
return parseInt(e, 10);
|
|
553
|
+
}
|
|
554
|
+
function at(e, t, n) {
|
|
555
|
+
if (e[t]) return /* @__PURE__ */ Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`);
|
|
556
|
+
}
|
|
557
|
+
var ot = [
|
|
558
|
+
"Moz",
|
|
559
|
+
"Webkit",
|
|
560
|
+
"O",
|
|
561
|
+
"ms"
|
|
562
|
+
];
|
|
563
|
+
function st(e, t) {
|
|
564
|
+
return t ? `${t}${function(e) {
|
|
565
|
+
let t = "", n = !0;
|
|
566
|
+
for (let r = 0; r < e.length; r++) n ? (t += e[r].toUpperCase(), n = !1) : e[r] === "-" ? n = !0 : t += e[r];
|
|
567
|
+
return t;
|
|
568
|
+
}(e)}` : e;
|
|
569
|
+
}
|
|
570
|
+
var ct = function(e = "transform") {
|
|
571
|
+
if (typeof window > "u") return "";
|
|
572
|
+
let t = window.document?.documentElement?.style;
|
|
573
|
+
if (!t || e in t) return "";
|
|
574
|
+
for (let n = 0; n < ot.length; n++) if (st(e, ot[n]) in t) return ot[n];
|
|
575
|
+
return "";
|
|
576
|
+
}(), lt = "";
|
|
577
|
+
function ut(e, t) {
|
|
578
|
+
lt ||= nt([
|
|
579
|
+
"matches",
|
|
580
|
+
"webkitMatchesSelector",
|
|
581
|
+
"mozMatchesSelector",
|
|
582
|
+
"msMatchesSelector",
|
|
583
|
+
"oMatchesSelector"
|
|
584
|
+
], function(t) {
|
|
585
|
+
return rt(e[t]);
|
|
586
|
+
}) ?? "";
|
|
587
|
+
let n = e[lt];
|
|
588
|
+
return !!rt(n) && !!n.call(e, t);
|
|
589
|
+
}
|
|
590
|
+
function dt(e, t, n) {
|
|
591
|
+
let r = e;
|
|
592
|
+
do {
|
|
593
|
+
if (ut(r, t)) return !0;
|
|
594
|
+
if (r === n) return !1;
|
|
595
|
+
r = r.parentNode;
|
|
596
|
+
} while (r);
|
|
597
|
+
return !1;
|
|
598
|
+
}
|
|
599
|
+
function ft(e, t, n, r) {
|
|
600
|
+
if (!e) return;
|
|
601
|
+
let i = {
|
|
602
|
+
capture: !0,
|
|
603
|
+
...r
|
|
604
|
+
}, a = n;
|
|
605
|
+
e.addEventListener ? e.addEventListener(t, a, i) : e.attachEvent ? e.attachEvent("on" + t, a) : e["on" + t] = a;
|
|
606
|
+
}
|
|
607
|
+
function pt(e, t, n, r) {
|
|
608
|
+
if (!e) return;
|
|
609
|
+
let i = {
|
|
610
|
+
capture: !0,
|
|
611
|
+
...r
|
|
612
|
+
}, a = n;
|
|
613
|
+
e.removeEventListener ? e.removeEventListener(t, a, i) : e.detachEvent ? e.detachEvent("on" + t, a) : e["on" + t] = null;
|
|
614
|
+
}
|
|
615
|
+
function mt(e) {
|
|
616
|
+
let t = e.clientHeight, n = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
617
|
+
return t += B(n.borderTopWidth), t += B(n.borderBottomWidth), t;
|
|
618
|
+
}
|
|
619
|
+
function ht(e) {
|
|
620
|
+
let t = e.clientWidth, n = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
621
|
+
return t += B(n.borderLeftWidth), t += B(n.borderRightWidth), t;
|
|
622
|
+
}
|
|
623
|
+
function gt(e) {
|
|
624
|
+
let t = e.clientHeight, n = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
625
|
+
return t -= B(n.paddingTop), t -= B(n.paddingBottom), t;
|
|
626
|
+
}
|
|
627
|
+
function _t(e) {
|
|
628
|
+
let t = e.clientWidth, n = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
629
|
+
return t -= B(n.paddingLeft), t -= B(n.paddingRight), t;
|
|
630
|
+
}
|
|
631
|
+
function vt({ x: e, y: t }, n, r) {
|
|
632
|
+
let i = `translate(${e}${r},${t}${r})`;
|
|
633
|
+
return n && (i = `translate(${typeof n.x == "string" ? n.x : n.x + r}, ${typeof n.y == "string" ? n.y : n.y + r})` + i), i;
|
|
634
|
+
}
|
|
635
|
+
function yt(e, t) {
|
|
636
|
+
if (!e) return;
|
|
637
|
+
let n = e.getElementById("react-draggable-style-el");
|
|
638
|
+
if (!n) {
|
|
639
|
+
n = e.createElement("style"), n.type = "text/css", n.id = "react-draggable-style-el";
|
|
640
|
+
let r = t ?? (typeof __webpack_nonce__ < "u" ? __webpack_nonce__ : void 0);
|
|
641
|
+
r && n.setAttribute("nonce", r), n.innerHTML = ".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n", n.innerHTML += ".react-draggable-transparent-selection *::selection {all: inherit;}\n", e.getElementsByTagName("head")[0].appendChild(n);
|
|
642
|
+
}
|
|
643
|
+
var r, i;
|
|
644
|
+
e.body && (r = e.body, i = "react-draggable-transparent-selection", r.classList ? r.classList.add(i) : r.className.match(RegExp(`(?:^|\\s)${i}(?!\\S)`)) || (r.className += ` ${i}`));
|
|
645
|
+
}
|
|
646
|
+
function bt(e) {
|
|
647
|
+
window.requestAnimationFrame ? window.requestAnimationFrame(() => {
|
|
648
|
+
xt(e);
|
|
649
|
+
}) : xt(e);
|
|
650
|
+
}
|
|
651
|
+
function xt(e) {
|
|
652
|
+
var t, n;
|
|
653
|
+
if (e) try {
|
|
654
|
+
e.body && (t = e.body, n = "react-draggable-transparent-selection", t.classList ? t.classList.remove(n) : t.className = t.className.replace(RegExp(`(?:^|\\s)${n}(?!\\S)`, "g"), ""));
|
|
655
|
+
let r = e.selection;
|
|
656
|
+
if (r) r.empty();
|
|
657
|
+
else {
|
|
658
|
+
let t = (e.defaultView || window).getSelection();
|
|
659
|
+
t && t.type !== "Caret" && t.removeAllRanges();
|
|
660
|
+
}
|
|
661
|
+
} catch {}
|
|
662
|
+
}
|
|
663
|
+
function St(e, t, n) {
|
|
664
|
+
return [Math.round(t / e[0]) * e[0], Math.round(n / e[1]) * e[1]];
|
|
665
|
+
}
|
|
666
|
+
function Ct(e) {
|
|
667
|
+
return e.props.axis === "both" || e.props.axis === "x";
|
|
668
|
+
}
|
|
669
|
+
function wt(e) {
|
|
670
|
+
return e.props.axis === "both" || e.props.axis === "y";
|
|
671
|
+
}
|
|
672
|
+
function Tt(e, t, n) {
|
|
673
|
+
let r = typeof t == "number" ? function(e, t) {
|
|
674
|
+
return e.targetTouches && nt(e.targetTouches, (e) => t === e.identifier) || e.changedTouches && nt(e.changedTouches, (e) => t === e.identifier);
|
|
675
|
+
}(e, t) : null;
|
|
676
|
+
if (typeof t == "number" && !r) return null;
|
|
677
|
+
let i = Ot(n);
|
|
678
|
+
return function(e, t, n) {
|
|
679
|
+
let r = t === t.ownerDocument.body ? {
|
|
680
|
+
left: 0,
|
|
681
|
+
top: 0
|
|
682
|
+
} : t.getBoundingClientRect();
|
|
683
|
+
return {
|
|
684
|
+
x: (e.clientX + t.scrollLeft - r.left) / n,
|
|
685
|
+
y: (e.clientY + t.scrollTop - r.top) / n
|
|
686
|
+
};
|
|
687
|
+
}(r || e, n.props.offsetParent || i.offsetParent || i.ownerDocument.body, n.props.scale);
|
|
688
|
+
}
|
|
689
|
+
function Et(e, t, n) {
|
|
690
|
+
let r = !it(e.lastX), i = Ot(e);
|
|
691
|
+
return r ? {
|
|
692
|
+
node: i,
|
|
693
|
+
deltaX: 0,
|
|
694
|
+
deltaY: 0,
|
|
695
|
+
lastX: t,
|
|
696
|
+
lastY: n,
|
|
697
|
+
x: t,
|
|
698
|
+
y: n
|
|
699
|
+
} : {
|
|
700
|
+
node: i,
|
|
701
|
+
deltaX: t - e.lastX,
|
|
702
|
+
deltaY: n - e.lastY,
|
|
703
|
+
lastX: e.lastX,
|
|
704
|
+
lastY: e.lastY,
|
|
705
|
+
x: t,
|
|
706
|
+
y: n
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
function Dt(e, t) {
|
|
710
|
+
let n = e.props.scale;
|
|
711
|
+
return {
|
|
712
|
+
node: t.node,
|
|
713
|
+
x: e.state.x + t.deltaX / n,
|
|
714
|
+
y: e.state.y + t.deltaY / n,
|
|
715
|
+
deltaX: t.deltaX / n,
|
|
716
|
+
deltaY: t.deltaY / n,
|
|
717
|
+
lastX: e.state.x,
|
|
718
|
+
lastY: e.state.y
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
function Ot(e) {
|
|
722
|
+
let t = e.findDOMNode();
|
|
723
|
+
if (!t) throw Error("<DraggableCore>: Unmounted during event!");
|
|
724
|
+
return t;
|
|
725
|
+
}
|
|
726
|
+
var kt = {
|
|
727
|
+
start: "touchstart",
|
|
728
|
+
move: "touchmove",
|
|
729
|
+
stop: "touchend"
|
|
730
|
+
}, At = {
|
|
731
|
+
start: "mousedown",
|
|
732
|
+
move: "mousemove",
|
|
733
|
+
stop: "mouseup"
|
|
734
|
+
}, jt = At, Mt = class extends b.Component {
|
|
735
|
+
constructor() {
|
|
736
|
+
super(...arguments), this.dragging = !1, this.lastX = NaN, this.lastY = NaN, this.touchIdentifier = null, this.mounted = !1, this.handleDragStart = (e) => {
|
|
737
|
+
if (this.props.onMouseDown(e), !this.props.allowAnyClick && (typeof e.button == "number" && e.button !== 0 || e.ctrlKey)) return !1;
|
|
738
|
+
let t = this.findDOMNode();
|
|
739
|
+
if (!t || !t.ownerDocument || !t.ownerDocument.body) throw Error("<DraggableCore> not mounted on DragStart!");
|
|
740
|
+
let { ownerDocument: n } = t;
|
|
741
|
+
if (this.props.disabled || !(e.target instanceof n.defaultView.Node) || this.props.handle && !dt(e.target, this.props.handle, t) || this.props.cancel && dt(e.target, this.props.cancel, t)) return;
|
|
742
|
+
e.type !== "touchstart" || this.props.allowMobileScroll || e.preventDefault();
|
|
743
|
+
let r = function(e) {
|
|
744
|
+
return e.targetTouches && e.targetTouches[0] ? e.targetTouches[0].identifier : e.changedTouches && e.changedTouches[0] ? e.changedTouches[0].identifier : void 0;
|
|
745
|
+
}(e);
|
|
746
|
+
this.touchIdentifier = r;
|
|
747
|
+
let i = Tt(e, r, this);
|
|
748
|
+
if (i == null) return;
|
|
749
|
+
let { x: a, y: o } = i, s = Et(this, a, o);
|
|
750
|
+
this.props.onStart, !1 !== this.props.onStart(e, s) && !1 !== this.mounted && (this.props.enableUserSelectHack && yt(n, this.props.nonce), this.dragging = !0, this.lastX = a, this.lastY = o, ft(n, jt.move, this.handleDrag), ft(n, jt.stop, this.handleDragStop));
|
|
751
|
+
}, this.handleDrag = (e) => {
|
|
752
|
+
let t = Tt(e, this.touchIdentifier, this);
|
|
753
|
+
if (t == null) return;
|
|
754
|
+
let { x: n, y: r } = t;
|
|
755
|
+
if (Array.isArray(this.props.grid)) {
|
|
756
|
+
let e = n - this.lastX, t = r - this.lastY;
|
|
757
|
+
if ([e, t] = St(this.props.grid, e, t), !e && !t) return;
|
|
758
|
+
n = this.lastX + e, r = this.lastY + t;
|
|
759
|
+
}
|
|
760
|
+
let i = Et(this, n, r);
|
|
761
|
+
if (!1 !== this.props.onDrag(e, i) && !1 !== this.mounted) this.lastX = n, this.lastY = r;
|
|
762
|
+
else try {
|
|
763
|
+
this.handleDragStop(new MouseEvent("mouseup"));
|
|
764
|
+
} catch {
|
|
765
|
+
let e = document.createEvent("MouseEvents");
|
|
766
|
+
e.initMouseEvent("mouseup", !0, !0, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), this.handleDragStop(e);
|
|
767
|
+
}
|
|
768
|
+
}, this.handleDragStop = (e) => {
|
|
769
|
+
if (!this.dragging) return;
|
|
770
|
+
let t = Tt(e, this.touchIdentifier, this);
|
|
771
|
+
if (t == null) return;
|
|
772
|
+
let { x: n, y: r } = t;
|
|
773
|
+
if (Array.isArray(this.props.grid)) {
|
|
774
|
+
let e = n - this.lastX || 0, t = r - this.lastY || 0;
|
|
775
|
+
[e, t] = St(this.props.grid, e, t), n = this.lastX + e, r = this.lastY + t;
|
|
776
|
+
}
|
|
777
|
+
let i = Et(this, n, r);
|
|
778
|
+
if (!1 === this.props.onStop(e, i) || !1 === this.mounted) return !1;
|
|
779
|
+
let a = this.findDOMNode();
|
|
780
|
+
a && this.props.enableUserSelectHack && bt(a.ownerDocument), this.dragging = !1, this.lastX = NaN, this.lastY = NaN, a && (pt(a.ownerDocument, jt.move, this.handleDrag), pt(a.ownerDocument, jt.stop, this.handleDragStop));
|
|
781
|
+
}, this.onMouseDown = (e) => (jt = At, this.handleDragStart(e)), this.onMouseUp = (e) => (jt = At, this.handleDragStop(e)), this.onTouchStart = (e) => (jt = kt, this.handleDragStart(e)), this.onTouchEnd = (e) => (jt = kt, this.handleDragStop(e));
|
|
782
|
+
}
|
|
783
|
+
componentDidMount() {
|
|
784
|
+
this.mounted = !0;
|
|
785
|
+
let e = this.findDOMNode();
|
|
786
|
+
e && ft(e, kt.start, this.onTouchStart, { passive: !1 });
|
|
787
|
+
}
|
|
788
|
+
componentWillUnmount() {
|
|
789
|
+
this.mounted = !1;
|
|
790
|
+
let e = this.findDOMNode();
|
|
791
|
+
if (e) {
|
|
792
|
+
let { ownerDocument: t } = e;
|
|
793
|
+
pt(t, At.move, this.handleDrag), pt(t, kt.move, this.handleDrag), pt(t, At.stop, this.handleDragStop), pt(t, kt.stop, this.handleDragStop), pt(e, kt.start, this.onTouchStart, { passive: !1 }), this.props.enableUserSelectHack && bt(t);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
findDOMNode() {
|
|
797
|
+
if (this.props?.nodeRef) return this.props.nodeRef.current;
|
|
798
|
+
let e = fe;
|
|
799
|
+
return typeof e.findDOMNode == "function" ? e.findDOMNode(this) : null;
|
|
800
|
+
}
|
|
801
|
+
render() {
|
|
802
|
+
return b.cloneElement(b.Children.only(this.props.children), {
|
|
803
|
+
onMouseDown: this.onMouseDown,
|
|
804
|
+
onMouseUp: this.onMouseUp,
|
|
805
|
+
onTouchEnd: this.onTouchEnd
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
Mt.displayName = "DraggableCore", Mt.propTypes = {
|
|
810
|
+
allowAnyClick: z.default.bool,
|
|
811
|
+
allowMobileScroll: z.default.bool,
|
|
812
|
+
children: z.default.node.isRequired,
|
|
813
|
+
disabled: z.default.bool,
|
|
814
|
+
enableUserSelectHack: z.default.bool,
|
|
815
|
+
offsetParent: function(e, t) {
|
|
816
|
+
if (e[t] && e[t].nodeType !== 1) throw Error("Draggable's offsetParent must be a DOM Node.");
|
|
817
|
+
},
|
|
818
|
+
grid: z.default.arrayOf(z.default.number),
|
|
819
|
+
handle: z.default.string,
|
|
820
|
+
cancel: z.default.string,
|
|
821
|
+
nodeRef: z.default.object,
|
|
822
|
+
nonce: z.default.string,
|
|
823
|
+
onStart: z.default.func,
|
|
824
|
+
onDrag: z.default.func,
|
|
825
|
+
onStop: z.default.func,
|
|
826
|
+
onMouseDown: z.default.func,
|
|
827
|
+
scale: z.default.number,
|
|
828
|
+
className: at,
|
|
829
|
+
style: at,
|
|
830
|
+
transform: at
|
|
831
|
+
}, Mt.defaultProps = {
|
|
832
|
+
allowAnyClick: !1,
|
|
833
|
+
allowMobileScroll: !1,
|
|
834
|
+
disabled: !1,
|
|
835
|
+
enableUserSelectHack: !0,
|
|
836
|
+
onStart: function() {},
|
|
837
|
+
onDrag: function() {},
|
|
838
|
+
onStop: function() {},
|
|
839
|
+
onMouseDown: function() {},
|
|
840
|
+
scale: 1
|
|
841
|
+
};
|
|
842
|
+
var Nt = class extends b.Component {
|
|
843
|
+
constructor(e) {
|
|
844
|
+
super(e), this.onDragStart = (e, t) => {
|
|
845
|
+
if (!1 === this.props.onStart(e, Dt(this, t))) return !1;
|
|
846
|
+
this.setState({
|
|
847
|
+
dragging: !0,
|
|
848
|
+
dragged: !0
|
|
849
|
+
});
|
|
850
|
+
}, this.onDrag = (e, t) => {
|
|
851
|
+
if (!this.state.dragging) return !1;
|
|
852
|
+
let n = Dt(this, t), r = {
|
|
853
|
+
x: n.x,
|
|
854
|
+
y: n.y,
|
|
855
|
+
slackX: 0,
|
|
856
|
+
slackY: 0
|
|
857
|
+
};
|
|
858
|
+
if (this.props.bounds) {
|
|
859
|
+
let { x: e, y: t } = r;
|
|
860
|
+
r.x += this.state.slackX, r.y += this.state.slackY;
|
|
861
|
+
let [i, a] = function(e, t, n) {
|
|
862
|
+
if (!e.props.bounds) return [t, n];
|
|
863
|
+
let { bounds: r } = e.props;
|
|
864
|
+
r = typeof r == "string" ? r : function(e) {
|
|
865
|
+
return {
|
|
866
|
+
left: e.left,
|
|
867
|
+
top: e.top,
|
|
868
|
+
right: e.right,
|
|
869
|
+
bottom: e.bottom
|
|
870
|
+
};
|
|
871
|
+
}(r);
|
|
872
|
+
let i = Ot(e);
|
|
873
|
+
if (typeof r == "string") {
|
|
874
|
+
let { ownerDocument: e } = i, t = e.defaultView;
|
|
875
|
+
if (!t) throw Error("Cannot resolve the owner window of the draggable node.");
|
|
876
|
+
let n;
|
|
877
|
+
if (n = r === "parent" ? i.parentNode : i.getRootNode().querySelector(r), !(n instanceof t.HTMLElement)) throw Error("Bounds selector \"" + r + "\" could not find an element.");
|
|
878
|
+
let a = n, o = t.getComputedStyle(i), s = t.getComputedStyle(a);
|
|
879
|
+
r = {
|
|
880
|
+
left: -i.offsetLeft + B(s.paddingLeft) + B(o.marginLeft),
|
|
881
|
+
top: -i.offsetTop + B(s.paddingTop) + B(o.marginTop),
|
|
882
|
+
right: _t(a) - ht(i) - i.offsetLeft + B(s.paddingRight) - B(o.marginRight),
|
|
883
|
+
bottom: gt(a) - mt(i) - i.offsetTop + B(s.paddingBottom) - B(o.marginBottom)
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
return it(r.right) && (t = Math.min(t, r.right)), it(r.bottom) && (n = Math.min(n, r.bottom)), it(r.left) && (t = Math.max(t, r.left)), it(r.top) && (n = Math.max(n, r.top)), [t, n];
|
|
887
|
+
}(this, r.x, r.y);
|
|
888
|
+
r.x = i, r.y = a, r.slackX = this.state.slackX + (e - r.x), r.slackY = this.state.slackY + (t - r.y), n.x = r.x, n.y = r.y, n.deltaX = r.x - this.state.x, n.deltaY = r.y - this.state.y;
|
|
889
|
+
}
|
|
890
|
+
if (!1 === this.props.onDrag(e, n)) return !1;
|
|
891
|
+
this.setState(r);
|
|
892
|
+
}, this.onDragStop = (e, t) => {
|
|
893
|
+
if (!this.state.dragging || !1 === this.props.onStop(e, Dt(this, t))) return !1;
|
|
894
|
+
let n = {
|
|
895
|
+
dragging: !1,
|
|
896
|
+
slackX: 0,
|
|
897
|
+
slackY: 0
|
|
898
|
+
};
|
|
899
|
+
if (this.props.position) {
|
|
900
|
+
let { x: e, y: t } = this.props.position;
|
|
901
|
+
n.x = e, n.y = t;
|
|
902
|
+
}
|
|
903
|
+
this.setState(n);
|
|
904
|
+
}, this.state = {
|
|
905
|
+
dragging: !1,
|
|
906
|
+
dragged: !1,
|
|
907
|
+
x: e.position ? e.position.x : e.defaultPosition.x,
|
|
908
|
+
y: e.position ? e.position.y : e.defaultPosition.y,
|
|
909
|
+
prevPropsPosition: { ...e.position },
|
|
910
|
+
slackX: 0,
|
|
911
|
+
slackY: 0,
|
|
912
|
+
isElementSVG: !1
|
|
913
|
+
}, !e.position || e.onDrag || e.onStop || console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.");
|
|
914
|
+
}
|
|
915
|
+
static getDerivedStateFromProps({ position: e }, { prevPropsPosition: t }) {
|
|
916
|
+
return !e || t && e.x === t.x && e.y === t.y ? null : {
|
|
917
|
+
x: e.x,
|
|
918
|
+
y: e.y,
|
|
919
|
+
prevPropsPosition: { ...e }
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
componentDidMount() {
|
|
923
|
+
window.SVGElement !== void 0 && this.findDOMNode() instanceof window.SVGElement && this.setState({ isElementSVG: !0 });
|
|
924
|
+
}
|
|
925
|
+
componentWillUnmount() {
|
|
926
|
+
this.state.dragging && this.setState({ dragging: !1 });
|
|
927
|
+
}
|
|
928
|
+
findDOMNode() {
|
|
929
|
+
if (this.props?.nodeRef) return this.props.nodeRef.current;
|
|
930
|
+
let e = fe;
|
|
931
|
+
return typeof e.findDOMNode == "function" ? e.findDOMNode(this) : null;
|
|
932
|
+
}
|
|
933
|
+
render() {
|
|
934
|
+
let { axis: e, bounds: t, children: n, defaultPosition: r, defaultClassName: i, defaultClassNameDragging: a, defaultClassNameDragged: o, position: s, positionOffset: c, scale: l, ...u } = this.props, d = {}, f = null, p = !s || this.state.dragging, m = s || r, h = {
|
|
935
|
+
x: Ct(this) && p ? this.state.x : m.x,
|
|
936
|
+
y: wt(this) && p ? this.state.y : m.y
|
|
937
|
+
};
|
|
938
|
+
this.state.isElementSVG ? f = function(e, t) {
|
|
939
|
+
return vt(e, t, "");
|
|
940
|
+
}(h, c) : d = function(e, t) {
|
|
941
|
+
let n = vt(e, t, "px");
|
|
942
|
+
return { [st("transform", ct)]: n };
|
|
943
|
+
}(h, c);
|
|
944
|
+
let g = b.Children.only(n), _ = Ce(g.props.className || "", i, {
|
|
945
|
+
[a]: this.state.dragging,
|
|
946
|
+
[o]: this.state.dragged
|
|
947
|
+
});
|
|
948
|
+
return b.createElement(Mt, {
|
|
949
|
+
...u,
|
|
950
|
+
onStart: this.onDragStart,
|
|
951
|
+
onDrag: this.onDrag,
|
|
952
|
+
onStop: this.onDragStop
|
|
953
|
+
}, b.cloneElement(g, {
|
|
954
|
+
className: _,
|
|
955
|
+
style: {
|
|
956
|
+
...g.props.style,
|
|
957
|
+
...d
|
|
958
|
+
},
|
|
959
|
+
transform: f
|
|
960
|
+
}));
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
Nt.displayName = "Draggable", Nt.propTypes = {
|
|
964
|
+
...Mt.propTypes,
|
|
965
|
+
axis: z.default.oneOf([
|
|
966
|
+
"both",
|
|
967
|
+
"x",
|
|
968
|
+
"y",
|
|
969
|
+
"none"
|
|
970
|
+
]),
|
|
971
|
+
bounds: z.default.oneOfType([
|
|
972
|
+
z.default.shape({
|
|
973
|
+
left: z.default.number,
|
|
974
|
+
right: z.default.number,
|
|
975
|
+
top: z.default.number,
|
|
976
|
+
bottom: z.default.number
|
|
977
|
+
}),
|
|
978
|
+
z.default.string,
|
|
979
|
+
z.default.oneOf([!1])
|
|
980
|
+
]),
|
|
981
|
+
defaultClassName: z.default.string,
|
|
982
|
+
defaultClassNameDragging: z.default.string,
|
|
983
|
+
defaultClassNameDragged: z.default.string,
|
|
984
|
+
defaultPosition: z.default.shape({
|
|
985
|
+
x: z.default.number,
|
|
986
|
+
y: z.default.number
|
|
987
|
+
}),
|
|
988
|
+
positionOffset: z.default.shape({
|
|
989
|
+
x: z.default.oneOfType([z.default.number, z.default.string]),
|
|
990
|
+
y: z.default.oneOfType([z.default.number, z.default.string])
|
|
991
|
+
}),
|
|
992
|
+
position: z.default.shape({
|
|
993
|
+
x: z.default.number,
|
|
994
|
+
y: z.default.number
|
|
995
|
+
}),
|
|
996
|
+
className: at,
|
|
997
|
+
style: at,
|
|
998
|
+
transform: at
|
|
999
|
+
}, Nt.defaultProps = {
|
|
1000
|
+
...Mt.defaultProps,
|
|
1001
|
+
axis: "both",
|
|
1002
|
+
bounds: !1,
|
|
1003
|
+
defaultClassName: "react-draggable",
|
|
1004
|
+
defaultClassNameDragging: "react-draggable-dragging",
|
|
1005
|
+
defaultClassNameDragged: "react-draggable-dragged",
|
|
1006
|
+
defaultPosition: {
|
|
1007
|
+
x: 0,
|
|
1008
|
+
y: 0
|
|
1009
|
+
},
|
|
1010
|
+
scale: 1
|
|
1011
|
+
};
|
|
1012
|
+
var Pt = Nt;
|
|
1013
|
+
$e();
|
|
1014
|
+
var Ft = {
|
|
1015
|
+
x: 0,
|
|
1016
|
+
y: 0
|
|
1017
|
+
}, It = w(C((e, t) => {
|
|
1018
|
+
let { defaultPosition: n = Ft, PaperComponent: r = u, onDragStop: i, rootSel: a = ".MuiModal-root", handleSel: o = ".draggable-title", titleSize: s, rootSize: c, ...l } = e, d = O(null), f = D(() => s?.width && s?.height && c?.width && c?.height ? {
|
|
1019
|
+
left: 0,
|
|
1020
|
+
top: 0,
|
|
1021
|
+
right: c.width - s.width,
|
|
1022
|
+
bottom: c.height - s.height
|
|
1023
|
+
} : null, [s, c]), [p, m] = k(null), [h, g] = k(null), _ = p ?? n ?? null;
|
|
1024
|
+
return v(Pt, {
|
|
1025
|
+
nodeRef: d,
|
|
1026
|
+
handle: o,
|
|
1027
|
+
cancel: "[class*=\"MuiDialogContent-root\"]",
|
|
1028
|
+
position: D(() => _ && f ? {
|
|
1029
|
+
x: Math.max(0, Math.min(_.x, f.right)),
|
|
1030
|
+
y: Math.max(0, Math.min(_.y, f.bottom))
|
|
1031
|
+
} : _, [_, f]) ?? void 0,
|
|
1032
|
+
bounds: f ?? ".MuiModal-root",
|
|
1033
|
+
enableUserSelectHack: !1,
|
|
1034
|
+
onStop: i,
|
|
1035
|
+
onStart: (e, t) => {
|
|
1036
|
+
let n = e;
|
|
1037
|
+
g({
|
|
1038
|
+
x: (n.clientX ?? n.touches?.[0]?.clientX) - t.x,
|
|
1039
|
+
y: (n.clientY ?? n.touches?.[0]?.clientY) - t.y
|
|
1040
|
+
});
|
|
1041
|
+
},
|
|
1042
|
+
onDrag: (e, t) => {
|
|
1043
|
+
let n = e;
|
|
1044
|
+
if (!h) return;
|
|
1045
|
+
let r = n.clientX ?? n.touches?.[0]?.clientX, i = n.clientY ?? n.touches?.[0]?.clientY;
|
|
1046
|
+
m({
|
|
1047
|
+
x: r - h.x,
|
|
1048
|
+
y: i - h.y
|
|
1049
|
+
});
|
|
1050
|
+
},
|
|
1051
|
+
children: v(r, {
|
|
1052
|
+
ref: Te([d, t]),
|
|
1053
|
+
...l
|
|
1054
|
+
})
|
|
1055
|
+
});
|
|
1056
|
+
})), Lt = {
|
|
1057
|
+
x: "50",
|
|
1058
|
+
y: "50"
|
|
1059
|
+
}, Rt = w(C((n, r) => {
|
|
1060
|
+
let i = g({
|
|
1061
|
+
props: n,
|
|
1062
|
+
name: "MuiDialog"
|
|
1063
|
+
}), a = h(), o = de(), d = {
|
|
1064
|
+
enter: .66 * a.transitions.duration.enteringScreen,
|
|
1065
|
+
exit: .66 * a.transitions.duration.leavingScreen
|
|
1066
|
+
}, { title: f = "SheetXL", onCancel: m, onDone: _, onShow: b, onShown: x, onHide: S, onClose: ee, open: C, autoFocusSel: w, children: D, transitionDuration: A = d, TransitionProps: M, slots: N = P.EmptyArray, slotProps: ne = P.EmptyArray, sx: F, className: ae, onMouseDown: se, initialPosition: L = Lt, isModal: fe = !1, suspendModal: me = !1, restoreFocus: he = !0, disableAutoDestroy: ge = !1, revealToken: _e, startHidden: ve = !1, ...ye } = i, be = N.transition ?? c, xe = N.backdrop ?? e, Se = N.paper ?? u, we = ne.transition;
|
|
1067
|
+
M && (we = {
|
|
1068
|
+
...M,
|
|
1069
|
+
...we
|
|
1070
|
+
});
|
|
1071
|
+
let Ee = ne.backdrop, De = ne.paper, [Oe, ke] = k(null), [je, Me] = k(!1), [Ne, Pe] = k(!1), Fe = O(null), [Ie, Le] = Ae(), Re = O(null), R = O(null), [ze, Be] = Ae(), Ve = O(null), He = te();
|
|
1072
|
+
E(() => {
|
|
1073
|
+
Oe && !ve && Me(!!C);
|
|
1074
|
+
}, [
|
|
1075
|
+
C,
|
|
1076
|
+
Oe,
|
|
1077
|
+
ve
|
|
1078
|
+
]);
|
|
1079
|
+
let Ue = I(() => {
|
|
1080
|
+
m?.(), Me(!1);
|
|
1081
|
+
}, [m]);
|
|
1082
|
+
E(() => {
|
|
1083
|
+
if (Oe) return;
|
|
1084
|
+
let e = Re.current, t = Ve.current;
|
|
1085
|
+
if (!e || !t) return;
|
|
1086
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
1087
|
+
if (n.width === 0 && n.height === 0 || r.width === 0 && r.height === 0) return;
|
|
1088
|
+
let i = n.height - r.height, a = n.width - r.width, o = .5 * a, s = .5 * i;
|
|
1089
|
+
typeof L?.x == "number" ? o = L.x : typeof L?.x == "string" && (o = a * (parseFloat(L.x) / 100)), typeof L?.y == "number" ? s = L.y : typeof L?.y == "string" && (s = i * (parseFloat(L.y) / 100)), ke({
|
|
1090
|
+
x: o,
|
|
1091
|
+
y: s
|
|
1092
|
+
});
|
|
1093
|
+
});
|
|
1094
|
+
let [We, Ke] = k(!1), [qe, Je] = k(null), [Xe, Ze] = k(null), Qe = I((e) => {
|
|
1095
|
+
if (qe) return qe.focus(e), !0;
|
|
1096
|
+
if (w) {
|
|
1097
|
+
let t = R.current?.querySelectorAll?.(w);
|
|
1098
|
+
if (t && t.length > 0) return t[0]?.focus?.(e), !0;
|
|
1099
|
+
}
|
|
1100
|
+
return R.current?.focus?.(e), !1;
|
|
1101
|
+
}, [qe, w]), $e = ue(r, () => ({ focus: (e) => {
|
|
1102
|
+
Qe(e);
|
|
1103
|
+
} }), []), et = O(_e);
|
|
1104
|
+
T(() => {
|
|
1105
|
+
_e !== et.current && (et.current = _e, Me(!0));
|
|
1106
|
+
}, [_e]);
|
|
1107
|
+
let tt = {
|
|
1108
|
+
...we,
|
|
1109
|
+
onExited: (e) => {
|
|
1110
|
+
_?.(null), ge || we?.onExited?.(e);
|
|
1111
|
+
},
|
|
1112
|
+
onExit: (e) => {
|
|
1113
|
+
let t = Xe, n = typeof he == "function" ? he() : he;
|
|
1114
|
+
t && !1 !== n && requestAnimationFrame(() => {
|
|
1115
|
+
$e.current?.contains(document.activeElement) && t.focus();
|
|
1116
|
+
}), S?.(), Pe(!1), we?.onExit?.(e);
|
|
1117
|
+
},
|
|
1118
|
+
onEntered: (e, t) => {
|
|
1119
|
+
b?.(), we?.onEntered?.(e, t);
|
|
1120
|
+
},
|
|
1121
|
+
onEntering: (e, t) => {
|
|
1122
|
+
Pe(!0), x?.($e.current);
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
T(() => {
|
|
1126
|
+
Ne && Qe();
|
|
1127
|
+
}, [Ne]);
|
|
1128
|
+
let z = v(p, {
|
|
1129
|
+
open: Ne,
|
|
1130
|
+
disableAutoFocus: !0,
|
|
1131
|
+
disableEnforceFocus: !We,
|
|
1132
|
+
disableRestoreFocus: !0 !== he,
|
|
1133
|
+
children: v(be, {
|
|
1134
|
+
in: je,
|
|
1135
|
+
timeout: A,
|
|
1136
|
+
role: "presentation",
|
|
1137
|
+
...tt,
|
|
1138
|
+
children: v(t, {
|
|
1139
|
+
className: "MuiDialog-container",
|
|
1140
|
+
ref: R,
|
|
1141
|
+
tabIndex: 0,
|
|
1142
|
+
sx: {
|
|
1143
|
+
outline: "none",
|
|
1144
|
+
position: "relative"
|
|
1145
|
+
},
|
|
1146
|
+
onKeyDown: (e) => {
|
|
1147
|
+
e.which === ie.Escape && (Ue(), Fe.current?.start(e, { center: !1 }), setTimeout(() => Fe.current?.stop(e), 180)), e.stopPropagation();
|
|
1148
|
+
},
|
|
1149
|
+
children: y(It, {
|
|
1150
|
+
ref: Te([Ve, r]),
|
|
1151
|
+
className: Ce({ "Mui-focusVisible": We }, ae, "draggable"),
|
|
1152
|
+
sx: {
|
|
1153
|
+
"& *": (e) => Ge(e),
|
|
1154
|
+
pointerEvents: "auto",
|
|
1155
|
+
userSelect: "none",
|
|
1156
|
+
backgroundColor: "var(--sxl-color-elevated, var(--sxl-color-base-100))",
|
|
1157
|
+
border: "1px solid var(--sxl-color-elevated-border, transparent)",
|
|
1158
|
+
"&:hover:not([disabled]):not(.Mui-focusVisible)": { outline: (e) => `solid ${j(e.palette.text?.primary, .2)} 1px` },
|
|
1159
|
+
"&.Mui-focusVisible": { outline: (e) => `solid ${j(e.palette.text?.primary, .2)} 1px` },
|
|
1160
|
+
position: "absolute",
|
|
1161
|
+
maxWidth: "100%",
|
|
1162
|
+
...F
|
|
1163
|
+
},
|
|
1164
|
+
defaultPosition: Oe,
|
|
1165
|
+
titleSize: Be,
|
|
1166
|
+
rootSize: Le,
|
|
1167
|
+
PaperComponent: Se,
|
|
1168
|
+
...ye,
|
|
1169
|
+
...De,
|
|
1170
|
+
children: [f ? v(s, {
|
|
1171
|
+
className: Ce({ "Mui-selected": We }, "draggable-title"),
|
|
1172
|
+
sx: {
|
|
1173
|
+
cursor: "move",
|
|
1174
|
+
display: "flex",
|
|
1175
|
+
color: (e) => e.palette.text.secondary,
|
|
1176
|
+
boxSizing: "border-box",
|
|
1177
|
+
padding: "0 0",
|
|
1178
|
+
transitionProperty: "opacity",
|
|
1179
|
+
transitionDuration: (e) => `${e.transitions.duration.shortest}ms`,
|
|
1180
|
+
opacity: .7,
|
|
1181
|
+
"&.Mui-selected": {
|
|
1182
|
+
opacity: 1,
|
|
1183
|
+
transitionDuration: (e) => e.transitions.duration.shortest / 2 + "ms"
|
|
1184
|
+
},
|
|
1185
|
+
backgroundColor: (e) => j(e.palette.action.hover, .03)
|
|
1186
|
+
},
|
|
1187
|
+
ref: ze,
|
|
1188
|
+
children: y(t, {
|
|
1189
|
+
sx: {
|
|
1190
|
+
display: "flex",
|
|
1191
|
+
flex: "1 1 10%",
|
|
1192
|
+
flexDirection: "row",
|
|
1193
|
+
alignItems: "center",
|
|
1194
|
+
marginTop: (e) => e.spacing(1),
|
|
1195
|
+
marginLeft: (e) => e.spacing(1),
|
|
1196
|
+
marginRight: (e) => e.spacing(1)
|
|
1197
|
+
},
|
|
1198
|
+
children: [v(t, {
|
|
1199
|
+
sx: {
|
|
1200
|
+
flex: "1 1 100%",
|
|
1201
|
+
paddingLeft: (e) => e.spacing(1)
|
|
1202
|
+
},
|
|
1203
|
+
children: f
|
|
1204
|
+
}), v(Ye, {
|
|
1205
|
+
label: o("window.close"),
|
|
1206
|
+
children: v(l, {
|
|
1207
|
+
"aria-label": "close",
|
|
1208
|
+
sx: { color: (e) => e.palette.text.icon ?? e.palette.action.active },
|
|
1209
|
+
touchRippleRef: Fe,
|
|
1210
|
+
onPointerDown: (e) => {
|
|
1211
|
+
Fe.current?.start(e, { center: !1 }), e.stopPropagation(), e.preventDefault();
|
|
1212
|
+
},
|
|
1213
|
+
onPointerUp: Ue,
|
|
1214
|
+
children: v(re, { iconKey: "Close" })
|
|
1215
|
+
})
|
|
1216
|
+
})]
|
|
1217
|
+
})
|
|
1218
|
+
}) : null, D]
|
|
1219
|
+
})
|
|
1220
|
+
})
|
|
1221
|
+
})
|
|
1222
|
+
}), nt = null;
|
|
1223
|
+
fe && !me && (nt = v(xe, {
|
|
1224
|
+
...Ee,
|
|
1225
|
+
open: je,
|
|
1226
|
+
onMouseDown: (e) => {
|
|
1227
|
+
Ue(), Ee?.onMouseDown?.(e);
|
|
1228
|
+
},
|
|
1229
|
+
onClick: (e) => {
|
|
1230
|
+
ee?.(e, "backdropClick"), Ee?.onClick?.(e);
|
|
1231
|
+
},
|
|
1232
|
+
sx: {
|
|
1233
|
+
pointerEvents: "auto",
|
|
1234
|
+
...Ee?.sx
|
|
1235
|
+
}
|
|
1236
|
+
}));
|
|
1237
|
+
let { getPortalContainer: rt } = le(), { className: it, attrs: B } = oe(ce()?.themeScope);
|
|
1238
|
+
return pe(y(t, {
|
|
1239
|
+
className: Ce("MuiModal-root", it),
|
|
1240
|
+
...B,
|
|
1241
|
+
sx: {
|
|
1242
|
+
position: "fixed",
|
|
1243
|
+
zIndex: "1300",
|
|
1244
|
+
right: "0",
|
|
1245
|
+
bottom: "0",
|
|
1246
|
+
top: "0",
|
|
1247
|
+
left: "0",
|
|
1248
|
+
outline: "0",
|
|
1249
|
+
display: "block",
|
|
1250
|
+
pointerEvents: "none"
|
|
1251
|
+
},
|
|
1252
|
+
ref: Te([
|
|
1253
|
+
$e,
|
|
1254
|
+
Ie,
|
|
1255
|
+
Re
|
|
1256
|
+
]),
|
|
1257
|
+
onPointerDown: (e) => {
|
|
1258
|
+
We && (e.target === R.current || e.target.tabIndex < 0) && R.current?.contains(document.activeElement);
|
|
1259
|
+
},
|
|
1260
|
+
onContextMenu: (e) => {
|
|
1261
|
+
e.isPropagationStopped() || e.preventDefault();
|
|
1262
|
+
},
|
|
1263
|
+
onFocus: (e) => {
|
|
1264
|
+
!We && (e.target === R.current || e.target.tabIndex < 0) && setTimeout(() => {
|
|
1265
|
+
Qe();
|
|
1266
|
+
}, 100), Ke(!0), R.current?.contains(e.target) && e.target !== R.current && Je(e.target), e.relatedTarget && !Xe && Ze(e.relatedTarget);
|
|
1267
|
+
},
|
|
1268
|
+
onBlur: (e) => {
|
|
1269
|
+
$e?.current?.contains(e.relatedTarget) || (Ze(null), Ke(!1));
|
|
1270
|
+
},
|
|
1271
|
+
children: [nt, z]
|
|
1272
|
+
}), rt(), He);
|
|
1273
|
+
})), V = typeof window < "u" ? window : {
|
|
1274
|
+
screen: {},
|
|
1275
|
+
navigator: {}
|
|
1276
|
+
}, zt = (V.matchMedia || function() {
|
|
1277
|
+
return { matches: !1 };
|
|
1278
|
+
}).bind(V), Bt = { get passive() {
|
|
1279
|
+
return !0;
|
|
1280
|
+
} }, Vt = function() {};
|
|
1281
|
+
V.addEventListener && V.addEventListener("p", Vt, Bt), V.removeEventListener && V.removeEventListener("p", Vt, !1);
|
|
1282
|
+
var Ht = "ontouchstart" in V, Ut = Ht || "TouchEvent" in V && zt("(any-pointer: coarse)").matches, Wt = (V.navigator.maxTouchPoints || 0) > 0 || Ut, Gt = V.navigator.userAgent || "", Kt = zt("(pointer: coarse)").matches && /iPad|Macintosh/.test(Gt) && Math.min(V.screen.width || 0, V.screen.height || 0) >= 768, qt = (zt("(pointer: coarse)").matches || !zt("(pointer: fine)").matches && Ht) && !/Windows.*Firefox/.test(Gt), Jt = zt("(any-pointer: fine)").matches || zt("(any-hover: hover)").matches || Kt || !Ht, Yt = !Wt || !Jt && qt ? Wt ? "touchOnly" : "mouseOnly" : "hybrid", Xt = Yt === "mouseOnly" ? "mouse" : Yt === "touchOnly" || qt ? "touch" : "mouse", Zt = (e) => e.type === "checkbox", Qt = (e) => e.type === "file", $t = (e) => e instanceof Date, H = (e) => e == null, en = (e) => typeof e == "object", U = (e) => !H(e) && !Array.isArray(e) && en(e) && !$t(e), tn = (e) => {
|
|
1283
|
+
let t = e.constructor && e.constructor.prototype;
|
|
1284
|
+
return U(t) && t.hasOwnProperty("isPrototypeOf");
|
|
1285
|
+
}, nn = typeof window < "u" && window.HTMLElement !== void 0 && typeof document < "u";
|
|
1286
|
+
function W(e) {
|
|
1287
|
+
if (e instanceof Date) return new Date(e);
|
|
1288
|
+
let t = typeof FileList < "u" && e instanceof FileList;
|
|
1289
|
+
if (nn && (e instanceof Blob || t)) return e;
|
|
1290
|
+
let n = Array.isArray(e);
|
|
1291
|
+
if (!(n || U(e) && tn(e))) return e;
|
|
1292
|
+
let r = n ? [] : Object.create(Object.getPrototypeOf(e));
|
|
1293
|
+
for (let t in e) Object.prototype.hasOwnProperty.call(e, t) && (r[t] = W(e[t]));
|
|
1294
|
+
return r;
|
|
1295
|
+
}
|
|
1296
|
+
var rn = "blur", an = "focusout", on = "submit", sn = "trigger", cn = "valid", ln = "onBlur", un = "onChange", dn = "onSubmit", fn = "onTouched", pn = "all", mn = "max", hn = "min", gn = "maxLength", _n = "minLength", vn = "pattern", yn = "required", bn = "validate", xn = "root", Sn = [
|
|
1297
|
+
"__proto__",
|
|
1298
|
+
"constructor",
|
|
1299
|
+
"prototype"
|
|
1300
|
+
], Cn = /^\w*$/, wn = (e) => Cn.test(e), G = (e) => e === void 0, Tn = /[.[\]'"]/, En = (e) => e.split(Tn).filter(Boolean), K = (e, t, n) => {
|
|
1301
|
+
if (!t || !U(e)) return n;
|
|
1302
|
+
let r = wn(t) ? [t] : En(t);
|
|
1303
|
+
if (r.some((e) => Sn.includes(e))) return n;
|
|
1304
|
+
let i = r.reduce((e, t) => H(e) ? void 0 : e[t], e);
|
|
1305
|
+
return G(i) || i === e ? G(e[t]) ? n : e[t] : i;
|
|
1306
|
+
}, q = (e) => typeof e == "boolean", J = (e) => typeof e == "function", Y = (e, t, n) => {
|
|
1307
|
+
let r = -1, i = wn(t) ? [t] : En(t), a = i.length, o = a - 1;
|
|
1308
|
+
for (; ++r < a;) {
|
|
1309
|
+
let t = i[r], a = n;
|
|
1310
|
+
if (r !== o) {
|
|
1311
|
+
let n = e[t];
|
|
1312
|
+
a = U(n) || Array.isArray(n) ? n : isNaN(+i[r + 1]) ? {} : [];
|
|
1313
|
+
}
|
|
1314
|
+
if (Sn.includes(t)) return;
|
|
1315
|
+
e[t] = a, e = e[t];
|
|
1316
|
+
}
|
|
1317
|
+
}, Dn = x.createContext(null);
|
|
1318
|
+
Dn.displayName = "HookFormControlContext";
|
|
1319
|
+
var On = nn ? x.useLayoutEffect : x.useEffect, X = (e) => typeof e == "string", kn = (e) => H(e) || !en(e), An = (e, t) => t.length === 0 && !Array.isArray(e) && !tn(e);
|
|
1320
|
+
function Z(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
1321
|
+
if (e === t) return !0;
|
|
1322
|
+
if (kn(e) || kn(t)) return Object.is(e, t);
|
|
1323
|
+
if ($t(e) && $t(t)) return Object.is(e.getTime(), t.getTime());
|
|
1324
|
+
let r = Object.keys(e), i = Object.keys(t);
|
|
1325
|
+
if (r.length !== i.length) return !1;
|
|
1326
|
+
if (An(e, r) || An(t, i)) return Object.is(e, t);
|
|
1327
|
+
if (!r.length && Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
1328
|
+
let a = n.get(e);
|
|
1329
|
+
if (a && a.has(t)) return !0;
|
|
1330
|
+
if (a) a.add(t);
|
|
1331
|
+
else {
|
|
1332
|
+
let r = /* @__PURE__ */ new WeakSet();
|
|
1333
|
+
r.add(t), n.set(e, r);
|
|
1334
|
+
}
|
|
1335
|
+
for (let i of r) {
|
|
1336
|
+
let r = e[i];
|
|
1337
|
+
if (!(i in t)) return !1;
|
|
1338
|
+
if (i !== "ref") {
|
|
1339
|
+
let e = t[i];
|
|
1340
|
+
if ($t(r) && $t(e) || (U(r) || Array.isArray(r)) && (U(e) || Array.isArray(e)) ? !Z(r, e, n) : !Object.is(r, e)) return !1;
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
return !0;
|
|
1344
|
+
}
|
|
1345
|
+
var jn = (e) => ({
|
|
1346
|
+
isOnSubmit: !e || e === dn,
|
|
1347
|
+
isOnBlur: e === ln,
|
|
1348
|
+
isOnChange: e === un,
|
|
1349
|
+
isOnAll: e === pn,
|
|
1350
|
+
isOnTouch: e === fn
|
|
1351
|
+
}), Mn = (e, t, n) => {
|
|
1352
|
+
if (n) return !1;
|
|
1353
|
+
if (t.watchAll || t.watch.has(e)) return !0;
|
|
1354
|
+
for (let n of t.watch) if (e.startsWith(n) && e.charAt(n.length) === ".") return !0;
|
|
1355
|
+
return !1;
|
|
1356
|
+
}, Nn = (e, t, n, r) => {
|
|
1357
|
+
for (let i of n || Object.keys(e)) {
|
|
1358
|
+
let n = K(e, i);
|
|
1359
|
+
if (n) {
|
|
1360
|
+
let { _f: e, ...a } = n;
|
|
1361
|
+
if (e) {
|
|
1362
|
+
if (e.refs && e.refs[0] && t(e.refs[0], i) && !r || e.ref && t(e.ref, e.name) && !r) return !0;
|
|
1363
|
+
if (Nn(a, t)) break;
|
|
1364
|
+
} else if (U(a) && Nn(a, t)) break;
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
}, Pn = (e, t, n) => {
|
|
1368
|
+
let r = K(e, n), i = Array.isArray(r) ? r : [];
|
|
1369
|
+
return Y(i, xn, t[n]), Y(e, n, i), e;
|
|
1370
|
+
}, Q = (e) => U(e) && !Object.keys(e).length, Fn = (e) => {
|
|
1371
|
+
if (!nn) return !1;
|
|
1372
|
+
let t = e ? e.ownerDocument : 0;
|
|
1373
|
+
return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
|
|
1374
|
+
}, In = (e) => e.type === "radio", Ln = (e) => e instanceof RegExp, Rn = (e, t, n, r, i) => t ? {
|
|
1375
|
+
...n[e],
|
|
1376
|
+
types: {
|
|
1377
|
+
...n[e] && n[e].types ? n[e].types : {},
|
|
1378
|
+
[r]: i || !0
|
|
1379
|
+
}
|
|
1380
|
+
} : {}, zn = {
|
|
1381
|
+
value: !1,
|
|
1382
|
+
isValid: !1
|
|
1383
|
+
}, Bn = {
|
|
1384
|
+
value: !0,
|
|
1385
|
+
isValid: !0
|
|
1386
|
+
}, Vn = (e) => {
|
|
1387
|
+
if (Array.isArray(e)) {
|
|
1388
|
+
if (e.length > 1) {
|
|
1389
|
+
let t = e.filter((e) => e && e.checked && !e.disabled).map((e) => e.value);
|
|
1390
|
+
return {
|
|
1391
|
+
value: t,
|
|
1392
|
+
isValid: !!t.length
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
return e[0].checked && !e[0].disabled ? e[0].attributes && !G(e[0].attributes.value) ? G(e[0].value) || e[0].value === "" ? Bn : {
|
|
1396
|
+
value: e[0].value,
|
|
1397
|
+
isValid: !0
|
|
1398
|
+
} : Bn : zn;
|
|
1399
|
+
}
|
|
1400
|
+
return zn;
|
|
1401
|
+
}, Hn = {
|
|
1402
|
+
isValid: !1,
|
|
1403
|
+
value: null
|
|
1404
|
+
}, Un = (e) => Array.isArray(e) ? e.reduce((e, t) => t && t.checked && !t.disabled ? {
|
|
1405
|
+
isValid: !0,
|
|
1406
|
+
value: t.value
|
|
1407
|
+
} : e, Hn) : Hn;
|
|
1408
|
+
function Wn(e, t, n = "validate") {
|
|
1409
|
+
if (X(e) || Array.isArray(e) && e.every(X) || q(e) && !e) return {
|
|
1410
|
+
type: n,
|
|
1411
|
+
message: X(e) ? e : "",
|
|
1412
|
+
ref: t
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
var Gn = (e) => U(e) && !Ln(e) ? e : {
|
|
1416
|
+
value: e,
|
|
1417
|
+
message: ""
|
|
1418
|
+
}, Kn = async (e, t, n, r, i, a) => {
|
|
1419
|
+
let { ref: o, refs: s, required: c, maxLength: l, minLength: u, min: d, max: f, pattern: p, validate: m, name: h, valueAsNumber: g, mount: _ } = e._f, v = K(n, h);
|
|
1420
|
+
if (!_ || t.has(h)) return {};
|
|
1421
|
+
let y = s ? s[0] : o, b = (e) => {
|
|
1422
|
+
if (i && y.reportValidity) {
|
|
1423
|
+
let t = q(e) ? "" : e || "";
|
|
1424
|
+
s ? s.forEach((e) => e.setCustomValidity(t)) : y.setCustomValidity(t), y.reportValidity();
|
|
1425
|
+
}
|
|
1426
|
+
}, x = {}, S = In(o), ee = Zt(o), C = S || ee, w = (g || Qt(o)) && G(o.value) && G(v) || Fn(o) && o.value === "" || v === "" || Array.isArray(v) && !v.length, T = Rn.bind(null, h, r, x), te = (e, t, n, r = gn, i = _n) => {
|
|
1427
|
+
let a = e ? t : n;
|
|
1428
|
+
x[h] = {
|
|
1429
|
+
type: e ? r : i,
|
|
1430
|
+
message: a,
|
|
1431
|
+
ref: o,
|
|
1432
|
+
...T(e ? r : i, a)
|
|
1433
|
+
};
|
|
1434
|
+
};
|
|
1435
|
+
if (a ? !Array.isArray(v) || !v.length : c && (!C && (w || H(v)) || q(v) && !v || ee && !Vn(s).isValid || S && !Un(s).isValid)) {
|
|
1436
|
+
let { value: e, message: t } = X(c) ? {
|
|
1437
|
+
value: !!c,
|
|
1438
|
+
message: c
|
|
1439
|
+
} : Gn(c);
|
|
1440
|
+
if (e && (x[h] = {
|
|
1441
|
+
type: yn,
|
|
1442
|
+
message: t,
|
|
1443
|
+
ref: y,
|
|
1444
|
+
...T(yn, t)
|
|
1445
|
+
}, !r)) return b(t), x;
|
|
1446
|
+
}
|
|
1447
|
+
if (!(w || H(d) && H(f))) {
|
|
1448
|
+
let e, t, n = Gn(f), i = Gn(d);
|
|
1449
|
+
if (H(v) || isNaN(v)) {
|
|
1450
|
+
let r = o.valueAsDate || new Date(v), a = (e) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + e), s = o.type == "time", c = o.type == "week";
|
|
1451
|
+
X(n.value) && v && (e = s ? a(v) > a(n.value) : c ? v > n.value : r > new Date(n.value)), X(i.value) && v && (t = s ? a(v) < a(i.value) : c ? v < i.value : r < new Date(i.value));
|
|
1452
|
+
} else {
|
|
1453
|
+
let r = o.valueAsNumber || v && +v;
|
|
1454
|
+
H(n.value) || (e = r > n.value), H(i.value) || (t = r < i.value);
|
|
1455
|
+
}
|
|
1456
|
+
if ((e || t) && (te(!!e, n.message, i.message, mn, hn), !r)) return b(x[h].message), x;
|
|
1457
|
+
}
|
|
1458
|
+
if ((l || u) && !w && (X(v) || a && Array.isArray(v))) {
|
|
1459
|
+
let e = Gn(l), t = Gn(u), n = !H(e.value) && v.length > +e.value, i = !H(t.value) && v.length < +t.value;
|
|
1460
|
+
if ((n || i) && (te(n, e.message, t.message), !r)) return b(x[h].message), x;
|
|
1461
|
+
}
|
|
1462
|
+
if (p && !w && X(v)) {
|
|
1463
|
+
let { value: e, message: t } = Gn(p);
|
|
1464
|
+
if (Ln(e) && !v.match(e) && (x[h] = {
|
|
1465
|
+
type: vn,
|
|
1466
|
+
message: t,
|
|
1467
|
+
ref: o,
|
|
1468
|
+
...T(vn, t)
|
|
1469
|
+
}, !r)) return b(t), x;
|
|
1470
|
+
}
|
|
1471
|
+
if (m) {
|
|
1472
|
+
if (J(m)) {
|
|
1473
|
+
let e = Wn(await m(v, n), y);
|
|
1474
|
+
if (e && (x[h] = {
|
|
1475
|
+
...e,
|
|
1476
|
+
...T(bn, e.message)
|
|
1477
|
+
}, !r)) return b(e.message), x;
|
|
1478
|
+
} else if (U(m)) {
|
|
1479
|
+
let e = {};
|
|
1480
|
+
for (let t in m) {
|
|
1481
|
+
if (!Q(e) && !r) break;
|
|
1482
|
+
let i = Wn(await m[t](v, n), y, t);
|
|
1483
|
+
i && (e = {
|
|
1484
|
+
...i,
|
|
1485
|
+
...T(t, i.message)
|
|
1486
|
+
}, b(i.message), r && (x[h] = e));
|
|
1487
|
+
}
|
|
1488
|
+
if (!Q(e) && (x[h] = {
|
|
1489
|
+
ref: y,
|
|
1490
|
+
...e
|
|
1491
|
+
}, !r)) return x;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
return b(!0), x;
|
|
1495
|
+
}, qn = (e) => Array.isArray(e) ? e : [e], Jn = (e) => Array.isArray(e) ? e.filter(Boolean) : [];
|
|
1496
|
+
function $(e, t) {
|
|
1497
|
+
if (X(t) && Object.prototype.hasOwnProperty.call(e, t)) return delete e[t], e;
|
|
1498
|
+
let n = Array.isArray(t) ? t : wn(t) ? [t] : En(t);
|
|
1499
|
+
if (n.some((e) => Sn.includes(String(e)))) return e;
|
|
1500
|
+
let r = n.length === 1 ? e : function(e, t) {
|
|
1501
|
+
let n = t.slice(0, -1).length, r = 0;
|
|
1502
|
+
for (; r < n;) {
|
|
1503
|
+
if (H(e)) {
|
|
1504
|
+
e = void 0;
|
|
1505
|
+
break;
|
|
1506
|
+
}
|
|
1507
|
+
e = e[t[r]], r++;
|
|
1508
|
+
}
|
|
1509
|
+
return e;
|
|
1510
|
+
}(e, n), i = n.length - 1, a = n[i];
|
|
1511
|
+
return r && delete r[a], i !== 0 && (U(r) && Q(r) || Array.isArray(r) && function(e) {
|
|
1512
|
+
for (let t in e) if (e.hasOwnProperty(t) && !G(e[t])) return !1;
|
|
1513
|
+
return !0;
|
|
1514
|
+
}(r)) && $(e, n.slice(0, -1)), e;
|
|
1515
|
+
}
|
|
1516
|
+
var Yn = (e) => {
|
|
1517
|
+
let t = {};
|
|
1518
|
+
for (let n of Object.keys(e)) if (en(e[n]) && e[n] !== null && !$t(e[n])) {
|
|
1519
|
+
let r = Yn(e[n]);
|
|
1520
|
+
for (let e of Object.keys(r)) t[`${n}.${e}`] = r[e];
|
|
1521
|
+
} else t[n] = e[n];
|
|
1522
|
+
return t;
|
|
1523
|
+
}, Xn = x.createContext(null);
|
|
1524
|
+
Xn.displayName = "HookFormContext";
|
|
1525
|
+
var Zn = ({ children: e, watch: t, getValues: n, getFieldState: r, setError: i, clearErrors: a, setValue: o, setValues: s, trigger: c, formState: l, resetField: u, reset: d, resetDefaultValues: f, handleSubmit: p, unregister: m, control: h, register: g, setFocus: _, subscribe: v }) => {
|
|
1526
|
+
let y = x.useMemo(() => ({
|
|
1527
|
+
watch: t,
|
|
1528
|
+
getValues: n,
|
|
1529
|
+
getFieldState: r,
|
|
1530
|
+
setError: i,
|
|
1531
|
+
clearErrors: a,
|
|
1532
|
+
setValue: o,
|
|
1533
|
+
setValues: s,
|
|
1534
|
+
trigger: c,
|
|
1535
|
+
formState: l,
|
|
1536
|
+
resetField: u,
|
|
1537
|
+
reset: d,
|
|
1538
|
+
resetDefaultValues: f,
|
|
1539
|
+
handleSubmit: p,
|
|
1540
|
+
unregister: m,
|
|
1541
|
+
control: h,
|
|
1542
|
+
register: g,
|
|
1543
|
+
setFocus: _,
|
|
1544
|
+
subscribe: v
|
|
1545
|
+
}), [
|
|
1546
|
+
a,
|
|
1547
|
+
h,
|
|
1548
|
+
l,
|
|
1549
|
+
r,
|
|
1550
|
+
n,
|
|
1551
|
+
p,
|
|
1552
|
+
g,
|
|
1553
|
+
d,
|
|
1554
|
+
f,
|
|
1555
|
+
u,
|
|
1556
|
+
i,
|
|
1557
|
+
_,
|
|
1558
|
+
o,
|
|
1559
|
+
s,
|
|
1560
|
+
v,
|
|
1561
|
+
c,
|
|
1562
|
+
m,
|
|
1563
|
+
t
|
|
1564
|
+
]);
|
|
1565
|
+
return x.createElement(Xn.Provider, { value: y }, x.createElement(Dn.Provider, { value: y.control }, e));
|
|
1566
|
+
}, Qn = () => {
|
|
1567
|
+
let e = [];
|
|
1568
|
+
return {
|
|
1569
|
+
get observers() {
|
|
1570
|
+
return e;
|
|
1571
|
+
},
|
|
1572
|
+
next: (t) => {
|
|
1573
|
+
for (let n of e) n.next && n.next(t);
|
|
1574
|
+
},
|
|
1575
|
+
subscribe: (t) => (e.push(t), { unsubscribe: () => {
|
|
1576
|
+
e = e.filter((e) => e !== t);
|
|
1577
|
+
} }),
|
|
1578
|
+
unsubscribe: () => {
|
|
1579
|
+
e = [];
|
|
1580
|
+
}
|
|
1581
|
+
};
|
|
1582
|
+
};
|
|
1583
|
+
function $n(e, t) {
|
|
1584
|
+
let n = {};
|
|
1585
|
+
for (let r in e) if (e.hasOwnProperty(r)) {
|
|
1586
|
+
let i = e[r], a = t[r];
|
|
1587
|
+
if (i && U(i) && a) {
|
|
1588
|
+
let e = $n(i, a);
|
|
1589
|
+
U(e) && (n[r] = e);
|
|
1590
|
+
} else e[r] && (n[r] = a);
|
|
1591
|
+
}
|
|
1592
|
+
return n;
|
|
1593
|
+
}
|
|
1594
|
+
var er = (e) => e.type === "select-multiple", tr = (e) => Fn(e) && e.isConnected;
|
|
1595
|
+
function nr(e) {
|
|
1596
|
+
return Array.isArray(e) || U(e) && !((e) => {
|
|
1597
|
+
for (let t in e) if (J(e[t])) return !0;
|
|
1598
|
+
return !1;
|
|
1599
|
+
})(e);
|
|
1600
|
+
}
|
|
1601
|
+
function rr(e) {
|
|
1602
|
+
return !(!e || !("_f" in e));
|
|
1603
|
+
}
|
|
1604
|
+
function ir(e) {
|
|
1605
|
+
return Array.isArray(e) ? !e.some((e) => !G(e)) : !Object.keys(e).length;
|
|
1606
|
+
}
|
|
1607
|
+
function ar(e, t) {
|
|
1608
|
+
Array.isArray(e) ? e[t] = void 0 : delete e[t];
|
|
1609
|
+
}
|
|
1610
|
+
function or(e, t = {}, n) {
|
|
1611
|
+
for (let r in e) {
|
|
1612
|
+
let i = e[r], a = n && n[r];
|
|
1613
|
+
!nr(i) || Array.isArray(i) && rr(a) ? G(i) || (t[r] = !0) : (t[r] = Array.isArray(i) ? [] : {}, or(i, t[r], a), ir(t[r]) && ar(t, r));
|
|
1614
|
+
}
|
|
1615
|
+
return t;
|
|
1616
|
+
}
|
|
1617
|
+
function sr(e, t, n, r) {
|
|
1618
|
+
n ||= or(t, {}, r);
|
|
1619
|
+
for (let i in e) {
|
|
1620
|
+
let a = e[i], o = r && r[i];
|
|
1621
|
+
!nr(a) || Array.isArray(a) && rr(o) ? Z(a, t[i]) ? ar(n, i) : n[i] = !0 : (G(t) || kn(n[i]) ? n[i] = or(a, Array.isArray(a) ? [] : {}, o) : sr(a, H(t) ? {} : t[i], n[i], o), ir(n[i]) && ar(n, i));
|
|
1622
|
+
}
|
|
1623
|
+
return n;
|
|
1624
|
+
}
|
|
1625
|
+
var cr = (e, { valueAsNumber: t, valueAsDate: n, setValueAs: r }) => G(e) ? e : t ? e === "" ? NaN : e && +e : n && X(e) ? new Date(e) : r ? r(e) : e;
|
|
1626
|
+
function lr(e) {
|
|
1627
|
+
let t = e.ref;
|
|
1628
|
+
return Qt(t) ? t.files : In(t) ? Un(e.refs).value : er(t) ? [...t.selectedOptions].map(({ value: e }) => e) : Zt(t) ? Vn(e.refs).value : cr(G(t.value) ? e.ref.value : t.value, e);
|
|
1629
|
+
}
|
|
1630
|
+
var ur = (e) => G(e) ? e : Ln(e) ? e.source : U(e) ? Ln(e.value) ? e.value.source : e.value : e, dr = "AsyncFunction", fr = (e) => {
|
|
1631
|
+
if (!e || !e.validate) return !1;
|
|
1632
|
+
if (J(e.validate)) return e.validate.constructor.name === dr;
|
|
1633
|
+
if (U(e.validate)) {
|
|
1634
|
+
for (let t in e.validate) if (e.validate[t].constructor.name === dr) return !0;
|
|
1635
|
+
}
|
|
1636
|
+
return !1;
|
|
1637
|
+
};
|
|
1638
|
+
function pr(e, t, n) {
|
|
1639
|
+
let r = K(e, n);
|
|
1640
|
+
if (r || wn(n)) return {
|
|
1641
|
+
error: r,
|
|
1642
|
+
name: n
|
|
1643
|
+
};
|
|
1644
|
+
let i = n.split(".");
|
|
1645
|
+
for (; i.length;) {
|
|
1646
|
+
let r = i.join("."), a = K(t, r), o = K(e, r);
|
|
1647
|
+
if (a && !Array.isArray(a) && n !== r) return { name: n };
|
|
1648
|
+
if (o && o.type) return {
|
|
1649
|
+
name: r,
|
|
1650
|
+
error: o
|
|
1651
|
+
};
|
|
1652
|
+
if (o && o.root && o.root.type) return {
|
|
1653
|
+
name: `${r}.root`,
|
|
1654
|
+
error: o.root
|
|
1655
|
+
};
|
|
1656
|
+
i.pop();
|
|
1657
|
+
}
|
|
1658
|
+
return { name: n };
|
|
1659
|
+
}
|
|
1660
|
+
var mr = {
|
|
1661
|
+
mode: dn,
|
|
1662
|
+
reValidateMode: un,
|
|
1663
|
+
shouldFocusError: !0
|
|
1664
|
+
}, hr = "form", gr = {
|
|
1665
|
+
submitCount: 0,
|
|
1666
|
+
isDirty: !1,
|
|
1667
|
+
isReady: !1,
|
|
1668
|
+
isValidating: !1,
|
|
1669
|
+
isSubmitted: !1,
|
|
1670
|
+
isSubmitting: !1,
|
|
1671
|
+
isSubmitSuccessful: !1,
|
|
1672
|
+
isValid: !1,
|
|
1673
|
+
touchedFields: {},
|
|
1674
|
+
dirtyFields: {},
|
|
1675
|
+
validatingFields: {}
|
|
1676
|
+
};
|
|
1677
|
+
function _r(e = {}) {
|
|
1678
|
+
let t = {
|
|
1679
|
+
...mr,
|
|
1680
|
+
...e
|
|
1681
|
+
}, n = {
|
|
1682
|
+
...W(gr),
|
|
1683
|
+
isLoading: J(t.defaultValues),
|
|
1684
|
+
errors: t.errors || {},
|
|
1685
|
+
disabled: t.disabled || !1
|
|
1686
|
+
}, r = {}, i = (U(t.defaultValues) || U(t.values)) && W(t.defaultValues || t.values) || {}, a = t.shouldUnregister ? {} : W(i), o = {
|
|
1687
|
+
action: !1,
|
|
1688
|
+
mount: !1,
|
|
1689
|
+
watch: !1,
|
|
1690
|
+
keepIsValid: !1
|
|
1691
|
+
}, s = {
|
|
1692
|
+
mount: /* @__PURE__ */ new Set(),
|
|
1693
|
+
disabled: /* @__PURE__ */ new Set(),
|
|
1694
|
+
unMount: /* @__PURE__ */ new Set(),
|
|
1695
|
+
array: /* @__PURE__ */ new Set(),
|
|
1696
|
+
watch: /* @__PURE__ */ new Set(),
|
|
1697
|
+
registerName: /* @__PURE__ */ new Set()
|
|
1698
|
+
}, c = {}, l = {}, u = 0, d = jn(t.mode), f = jn(t.reValidateMode), p = {
|
|
1699
|
+
isDirty: !1,
|
|
1700
|
+
dirtyFields: !1,
|
|
1701
|
+
validatingFields: !1,
|
|
1702
|
+
touchedFields: !1,
|
|
1703
|
+
isValidating: !1,
|
|
1704
|
+
isValid: !1,
|
|
1705
|
+
errors: !1
|
|
1706
|
+
}, m = { ...p }, h = { ...m }, g = {
|
|
1707
|
+
array: Qn(),
|
|
1708
|
+
state: Qn()
|
|
1709
|
+
}, _ = 0, v = t.criteriaMode === pn, y = (e, t) => (n) => {
|
|
1710
|
+
clearTimeout(l[e]), l[e] = setTimeout(t, n);
|
|
1711
|
+
}, b = async (e) => {
|
|
1712
|
+
if (!o.keepIsValid && !t.disabled && (m.isValid || h.isValid || e)) {
|
|
1713
|
+
let e = ++_, i;
|
|
1714
|
+
t.resolver ? (i = Q((await T()).errors), e === _ && x()) : i = await E({
|
|
1715
|
+
fields: r,
|
|
1716
|
+
onlyCheckValid: !0,
|
|
1717
|
+
eventType: cn
|
|
1718
|
+
}), e === _ && i !== n.isValid && g.state.next({ isValid: i });
|
|
1719
|
+
}
|
|
1720
|
+
}, x = (e, r) => {
|
|
1721
|
+
!t.disabled && (m.isValidating || m.validatingFields || h.isValidating || h.validatingFields) && ((e || Array.from(s.mount)).forEach((e) => {
|
|
1722
|
+
e && (r ? Y(n.validatingFields, e, r) : $(n.validatingFields, e));
|
|
1723
|
+
}), g.state.next({
|
|
1724
|
+
validatingFields: n.validatingFields,
|
|
1725
|
+
isValidating: !Q(n.validatingFields)
|
|
1726
|
+
}));
|
|
1727
|
+
}, S = () => {
|
|
1728
|
+
n.dirtyFields = sr(i, a, void 0, r);
|
|
1729
|
+
}, ee = (e, t) => {
|
|
1730
|
+
Y(n.errors, e, t), n.errors = { ...n.errors }, g.state.next({ errors: n.errors });
|
|
1731
|
+
}, C = (t, c, l, u) => {
|
|
1732
|
+
let d = K(r, t);
|
|
1733
|
+
if (d) {
|
|
1734
|
+
if (((e) => {
|
|
1735
|
+
let t = wn(e) ? [e] : En(e), n = a, r = i;
|
|
1736
|
+
for (let e = 0; e < t.length - 1; e++) {
|
|
1737
|
+
let i = t[e];
|
|
1738
|
+
if (n = H(n) ? n : n[i], r = H(r) ? r : r[i], n === null && r !== null) return !0;
|
|
1739
|
+
}
|
|
1740
|
+
return !1;
|
|
1741
|
+
})(t)) return;
|
|
1742
|
+
let r = G(K(a, t)), f = K(a, t, G(l) ? K(i, t) : l);
|
|
1743
|
+
G(f) || u && u.defaultChecked || c ? Y(a, t, c ? f : lr(d._f)) : k(t, f), o.mount && !o.action && (b(), r && n.isDirty && (m.isDirty || h.isDirty) && (D() || (n.isDirty = !1, g.state.next({ ...n }))), e.shouldUnregister && r && !G(K(a, t)) && Mn(t, s) && (o.watch = !0));
|
|
1744
|
+
}
|
|
1745
|
+
}, w = (e, o, s, c, l) => {
|
|
1746
|
+
let u = !1, d = !1, f = { name: e };
|
|
1747
|
+
if (!t.disabled || !0 === c) {
|
|
1748
|
+
if (!s || c) {
|
|
1749
|
+
let t = Z(K(i, e), o);
|
|
1750
|
+
(m.isDirty || h.isDirty) && (d = n.isDirty, n.isDirty = f.isDirty = !t || D(), u = d !== f.isDirty), d = !!K(n.dirtyFields, e), t === n.isDirty ? t ? $(n.dirtyFields, e) : Y(n.dirtyFields, e, !0) : ((e, t) => {
|
|
1751
|
+
for (let n in e) n in t || delete e[n];
|
|
1752
|
+
Object.assign(e, t);
|
|
1753
|
+
})(n.dirtyFields, sr(i, a, void 0, r)), f.dirtyFields = n.dirtyFields, u ||= (m.dirtyFields || h.dirtyFields) && d !== !t;
|
|
1754
|
+
}
|
|
1755
|
+
if (s) {
|
|
1756
|
+
let t = K(n.touchedFields, e);
|
|
1757
|
+
t || (Y(n.touchedFields, e, s), f.touchedFields = n.touchedFields, u ||= (m.touchedFields || h.touchedFields) && t !== s);
|
|
1758
|
+
}
|
|
1759
|
+
u && l && g.state.next(f);
|
|
1760
|
+
}
|
|
1761
|
+
return u ? f : {};
|
|
1762
|
+
}, T = async (e) => (x(e, !0), await t.resolver(a, t.context, ((e, t, n, r) => {
|
|
1763
|
+
let i = {};
|
|
1764
|
+
for (let n of e) {
|
|
1765
|
+
let e = K(t, n);
|
|
1766
|
+
e && Y(i, n, e._f);
|
|
1767
|
+
}
|
|
1768
|
+
return {
|
|
1769
|
+
criteriaMode: n,
|
|
1770
|
+
names: [...e],
|
|
1771
|
+
fields: i,
|
|
1772
|
+
shouldUseNativeValidation: r
|
|
1773
|
+
};
|
|
1774
|
+
})(e || s.mount, r, t.criteriaMode, t.shouldUseNativeValidation))), te = async ({ name: t, eventType: r }) => {
|
|
1775
|
+
if (e.validate) {
|
|
1776
|
+
let i = await e.validate({
|
|
1777
|
+
formValues: a,
|
|
1778
|
+
formState: n,
|
|
1779
|
+
name: t,
|
|
1780
|
+
eventType: r
|
|
1781
|
+
});
|
|
1782
|
+
if (U(i)) for (let e in i) {
|
|
1783
|
+
let t = i[e];
|
|
1784
|
+
t && F(`${hr}.${e}`, {
|
|
1785
|
+
message: X(t.message) ? t.message : "",
|
|
1786
|
+
type: t.type || bn
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
else X(i) || !i ? F(hr, {
|
|
1790
|
+
message: i || "",
|
|
1791
|
+
type: bn
|
|
1792
|
+
}) : ie(hr);
|
|
1793
|
+
return i;
|
|
1794
|
+
}
|
|
1795
|
+
return !0;
|
|
1796
|
+
}, E = async ({ fields: r, onlyCheckValid: i, name: o, eventType: c, context: l = {
|
|
1797
|
+
valid: !0,
|
|
1798
|
+
runRootValidation: !1
|
|
1799
|
+
} }) => {
|
|
1800
|
+
if (e.validate && (l.runRootValidation = !0, !await te({
|
|
1801
|
+
name: o,
|
|
1802
|
+
eventType: c
|
|
1803
|
+
}) && (l.valid = !1, i))) return l.valid;
|
|
1804
|
+
for (let o in r) {
|
|
1805
|
+
let u = r[o];
|
|
1806
|
+
if (u) {
|
|
1807
|
+
let { _f: r, ...d } = u;
|
|
1808
|
+
if (r) {
|
|
1809
|
+
let o = s.array.has(r.name), c = u._f && fr(u._f), d = m.validatingFields || m.isValidating || h.validatingFields || h.isValidating;
|
|
1810
|
+
c && d && x([r.name], !0);
|
|
1811
|
+
let f = await Kn(u, s.disabled, a, v, t.shouldUseNativeValidation && !i, o);
|
|
1812
|
+
if (c && d && x([r.name]), f[r.name] && (l.valid = !1, i) || (!i && (K(f, r.name) ? o ? Pn(n.errors, f, r.name) : Y(n.errors, r.name, f[r.name]) : $(n.errors, r.name)), e.shouldUseNativeValidation && f[r.name])) break;
|
|
1813
|
+
}
|
|
1814
|
+
!Q(d) && await E({
|
|
1815
|
+
context: l,
|
|
1816
|
+
onlyCheckValid: i,
|
|
1817
|
+
fields: d,
|
|
1818
|
+
name: o,
|
|
1819
|
+
eventType: c
|
|
1820
|
+
});
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
return l.valid;
|
|
1824
|
+
}, D = (e, t) => (e && t && Y(a, e, t), !Z(o.mount ? a : i, i)), O = (e, t, n) => ((e, t, n, r, i) => X(e) ? (r && t.watch.add(e), K(n, e, i)) : Array.isArray(e) ? e.map((e) => (r && t.watch.add(e), K(n, e))) : (r && (t.watchAll = !0), n))(e, s, { ...o.mount ? a : G(t) ? i : X(e) ? { [e]: t } : t }, n, t), k = (e, t, n = {}, i = !1, o = !1) => {
|
|
1825
|
+
let s = K(r, e), c = t;
|
|
1826
|
+
if (s) {
|
|
1827
|
+
let n = s._f;
|
|
1828
|
+
n && (!n.disabled && Y(a, e, cr(t, n)), c = Fn(n.ref) && H(t) ? "" : t, er(n.ref) ? [...n.ref.options].forEach((e) => e.selected = c.includes(e.value)) : n.refs ? Zt(n.ref) ? n.refs.forEach((e) => {
|
|
1829
|
+
e.defaultChecked && e.disabled || (Array.isArray(c) ? e.checked = !!c.find((t) => t === e.value) : e.checked = c === e.value || !!c);
|
|
1830
|
+
}) : n.refs.forEach((e) => e.checked = e.value === c) : Qt(n.ref) ? n.ref.value = "" : (n.ref.value = c, n.ref.type || o || g.state.next({
|
|
1831
|
+
name: e,
|
|
1832
|
+
values: i ? a : W(a)
|
|
1833
|
+
})));
|
|
1834
|
+
}
|
|
1835
|
+
(n.shouldDirty || n.shouldTouch) && w(e, c, n.shouldTouch, n.shouldDirty, !o), n.shouldValidate && ne(e, { delayError: n.delayError });
|
|
1836
|
+
}, A = (e, t, n, i = !1, a = !1) => {
|
|
1837
|
+
for (let o in t) {
|
|
1838
|
+
if (!t.hasOwnProperty(o)) return;
|
|
1839
|
+
let c = t[o], l = e + "." + o, u = K(r, l);
|
|
1840
|
+
(s.array.has(e) || U(c) || u && !u._f) && !$t(c) ? A(l, c, n, i, a) : k(l, c, n, i, a);
|
|
1841
|
+
}
|
|
1842
|
+
}, j = (e, t, i, c, l = !1) => {
|
|
1843
|
+
let u = K(r, e), d = s.array.has(e), f = c ? t : W(t), p = Z(K(a, e), f);
|
|
1844
|
+
if (p || Y(a, e, f), d) g.array.next({
|
|
1845
|
+
name: e,
|
|
1846
|
+
values: c ? a : W(a)
|
|
1847
|
+
}), (m.isDirty || m.dirtyFields || h.isDirty || h.dirtyFields) && i.shouldDirty && (S(), l || g.state.next({
|
|
1848
|
+
name: e,
|
|
1849
|
+
dirtyFields: n.dirtyFields,
|
|
1850
|
+
isDirty: D(e, f)
|
|
1851
|
+
}));
|
|
1852
|
+
else {
|
|
1853
|
+
let t = Array.isArray(f) && !f.length || Q(f);
|
|
1854
|
+
!u || u._f || H(f) || t ? k(e, f, i, c, l) : A(e, f, i, c, l);
|
|
1855
|
+
}
|
|
1856
|
+
if (!p && !l) {
|
|
1857
|
+
let t = Mn(e, s), r = c ? a : W(a);
|
|
1858
|
+
g.state.next({
|
|
1859
|
+
...t && n,
|
|
1860
|
+
name: o.mount || t ? e : void 0,
|
|
1861
|
+
values: r
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
}, M = (e, t, n = {}) => j(e, t, n, !1), N = async (i) => {
|
|
1865
|
+
o.mount = !0;
|
|
1866
|
+
let p = i.target, _ = p.name, S = !0, C = K(r, _), D = (e) => {
|
|
1867
|
+
S = Number.isNaN(e) || $t(e) && isNaN(e.getTime()) || Z(e, K(a, _, e));
|
|
1868
|
+
};
|
|
1869
|
+
if (C) {
|
|
1870
|
+
let o, O, k = p.type ? lr(C._f) : ((e) => U(e) && e.target ? Zt(e.target) ? e.target.checked : Qt(e.target) ? e.target.files : e.target.value : e)(i), A = i.type === rn || i.type === an, j = !(((e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate))(C._f) || e.validate || t.resolver || K(n.errors, _) || C._f.deps), M = j || ((e, t, n, r, i) => !i.isOnAll && (!n && i.isOnTouch ? !(t || e) : (n ? r.isOnBlur : i.isOnBlur) ? !e : !(n ? r.isOnChange : i.isOnChange) || e))(A, K(n.touchedFields, _), n.isSubmitted, f, d), N = Mn(_, s, A);
|
|
1871
|
+
if (Y(a, _, k), A) {
|
|
1872
|
+
if (!p || !p.readOnly) {
|
|
1873
|
+
C._f.onBlur && C._f.onBlur(i);
|
|
1874
|
+
let e = c[_];
|
|
1875
|
+
e && e(0);
|
|
1876
|
+
}
|
|
1877
|
+
} else C._f.onChange && C._f.onChange(i);
|
|
1878
|
+
let P = w(_, k, A), re = !Q(P) || N;
|
|
1879
|
+
if (!A && g.state.next({
|
|
1880
|
+
name: _,
|
|
1881
|
+
type: i.type,
|
|
1882
|
+
...u ? { values: W(a) } : {}
|
|
1883
|
+
}), M) return j && n.isValid || !m.isValid && !h.isValid || (t.mode === "onBlur" ? A && b() : A || b()), re && g.state.next({
|
|
1884
|
+
name: _,
|
|
1885
|
+
...N ? {} : P
|
|
1886
|
+
});
|
|
1887
|
+
if (!t.resolver && e.validate && await te({
|
|
1888
|
+
name: _,
|
|
1889
|
+
eventType: i.type
|
|
1890
|
+
}), !A && N && g.state.next({ ...n }), t.resolver) {
|
|
1891
|
+
let { errors: e } = await T([_]);
|
|
1892
|
+
if (x([_]), D(k), !S) return void (!Q(P) && g.state.next(P));
|
|
1893
|
+
let t = pr(n.errors, r, _), i = pr(e, r, t.name || _);
|
|
1894
|
+
o = i.error, _ = i.name, O = Q(e);
|
|
1895
|
+
} else x([_], !0), o = (await Kn(C, s.disabled, a, v, t.shouldUseNativeValidation))[_], x([_]), D(k), S && (o ? O = !1 : (m.isValid || h.isValid) && (O = await E({
|
|
1896
|
+
fields: r,
|
|
1897
|
+
onlyCheckValid: !0,
|
|
1898
|
+
name: _,
|
|
1899
|
+
eventType: i.type
|
|
1900
|
+
})));
|
|
1901
|
+
S && (C._f.deps && (!Array.isArray(C._f.deps) || C._f.deps.length > 0) && ne(C._f.deps), ((e, r, i, a) => {
|
|
1902
|
+
let o = K(n.errors, e), s = (m.isValid || h.isValid) && q(r) && n.isValid !== r;
|
|
1903
|
+
if (t.delayError && i ? (c[e] = y(e, () => ee(e, i)), c[e](t.delayError)) : (clearTimeout(l[e]), delete c[e], i ? Y(n.errors, e, i) : $(n.errors, e), n.errors = { ...n.errors }), (i ? !Z(o, i) : o) || !Q(a) || s) {
|
|
1904
|
+
let t = {
|
|
1905
|
+
...a,
|
|
1906
|
+
...s && q(r) ? { isValid: r } : {},
|
|
1907
|
+
errors: n.errors,
|
|
1908
|
+
name: e
|
|
1909
|
+
};
|
|
1910
|
+
n = {
|
|
1911
|
+
...n,
|
|
1912
|
+
...t
|
|
1913
|
+
}, g.state.next(t);
|
|
1914
|
+
}
|
|
1915
|
+
})(_, O, o, P));
|
|
1916
|
+
}
|
|
1917
|
+
}, P = (e, t) => {
|
|
1918
|
+
if (K(n.errors, t) && e.focus) return e.focus(), 1;
|
|
1919
|
+
}, ne = async (e, i = {}) => {
|
|
1920
|
+
let a, o, u = qn(e);
|
|
1921
|
+
if (t.resolver) {
|
|
1922
|
+
let t = await (async (e) => {
|
|
1923
|
+
let { errors: t } = await T(e);
|
|
1924
|
+
if (x(e), e) {
|
|
1925
|
+
for (let r of e) {
|
|
1926
|
+
let e = K(t, r);
|
|
1927
|
+
e ? s.array.has(r) && U(e) && !Object.keys(e).some((e) => !Number.isNaN(Number(e))) ? Pn(n.errors, { [r]: e }, r) : Y(n.errors, r, e) : $(n.errors, r);
|
|
1928
|
+
}
|
|
1929
|
+
n.errors = { ...n.errors };
|
|
1930
|
+
} else n.errors = t;
|
|
1931
|
+
return t;
|
|
1932
|
+
})(G(e) ? e : u);
|
|
1933
|
+
a = Q(t), o = e ? !u.some((e) => K(t, e)) : a;
|
|
1934
|
+
} else e ? (o = (await Promise.all(u.map(async (e) => {
|
|
1935
|
+
let t = K(r, e);
|
|
1936
|
+
return await E({
|
|
1937
|
+
fields: t && t._f ? { [e]: t } : t,
|
|
1938
|
+
eventType: sn
|
|
1939
|
+
});
|
|
1940
|
+
}))).every(Boolean), (o || n.isValid) && b()) : o = a = await E({
|
|
1941
|
+
fields: r,
|
|
1942
|
+
name: e,
|
|
1943
|
+
eventType: sn
|
|
1944
|
+
});
|
|
1945
|
+
if (i.delayError && t.delayError && X(e)) {
|
|
1946
|
+
let r = K(n.errors, e);
|
|
1947
|
+
r ? ($(n.errors, e), c[e] = y(e, () => ee(e, r)), c[e](t.delayError)) : (clearTimeout(l[e]), delete c[e]);
|
|
1948
|
+
}
|
|
1949
|
+
return g.state.next({
|
|
1950
|
+
...!X(e) || (m.isValid || h.isValid) && a !== n.isValid ? {} : { name: e },
|
|
1951
|
+
...t.resolver || !e ? { isValid: a } : {},
|
|
1952
|
+
errors: n.errors
|
|
1953
|
+
}), i.shouldFocus && !o && Nn(r, P, e ? u : s.mount), o;
|
|
1954
|
+
}, re = (e, t) => ({
|
|
1955
|
+
invalid: !!K((t || n).errors, e),
|
|
1956
|
+
isDirty: !!K((t || n).dirtyFields, e),
|
|
1957
|
+
error: K((t || n).errors, e),
|
|
1958
|
+
isValidating: !!K(n.validatingFields, e),
|
|
1959
|
+
isTouched: !!K((t || n).touchedFields, e)
|
|
1960
|
+
}), ie = (e) => {
|
|
1961
|
+
let t = e ? qn(e) : void 0;
|
|
1962
|
+
t?.forEach((e) => $(n.errors, e)), t ? t.forEach((e) => {
|
|
1963
|
+
g.state.next({
|
|
1964
|
+
name: e,
|
|
1965
|
+
errors: n.errors
|
|
1966
|
+
});
|
|
1967
|
+
}) : (n.errors = {}, g.state.next({ errors: n.errors }));
|
|
1968
|
+
}, F = (e, t, i) => {
|
|
1969
|
+
let a = (K(r, e, { _f: {} })._f || {}).ref, { ref: o, message: s, type: c, ...l } = K(n.errors, e) || {};
|
|
1970
|
+
Y(n.errors, e, {
|
|
1971
|
+
...l,
|
|
1972
|
+
...t,
|
|
1973
|
+
ref: a
|
|
1974
|
+
}), g.state.next({
|
|
1975
|
+
name: e,
|
|
1976
|
+
errors: n.errors,
|
|
1977
|
+
isValid: !1
|
|
1978
|
+
}), i && i.shouldFocus && a && a.focus && a.focus();
|
|
1979
|
+
}, ae = (e) => {
|
|
1980
|
+
let t = !!e.formState?.values;
|
|
1981
|
+
t && u++;
|
|
1982
|
+
let { unsubscribe: r } = g.state.subscribe({ next: (t) => {
|
|
1983
|
+
if (r = e.name, o = t.name, s = e.exact, (!r || !o || r === o || qn(r).some((e) => e && (s ? e === o || e.startsWith(o + ".") : e.startsWith(o) || o.startsWith(e)))) && ((e, t, n, r) => {
|
|
1984
|
+
n(e);
|
|
1985
|
+
let { name: i, ...a } = e, o = Object.keys(a);
|
|
1986
|
+
return !o.length || r && o.length >= Object.keys(t).length || o.find((e) => t[e] === (!r || pn));
|
|
1987
|
+
})(t, e.formState || m, L, e.reRenderRoot)) {
|
|
1988
|
+
let r = { ...a };
|
|
1989
|
+
e.callback({
|
|
1990
|
+
values: r,
|
|
1991
|
+
...n,
|
|
1992
|
+
...t,
|
|
1993
|
+
defaultValues: i
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
var r, o, s;
|
|
1997
|
+
} });
|
|
1998
|
+
if (!t) return r;
|
|
1999
|
+
let o = !1;
|
|
2000
|
+
return () => {
|
|
2001
|
+
o || (o = !0, u--, r());
|
|
2002
|
+
};
|
|
2003
|
+
}, oe = (e, o = {}) => {
|
|
2004
|
+
for (let c of e ? qn(e) : s.mount) s.mount.delete(c), s.array.delete(c), o.keepValue || ($(r, c), $(a, c)), !o.keepError && $(n.errors, c), !o.keepDirty && $(n.dirtyFields, c), !o.keepTouched && $(n.touchedFields, c), !o.keepIsValidating && $(n.validatingFields, c), !t.shouldUnregister && !o.keepDefaultValue && $(i, c);
|
|
2005
|
+
g.state.next({ values: W(a) }), g.state.next({
|
|
2006
|
+
...n,
|
|
2007
|
+
...o.keepDirty ? { isDirty: D() } : {}
|
|
2008
|
+
}), !o.keepIsValid && b();
|
|
2009
|
+
}, se = ({ disabled: e, name: t }) => {
|
|
2010
|
+
if (q(e) && o.mount || e || s.disabled.has(t)) {
|
|
2011
|
+
let n = s.disabled.has(t) !== !!e;
|
|
2012
|
+
e ? s.disabled.add(t) : s.disabled.delete(t), n && o.mount && !o.action && b();
|
|
2013
|
+
}
|
|
2014
|
+
}, I = (e, n = {}) => {
|
|
2015
|
+
let a = K(r, e), c = q(n.disabled) || q(t.disabled), l = !s.registerName.has(e) && a && a._f && !a._f.mount;
|
|
2016
|
+
return Y(r, e, {
|
|
2017
|
+
...a || {},
|
|
2018
|
+
_f: {
|
|
2019
|
+
...a && a._f ? a._f : { ref: { name: e } },
|
|
2020
|
+
name: e,
|
|
2021
|
+
mount: !0,
|
|
2022
|
+
...n
|
|
2023
|
+
}
|
|
2024
|
+
}), s.mount.add(e), a && !l ? se({
|
|
2025
|
+
disabled: q(n.disabled) ? n.disabled : t.disabled,
|
|
2026
|
+
name: e
|
|
2027
|
+
}) : C(e, !0, n.value), {
|
|
2028
|
+
...c ? { disabled: n.disabled || t.disabled } : {},
|
|
2029
|
+
...t.progressive ? {
|
|
2030
|
+
required: !!n.required,
|
|
2031
|
+
min: ur(n.min),
|
|
2032
|
+
max: ur(n.max),
|
|
2033
|
+
minLength: ur(n.minLength),
|
|
2034
|
+
maxLength: ur(n.maxLength),
|
|
2035
|
+
pattern: ur(n.pattern)
|
|
2036
|
+
} : {},
|
|
2037
|
+
name: e,
|
|
2038
|
+
onChange: N,
|
|
2039
|
+
onBlur: N,
|
|
2040
|
+
ref: (c) => {
|
|
2041
|
+
if (c) {
|
|
2042
|
+
s.registerName.add(e), I(e, n), s.registerName.delete(e), a = K(r, e);
|
|
2043
|
+
let t = G(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, o = ((e) => In(e) || Zt(e))(t), l = a._f.refs || [];
|
|
2044
|
+
if (o ? l.find((e) => e === t) : t === a._f.ref) return;
|
|
2045
|
+
let u = { ...a._f };
|
|
2046
|
+
o ? (u.refs = [
|
|
2047
|
+
...l.filter(tr),
|
|
2048
|
+
t,
|
|
2049
|
+
...Array.isArray(K(i, e)) ? [{}] : []
|
|
2050
|
+
], u.ref = {
|
|
2051
|
+
type: t.type,
|
|
2052
|
+
name: e
|
|
2053
|
+
}) : (u.ref = t, delete u.refs), Y(r, e, { _f: u }), C(e, !1, void 0, t);
|
|
2054
|
+
} else a = K(r, e, {}), a._f && (a._f.mount = !1), (t.shouldUnregister || n.shouldUnregister) && (!((e, t) => t.split(".").some((t, n, r) => !isNaN(Number(t)) && e.has(r.slice(0, n).join("."))))(s.array, e) || !o.action) && s.unMount.add(e);
|
|
2055
|
+
}
|
|
2056
|
+
};
|
|
2057
|
+
}, ce = () => t.shouldFocusError && !t.shouldUseNativeValidation && Nn(r, P, s.mount), le = (e, i) => async (o) => {
|
|
2058
|
+
let c;
|
|
2059
|
+
o && (o.preventDefault && o.preventDefault(), o.persist && o.persist());
|
|
2060
|
+
let l = W(a);
|
|
2061
|
+
if (g.state.next({ isSubmitting: !0 }), t.resolver) {
|
|
2062
|
+
let { errors: e, values: t } = await T();
|
|
2063
|
+
x(), n.errors = e, l = W(t);
|
|
2064
|
+
} else await E({
|
|
2065
|
+
fields: r,
|
|
2066
|
+
eventType: on
|
|
2067
|
+
});
|
|
2068
|
+
if (s.disabled.size) for (let e of s.disabled) $(l, e);
|
|
2069
|
+
if ($(n.errors, xn), Q(n.errors)) {
|
|
2070
|
+
g.state.next({ errors: {} });
|
|
2071
|
+
try {
|
|
2072
|
+
await e(l, o);
|
|
2073
|
+
} catch (e) {
|
|
2074
|
+
c = e;
|
|
2075
|
+
}
|
|
2076
|
+
} else i && await i({ ...n.errors }, o), ce(), setTimeout(ce);
|
|
2077
|
+
if (g.state.next({
|
|
2078
|
+
isSubmitted: !0,
|
|
2079
|
+
isSubmitting: !1,
|
|
2080
|
+
isSubmitSuccessful: Q(n.errors) && !c,
|
|
2081
|
+
submitCount: n.submitCount + 1,
|
|
2082
|
+
errors: n.errors
|
|
2083
|
+
}), c) throw c;
|
|
2084
|
+
}, ue = (e, c = {}) => {
|
|
2085
|
+
let l = e ? W(e) : i, u = W(l), d = Q(e), f = u, p = r;
|
|
2086
|
+
if (c.keepDefaultValues || (i = l), !c.keepValues) {
|
|
2087
|
+
if (c.keepDirtyValues) {
|
|
2088
|
+
let e = /* @__PURE__ */ new Set([...s.mount, ...Object.keys(sr(i, a, void 0, p))]);
|
|
2089
|
+
for (let t of Array.from(e)) {
|
|
2090
|
+
let e = K(n.dirtyFields, t), r = K(a, t), i = K(f, t);
|
|
2091
|
+
e && !G(r) ? Y(f, t, r) : e || G(i) || M(t, i);
|
|
2092
|
+
}
|
|
2093
|
+
} else {
|
|
2094
|
+
if (nn && G(e)) for (let e of s.mount) {
|
|
2095
|
+
let t = K(r, e);
|
|
2096
|
+
if (t && t._f) {
|
|
2097
|
+
let e = Array.isArray(t._f.refs) ? t._f.refs[0] : t._f.ref;
|
|
2098
|
+
if (Fn(e)) {
|
|
2099
|
+
let t = e.closest("form");
|
|
2100
|
+
if (t) {
|
|
2101
|
+
t.reset();
|
|
2102
|
+
break;
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
if (c.keepFieldsRef) for (let e of s.mount) M(e, K(f, e));
|
|
2108
|
+
else r = {};
|
|
2109
|
+
}
|
|
2110
|
+
if (t.shouldUnregister) {
|
|
2111
|
+
if (a = c.keepDefaultValues ? W(i) : {}, c.keepFieldsRef) for (let e of s.mount) Y(a, e, K(f, e));
|
|
2112
|
+
} else a = W(f);
|
|
2113
|
+
g.array.next({ values: { ...f } }), g.state.next({
|
|
2114
|
+
name: void 0,
|
|
2115
|
+
type: void 0,
|
|
2116
|
+
values: { ...f }
|
|
2117
|
+
});
|
|
2118
|
+
}
|
|
2119
|
+
s = {
|
|
2120
|
+
mount: c.keepDirtyValues ? s.mount : /* @__PURE__ */ new Set(),
|
|
2121
|
+
unMount: /* @__PURE__ */ new Set(),
|
|
2122
|
+
array: /* @__PURE__ */ new Set(),
|
|
2123
|
+
registerName: /* @__PURE__ */ new Set(),
|
|
2124
|
+
disabled: /* @__PURE__ */ new Set(),
|
|
2125
|
+
watch: /* @__PURE__ */ new Set(),
|
|
2126
|
+
watchAll: !1,
|
|
2127
|
+
focus: ""
|
|
2128
|
+
}, o.mount = !m.isValid || !!c.keepIsValid || !!c.keepDirtyValues || !t.shouldUnregister && !Q(f), o.watch = !!t.shouldUnregister, o.keepIsValid = !!c.keepIsValid, o.action = !1, c.keepErrors || (n.errors = {}), g.state.next({
|
|
2129
|
+
submitCount: c.keepSubmitCount ? n.submitCount : 0,
|
|
2130
|
+
isDirty: !d && (c.keepDirty ? n.isDirty : c.keepValues ? D() : !(!c.keepDefaultValues || Z(e, i))),
|
|
2131
|
+
isSubmitted: !!c.keepIsSubmitted && n.isSubmitted,
|
|
2132
|
+
dirtyFields: d ? {} : c.keepDirtyValues ? c.keepDefaultValues && a ? sr(i, a, void 0, p) : n.dirtyFields : c.keepDefaultValues && e ? sr(i, e, void 0, p) : c.keepDirty ? n.dirtyFields : {},
|
|
2133
|
+
touchedFields: c.keepTouched ? n.touchedFields : {},
|
|
2134
|
+
errors: c.keepErrors ? n.errors : {},
|
|
2135
|
+
isSubmitSuccessful: !!c.keepIsSubmitSuccessful && n.isSubmitSuccessful,
|
|
2136
|
+
isSubmitting: !1,
|
|
2137
|
+
defaultValues: i
|
|
2138
|
+
});
|
|
2139
|
+
}, de = (e, n) => ue(J(e) ? e(a) : e, {
|
|
2140
|
+
...t.resetOptions,
|
|
2141
|
+
...n
|
|
2142
|
+
}), L = (e) => {
|
|
2143
|
+
let { name: t, type: r, values: i, ...a } = e;
|
|
2144
|
+
n = {
|
|
2145
|
+
...n,
|
|
2146
|
+
...a
|
|
2147
|
+
};
|
|
2148
|
+
}, fe = {
|
|
2149
|
+
control: {
|
|
2150
|
+
register: I,
|
|
2151
|
+
unregister: oe,
|
|
2152
|
+
getFieldState: re,
|
|
2153
|
+
handleSubmit: le,
|
|
2154
|
+
setError: F,
|
|
2155
|
+
_subscribe: ae,
|
|
2156
|
+
_runSchema: T,
|
|
2157
|
+
_updateIsValidating: x,
|
|
2158
|
+
_focusError: ce,
|
|
2159
|
+
_getWatch: O,
|
|
2160
|
+
_getDirty: D,
|
|
2161
|
+
_setValid: b,
|
|
2162
|
+
_setFieldArray: (e, i = [], s, c, l = !0, u = !0) => {
|
|
2163
|
+
if (c && s && !t.disabled) {
|
|
2164
|
+
if (o.action = !0, u && Array.isArray(K(r, e))) {
|
|
2165
|
+
let t = s(K(r, e), c.argA, c.argB);
|
|
2166
|
+
l && Y(r, e, t);
|
|
2167
|
+
}
|
|
2168
|
+
if (u && Array.isArray(K(n.errors, e))) {
|
|
2169
|
+
let t = s(K(n.errors, e), c.argA, c.argB);
|
|
2170
|
+
l && Y(n.errors, e, t), ((e, t) => {
|
|
2171
|
+
!Jn(K(e, t)).length && $(e, t);
|
|
2172
|
+
})(n.errors, e);
|
|
2173
|
+
}
|
|
2174
|
+
if ((m.touchedFields || h.touchedFields) && u && Array.isArray(K(n.touchedFields, e))) {
|
|
2175
|
+
let t = s(K(n.touchedFields, e), c.argA, c.argB);
|
|
2176
|
+
l && Y(n.touchedFields, e, t);
|
|
2177
|
+
}
|
|
2178
|
+
(m.dirtyFields || h.dirtyFields) && S(), g.state.next({
|
|
2179
|
+
name: e,
|
|
2180
|
+
isDirty: D(e, i),
|
|
2181
|
+
dirtyFields: n.dirtyFields,
|
|
2182
|
+
errors: n.errors,
|
|
2183
|
+
isValid: n.isValid
|
|
2184
|
+
});
|
|
2185
|
+
} else Y(a, e, i);
|
|
2186
|
+
},
|
|
2187
|
+
_setDisabledField: se,
|
|
2188
|
+
_setErrors: (e) => {
|
|
2189
|
+
n.errors = e, g.state.next({
|
|
2190
|
+
errors: n.errors,
|
|
2191
|
+
isValid: !1
|
|
2192
|
+
});
|
|
2193
|
+
},
|
|
2194
|
+
_getFieldArray: (e) => Jn(K(o.mount ? a : i, e, t.shouldUnregister ? K(i, e, []) : [])),
|
|
2195
|
+
_reset: ue,
|
|
2196
|
+
_resetDefaultValues: () => J(t.defaultValues) && t.defaultValues().then((e) => {
|
|
2197
|
+
de(e, t.resetOptions), g.state.next({ isLoading: !1 });
|
|
2198
|
+
}),
|
|
2199
|
+
_removeUnmounted: () => {
|
|
2200
|
+
for (let e of s.unMount) {
|
|
2201
|
+
let t = K(r, e);
|
|
2202
|
+
t && (t._f.refs ? t._f.refs.every((e) => !tr(e)) : !tr(t._f.ref)) && oe(e);
|
|
2203
|
+
}
|
|
2204
|
+
s.unMount = /* @__PURE__ */ new Set();
|
|
2205
|
+
},
|
|
2206
|
+
_disableForm: (e) => {
|
|
2207
|
+
q(e) && (g.state.next({ disabled: e }), Nn(r, (t, n) => {
|
|
2208
|
+
let i = K(r, n);
|
|
2209
|
+
i && (t.disabled = i._f.disabled || e, Array.isArray(i._f.refs) && i._f.refs.forEach((t) => {
|
|
2210
|
+
t.disabled = i._f.disabled || e;
|
|
2211
|
+
}));
|
|
2212
|
+
}, 0, !1));
|
|
2213
|
+
},
|
|
2214
|
+
_subjects: g,
|
|
2215
|
+
_proxyFormState: m,
|
|
2216
|
+
get _fields() {
|
|
2217
|
+
return r;
|
|
2218
|
+
},
|
|
2219
|
+
get _formValues() {
|
|
2220
|
+
return a;
|
|
2221
|
+
},
|
|
2222
|
+
get _state() {
|
|
2223
|
+
return o;
|
|
2224
|
+
},
|
|
2225
|
+
set _state(e) {
|
|
2226
|
+
o = e;
|
|
2227
|
+
},
|
|
2228
|
+
get _defaultValues() {
|
|
2229
|
+
return i;
|
|
2230
|
+
},
|
|
2231
|
+
get _names() {
|
|
2232
|
+
return s;
|
|
2233
|
+
},
|
|
2234
|
+
set _names(e) {
|
|
2235
|
+
s = e;
|
|
2236
|
+
},
|
|
2237
|
+
get _formState() {
|
|
2238
|
+
return n;
|
|
2239
|
+
},
|
|
2240
|
+
get _options() {
|
|
2241
|
+
return t;
|
|
2242
|
+
},
|
|
2243
|
+
set _options(e) {
|
|
2244
|
+
t = {
|
|
2245
|
+
...t,
|
|
2246
|
+
...e
|
|
2247
|
+
}, d = jn(t.mode), f = jn(t.reValidateMode);
|
|
2248
|
+
}
|
|
2249
|
+
},
|
|
2250
|
+
subscribe: (e) => (o.mount = !0, h = {
|
|
2251
|
+
...h,
|
|
2252
|
+
...e.formState
|
|
2253
|
+
}, ae({
|
|
2254
|
+
...e,
|
|
2255
|
+
formState: {
|
|
2256
|
+
...p,
|
|
2257
|
+
...e.formState
|
|
2258
|
+
}
|
|
2259
|
+
})),
|
|
2260
|
+
trigger: ne,
|
|
2261
|
+
register: I,
|
|
2262
|
+
handleSubmit: le,
|
|
2263
|
+
watch: (e, t) => {
|
|
2264
|
+
if (J(e)) {
|
|
2265
|
+
u++;
|
|
2266
|
+
let { unsubscribe: n } = g.state.subscribe({ next: (n) => "values" in n && e(n.values || O(void 0, t), n) }), r = !1;
|
|
2267
|
+
return { unsubscribe: () => {
|
|
2268
|
+
r || (r = !0, u--, n());
|
|
2269
|
+
} };
|
|
2270
|
+
}
|
|
2271
|
+
return O(e, t, !0);
|
|
2272
|
+
},
|
|
2273
|
+
setValue: M,
|
|
2274
|
+
setValues: (e, t = {}) => {
|
|
2275
|
+
let r = J(e) ? e(a) : e;
|
|
2276
|
+
if (!Z(a, r)) {
|
|
2277
|
+
a = {
|
|
2278
|
+
...a,
|
|
2279
|
+
...r
|
|
2280
|
+
};
|
|
2281
|
+
let e = Yn(r);
|
|
2282
|
+
for (let n of s.mount) n in e && j(n, e[n], t, !0, !0);
|
|
2283
|
+
g.state.next({
|
|
2284
|
+
...n,
|
|
2285
|
+
name: void 0,
|
|
2286
|
+
type: void 0,
|
|
2287
|
+
...u ? { values: a } : {}
|
|
2288
|
+
}), t.shouldValidate && b();
|
|
2289
|
+
}
|
|
2290
|
+
},
|
|
2291
|
+
getValues: (e, t) => {
|
|
2292
|
+
let r = { ...o.mount ? a : i };
|
|
2293
|
+
return t && (r = $n(t.dirtyFields ? n.dirtyFields : n.touchedFields, r)), G(e) ? r : X(e) ? K(r, e) : e.map((e) => K(r, e));
|
|
2294
|
+
},
|
|
2295
|
+
reset: de,
|
|
2296
|
+
resetField: (e, t = {}) => {
|
|
2297
|
+
K(r, e) && (G(t.defaultValue) ? M(e, W(K(i, e))) : (M(e, t.defaultValue), Y(i, e, W(t.defaultValue))), t.keepTouched || $(n.touchedFields, e), t.keepDirty || ($(n.dirtyFields, e), n.isDirty = t.defaultValue ? D(e, W(K(i, e))) : D()), t.keepError || ($(n.errors, e), m.isValid && b()), g.state.next({ ...n }));
|
|
2298
|
+
},
|
|
2299
|
+
resetDefaultValues: (e, t = {}) => {
|
|
2300
|
+
if (i = W(e), !t.keepDirty) {
|
|
2301
|
+
let e = sr(i, a, void 0, r);
|
|
2302
|
+
n.dirtyFields = e, n.isDirty = !Q(e);
|
|
2303
|
+
}
|
|
2304
|
+
t.keepIsValid || b(), g.state.next({
|
|
2305
|
+
...n,
|
|
2306
|
+
defaultValues: i
|
|
2307
|
+
});
|
|
2308
|
+
},
|
|
2309
|
+
clearErrors: ie,
|
|
2310
|
+
unregister: oe,
|
|
2311
|
+
setError: F,
|
|
2312
|
+
setFocus: (e, t = {}) => {
|
|
2313
|
+
let n = K(r, e), i = n && n._f;
|
|
2314
|
+
if (i) {
|
|
2315
|
+
let e = i.refs ? i.refs[0] : i.ref;
|
|
2316
|
+
e.focus && setTimeout(() => {
|
|
2317
|
+
e.focus(), t.shouldSelect && J(e.select) && e.select();
|
|
2318
|
+
});
|
|
2319
|
+
}
|
|
2320
|
+
},
|
|
2321
|
+
getFieldState: re
|
|
2322
|
+
};
|
|
2323
|
+
return {
|
|
2324
|
+
...fe,
|
|
2325
|
+
formControl: fe
|
|
2326
|
+
};
|
|
2327
|
+
}
|
|
2328
|
+
function vr(e = {}) {
|
|
2329
|
+
let t = x.useRef(void 0), n = x.useRef(void 0), r = x.useRef(e.formControl), [i, a] = x.useState(() => ({
|
|
2330
|
+
...W(gr),
|
|
2331
|
+
isLoading: J(e.defaultValues),
|
|
2332
|
+
errors: e.errors || {},
|
|
2333
|
+
disabled: e.disabled || !1,
|
|
2334
|
+
defaultValues: J(e.defaultValues) ? void 0 : e.defaultValues
|
|
2335
|
+
}));
|
|
2336
|
+
if (!t.current || e.formControl && r.current !== e.formControl) if (r.current = e.formControl, e.formControl) t.current = {
|
|
2337
|
+
...e.formControl,
|
|
2338
|
+
formState: i
|
|
2339
|
+
}, e.defaultValues && !J(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
2340
|
+
else {
|
|
2341
|
+
let { formControl: n, ...r } = _r(e);
|
|
2342
|
+
t.current = {
|
|
2343
|
+
...r,
|
|
2344
|
+
formState: i
|
|
2345
|
+
};
|
|
2346
|
+
}
|
|
2347
|
+
let o = t.current.control;
|
|
2348
|
+
return o._options = e, On(() => {
|
|
2349
|
+
let e = o._subscribe({
|
|
2350
|
+
formState: o._proxyFormState,
|
|
2351
|
+
callback: () => a({
|
|
2352
|
+
...o._formState,
|
|
2353
|
+
defaultValues: o._defaultValues
|
|
2354
|
+
}),
|
|
2355
|
+
reRenderRoot: !0
|
|
2356
|
+
});
|
|
2357
|
+
return a((e) => ({
|
|
2358
|
+
...e,
|
|
2359
|
+
isReady: !0
|
|
2360
|
+
})), o._formState.isReady = !0, e;
|
|
2361
|
+
}, [o]), x.useEffect(() => o._disableForm(e.disabled), [o, e.disabled]), x.useEffect(() => {
|
|
2362
|
+
e.mode && (o._options.mode = e.mode), e.reValidateMode && (o._options.reValidateMode = e.reValidateMode);
|
|
2363
|
+
}, [
|
|
2364
|
+
o,
|
|
2365
|
+
e.mode,
|
|
2366
|
+
e.reValidateMode
|
|
2367
|
+
]), x.useEffect(() => {
|
|
2368
|
+
e.errors && (o._setErrors(e.errors), o._focusError());
|
|
2369
|
+
}, [o, e.errors]), x.useEffect(() => {
|
|
2370
|
+
e.shouldUnregister && o._subjects.state.next({ values: o._getWatch() });
|
|
2371
|
+
}, [o, e.shouldUnregister]), x.useEffect(() => {
|
|
2372
|
+
if (o._proxyFormState.isDirty) {
|
|
2373
|
+
let e = o._getDirty();
|
|
2374
|
+
e !== i.isDirty && o._subjects.state.next({ isDirty: e });
|
|
2375
|
+
}
|
|
2376
|
+
}, [o, i.isDirty]), x.useEffect(() => {
|
|
2377
|
+
e.values && !Z(e.values, n.current) ? (o._reset(e.values, {
|
|
2378
|
+
keepFieldsRef: !0,
|
|
2379
|
+
...o._options.resetOptions
|
|
2380
|
+
}), o._options.resetOptions?.keepIsValid || o._setValid(), n.current = e.values, a((e) => ({ ...e }))) : o._resetDefaultValues();
|
|
2381
|
+
}, [o, e.values]), x.useEffect(() => {
|
|
2382
|
+
o._state.mount || (o._setValid(), o._state.mount = !0), o._state.watch && (o._state.watch = !1, o._subjects.state.next({ ...o._formState })), o._removeUnmounted();
|
|
2383
|
+
}), t.current.formState = x.useMemo(() => ((e, t, n, r = !0) => {
|
|
2384
|
+
let i = {};
|
|
2385
|
+
for (let a in e) Object.defineProperty(i, a, { get: () => {
|
|
2386
|
+
let i = a;
|
|
2387
|
+
return t._proxyFormState[i] !== pn && (t._proxyFormState[i] = !r || pn), n && (n[i] = !0), e[i];
|
|
2388
|
+
} });
|
|
2389
|
+
return i;
|
|
2390
|
+
})(i, o), [o, i]), t.current;
|
|
2391
|
+
}
|
|
2392
|
+
var yr = ["Ok", "Cancel"], br = (e) => typeof e == "string" ? e : e.id ?? e, xr = (e, t) => t !== void 0 && br(e) === br(t), Sr = (e) => typeof e != "string" && (typeof e.disabled == "function" ? e.disabled() : !0 === e.disabled), Cr = w(C((e, r) => {
|
|
2393
|
+
let { description: s, icon: c, onCancel: l, onOption: u, onDone: d, onValidateOption: p, options: m = yr, autoFocusSel: h = ".defaultOption", defaultOption: g = m[0], cancelOption: _ = "Cancel", autoFocus: b, children: x, ...ee } = e, C = vr({ shouldUseNativeValidation: !1 }), { handleSubmit: w, formState: T } = C, te = O(null), E = O(null), A = de(), M = I((e) => typeof e == "string" ? e === "Ok" ? A("dialog.ok") : e === "Cancel" ? A("dialog.cancel") : e : typeof e.label == "function" ? e.label() : e.label, [A]), N = O(null), [P, ne] = k(null), re = I(async (e) => {
|
|
2394
|
+
let t = br(e);
|
|
2395
|
+
if (P !== null || Sr(e)) return;
|
|
2396
|
+
let n = xr(e, _), r;
|
|
2397
|
+
try {
|
|
2398
|
+
if (ne(t), r = !!n || (await Promise.resolve(p?.(t)) ?? !0), !0 !== r) return;
|
|
2399
|
+
await Promise.resolve(u?.(t, n, xr(e, g))), d?.(t);
|
|
2400
|
+
} catch {} finally {
|
|
2401
|
+
ne(null);
|
|
2402
|
+
}
|
|
2403
|
+
}, [
|
|
2404
|
+
u,
|
|
2405
|
+
d,
|
|
2406
|
+
p,
|
|
2407
|
+
_,
|
|
2408
|
+
g,
|
|
2409
|
+
P
|
|
2410
|
+
]), F = I((e, t) => {
|
|
2411
|
+
setTimeout(() => {
|
|
2412
|
+
re(g);
|
|
2413
|
+
}, 180);
|
|
2414
|
+
}, [re, g]), ae = I(() => {
|
|
2415
|
+
u?.(br(_), !0, !1), l?.(), d?.(null);
|
|
2416
|
+
}, [
|
|
2417
|
+
u,
|
|
2418
|
+
_,
|
|
2419
|
+
l,
|
|
2420
|
+
d
|
|
2421
|
+
]), oe = T && (Object.keys(T.errors).length > 0 || T.disabled || T.isSubmitting), se = I((e, t, r) => {
|
|
2422
|
+
let a = xr(e, _), o = {
|
|
2423
|
+
className: t ? "defaultOption" : "action",
|
|
2424
|
+
type: t ? "submit" : "button",
|
|
2425
|
+
style: { minWidth: "75px" },
|
|
2426
|
+
onClick: () => {
|
|
2427
|
+
a ? ae() : t || re(e);
|
|
2428
|
+
}
|
|
2429
|
+
}, s = typeof e == "string" ? void 0 : e.renderButton;
|
|
2430
|
+
if (s) return v(S, { children: s(o, t) }, `action:${r}`);
|
|
2431
|
+
let c = P !== null && xr(e, P), l = {
|
|
2432
|
+
className: t ? "defaultOption" : "action",
|
|
2433
|
+
variant: t ? "contained" : "outlined",
|
|
2434
|
+
size: "small",
|
|
2435
|
+
disabled: !a && (oe || Sr(e)) || P !== null && !c,
|
|
2436
|
+
color: "primary",
|
|
2437
|
+
...o
|
|
2438
|
+
};
|
|
2439
|
+
if (t || a) {
|
|
2440
|
+
let e = t ? te : E;
|
|
2441
|
+
l.touchRippleRef = e, l.onPointerDown = (t) => {
|
|
2442
|
+
e.current?.start(t, { center: !1 }), t.stopPropagation(), t.preventDefault();
|
|
2443
|
+
};
|
|
2444
|
+
}
|
|
2445
|
+
return y(n, {
|
|
2446
|
+
...l,
|
|
2447
|
+
children: [v("div", {
|
|
2448
|
+
style: { visibility: c ? "hidden" : void 0 },
|
|
2449
|
+
children: M(e)
|
|
2450
|
+
}), p && !a ? v(i, {
|
|
2451
|
+
size: 16,
|
|
2452
|
+
color: "inherit",
|
|
2453
|
+
style: { opacity: +!!c },
|
|
2454
|
+
sx: {
|
|
2455
|
+
position: "absolute",
|
|
2456
|
+
top: "calc(50% - 8px)",
|
|
2457
|
+
left: "calc(50% - 8px)",
|
|
2458
|
+
zIndex: 1,
|
|
2459
|
+
pointerEvents: "none",
|
|
2460
|
+
transition: "opacity 120ms"
|
|
2461
|
+
}
|
|
2462
|
+
}) : null]
|
|
2463
|
+
}, `action:${r}`);
|
|
2464
|
+
}, [
|
|
2465
|
+
m,
|
|
2466
|
+
g,
|
|
2467
|
+
_,
|
|
2468
|
+
T,
|
|
2469
|
+
M,
|
|
2470
|
+
P
|
|
2471
|
+
]), ce = D(() => {
|
|
2472
|
+
let e = [];
|
|
2473
|
+
for (let t = 0; t < m.length; t++) {
|
|
2474
|
+
let n = m[t], r = g === void 0 ? t === 0 : xr(n, g);
|
|
2475
|
+
e.push(se(n, r, t));
|
|
2476
|
+
}
|
|
2477
|
+
return e;
|
|
2478
|
+
}, [
|
|
2479
|
+
m,
|
|
2480
|
+
g,
|
|
2481
|
+
T,
|
|
2482
|
+
A,
|
|
2483
|
+
P
|
|
2484
|
+
]);
|
|
2485
|
+
return v(Rt, {
|
|
2486
|
+
onCancel: ae,
|
|
2487
|
+
initialPosition: { y: Xt === "touch" ? "15" : "35" },
|
|
2488
|
+
onDone: d,
|
|
2489
|
+
autoFocusSel: h,
|
|
2490
|
+
isModal: !0,
|
|
2491
|
+
ref: r,
|
|
2492
|
+
...ee,
|
|
2493
|
+
children: v(Zn, {
|
|
2494
|
+
...C,
|
|
2495
|
+
children: y("form", {
|
|
2496
|
+
ref: N,
|
|
2497
|
+
onSubmit: w(F),
|
|
2498
|
+
children: [v(o, {
|
|
2499
|
+
dividers: !0,
|
|
2500
|
+
onKeyDown: (e) => {
|
|
2501
|
+
if (e.isDefaultPrevented()) return;
|
|
2502
|
+
e.stopPropagation();
|
|
2503
|
+
let t = null, n = null, r = e.which === ie.Escape && _;
|
|
2504
|
+
if (r) {
|
|
2505
|
+
if (P !== null) return;
|
|
2506
|
+
t = _, n = E;
|
|
2507
|
+
} else {
|
|
2508
|
+
if (oe || P !== null) return;
|
|
2509
|
+
e.which === ie.Enter && (t = g ?? m[0], n = te);
|
|
2510
|
+
}
|
|
2511
|
+
t && (n?.current?.start(e, { center: !1 }), setTimeout(() => {
|
|
2512
|
+
n?.current?.stop(e), r && ae();
|
|
2513
|
+
}, 180));
|
|
2514
|
+
},
|
|
2515
|
+
children: y(t, {
|
|
2516
|
+
sx: {
|
|
2517
|
+
display: "flex",
|
|
2518
|
+
flexDirection: "column",
|
|
2519
|
+
whiteSpace: "pre-wrap",
|
|
2520
|
+
rowGap: (e) => e.spacing(c || s ? 1.5 : 0)
|
|
2521
|
+
},
|
|
2522
|
+
children: [y(t, {
|
|
2523
|
+
sx: {
|
|
2524
|
+
display: "flex",
|
|
2525
|
+
flexDirection: "column"
|
|
2526
|
+
},
|
|
2527
|
+
children: [c, v(f, { children: s })]
|
|
2528
|
+
}), x]
|
|
2529
|
+
})
|
|
2530
|
+
}), v(a, {
|
|
2531
|
+
sx: {
|
|
2532
|
+
paddingTop: (e) => e.spacing(1),
|
|
2533
|
+
paddingBottom: (e) => e.spacing(1),
|
|
2534
|
+
paddingLeft: (e) => e.spacing(1),
|
|
2535
|
+
paddingRight: (e) => e.spacing(1),
|
|
2536
|
+
backgroundColor: (e) => j(e.palette.action.hover, .03)
|
|
2537
|
+
},
|
|
2538
|
+
children: ce
|
|
2539
|
+
})]
|
|
2540
|
+
})
|
|
2541
|
+
})
|
|
2542
|
+
});
|
|
2543
|
+
}));
|
|
2544
|
+
export { Oe as C, Ae as S, Ce as T, Pe as _, Ye as a, Me as b, We as c, R as d, He as f, Be as g, Ve as h, $e as i, Ge as l, ze as m, br as n, Je as o, Re as p, Rt as r, Ke as s, Cr as t, Ue as u, Fe as v, Te as w, je as x, Ne as y };
|