zudoku 0.12.2 → 0.13.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/dist/app/main.js +3 -3
- package/dist/app/main.js.map +1 -1
- package/dist/cli/dev/handler.js +2 -2
- package/dist/cli/dev/handler.js.map +1 -1
- package/dist/config/validators/validate.d.ts +42 -23
- package/dist/config/validators/validate.js +6 -2
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/lib/components/Banner.js +7 -1
- package/dist/lib/components/Banner.js.map +1 -1
- package/dist/lib/components/Header.js +1 -1
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Layout.js +1 -1
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/MobileTopNavigation.js +2 -1
- package/dist/lib/components/MobileTopNavigation.js.map +1 -1
- package/dist/lib/components/Search.js +1 -1
- package/dist/lib/components/Search.js.map +1 -1
- package/dist/lib/components/SlotletProvider.d.ts +9 -2
- package/dist/lib/components/SlotletProvider.js +4 -2
- package/dist/lib/components/SlotletProvider.js.map +1 -1
- package/dist/lib/components/index.d.ts +2 -1
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/core/DevPortalContext.d.ts +1 -1
- package/dist/lib/oas/graphql/index.js +2 -6
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/plugins/custom-pages/CustomPage.d.ts +2 -0
- package/dist/lib/plugins/custom-pages/CustomPage.js +10 -0
- package/dist/lib/plugins/custom-pages/CustomPage.js.map +1 -0
- package/dist/lib/plugins/custom-pages/index.d.ts +10 -0
- package/dist/lib/plugins/custom-pages/index.js +11 -0
- package/dist/lib/plugins/custom-pages/index.js.map +1 -0
- package/dist/lib/plugins/openapi/Endpoint.js +1 -1
- package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +1 -1
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/Route.d.ts +1 -1
- package/dist/lib/plugins/openapi/Route.js +1 -1
- package/dist/lib/plugins/openapi/Route.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/client/createMemoryClient.js +1 -1
- package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +1 -1
- package/dist/lib/plugins/openapi/client/createWorkerClient.js +1 -1
- package/dist/lib/plugins/openapi/client/createWorkerClient.js.map +1 -1
- package/dist/lib/plugins/openapi/index.js +1 -1
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/ui/Callout.d.ts +36 -35
- package/dist/lib/ui/Callout.js.map +1 -1
- package/dist/lib/ui/Drawer.d.ts +8 -10
- package/dist/lib/ui/Drawer.js.map +1 -1
- package/dist/lib/util/useExposedProps.d.ts +2 -0
- package/dist/lib/util/useExposedProps.js +8 -0
- package/dist/lib/util/useExposedProps.js.map +1 -0
- package/dist/vite/config.js +2 -0
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/dev-server.d.ts +6 -1
- package/dist/vite/dev-server.js +13 -3
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/plugin-component.js +0 -1
- package/dist/vite/plugin-component.js.map +1 -1
- package/dist/vite/plugin-custom-pages.d.ts +4 -0
- package/dist/vite/plugin-custom-pages.js +30 -0
- package/dist/vite/plugin-custom-pages.js.map +1 -0
- package/dist/vite/plugin.js +2 -0
- package/dist/vite/plugin.js.map +1 -1
- package/lib/{AuthenticationPlugin-Bx9FK124.js → AuthenticationPlugin-CbgJ5SAh.js} +3 -3
- package/lib/{AuthenticationPlugin-Bx9FK124.js.map → AuthenticationPlugin-CbgJ5SAh.js.map} +1 -1
- package/lib/{DeveloperHint-YeWHKvyr.js → DeveloperHint-CiXPc9Xm.js} +2 -2
- package/lib/{DeveloperHint-YeWHKvyr.js.map → DeveloperHint-CiXPc9Xm.js.map} +1 -1
- package/lib/ErrorPage-B-zoPPVx.js +15 -0
- package/lib/{ErrorPage-CsZAN_za.js.map → ErrorPage-B-zoPPVx.js.map} +1 -1
- package/lib/Input-QMLhK7Rb.js +2229 -0
- package/lib/Input-QMLhK7Rb.js.map +1 -0
- package/lib/{Markdown-DapSf3wG.js → Markdown-D6Nze6qq.js} +3281 -5392
- package/lib/Markdown-D6Nze6qq.js.map +1 -0
- package/lib/{MdxPage-BqBWsXZ1.js → MdxPage-DBhq6-5F.js} +15 -15
- package/lib/{MdxPage-BqBWsXZ1.js.map → MdxPage-DBhq6-5F.js.map} +1 -1
- package/lib/{OperationList-CYrmxPa8.js → OperationList-Ba24gUd2.js} +50 -51
- package/lib/OperationList-Ba24gUd2.js.map +1 -0
- package/lib/{Route-Q5mqNQrv.js → Route-DI38nxYt.js} +3 -4
- package/lib/Route-DI38nxYt.js.map +1 -0
- package/lib/SidebarBadge-B9-VJSQr.js +503 -0
- package/lib/SidebarBadge-B9-VJSQr.js.map +1 -0
- package/lib/{SlotletProvider-D3UD5Go3.js → SlotletProvider-Cb8mGpBO.js} +46 -46
- package/lib/{SlotletProvider-D3UD5Go3.js.map → SlotletProvider-Cb8mGpBO.js.map} +1 -1
- package/lib/ZudokuContext-BEmsYQoq.js +1173 -0
- package/lib/ZudokuContext-BEmsYQoq.js.map +1 -0
- package/lib/assets/{index-B9EWVYfo.js → index-B_Jk_Yzp.js} +968 -938
- package/lib/assets/index-B_Jk_Yzp.js.map +1 -0
- package/lib/assets/{worker-Bcj4NA2p.js → worker-Bf8vjASY.js} +4582 -4303
- package/lib/assets/worker-Bf8vjASY.js.map +1 -0
- package/lib/cn-BmFQLtkS.js +2279 -0
- package/lib/cn-BmFQLtkS.js.map +1 -0
- package/lib/{index-BG0g4WW0.js → index-BRCiYFaL.js} +747 -737
- package/lib/index-BRCiYFaL.js.map +1 -0
- package/lib/{index-CLd8ycZz.js → index-CkwDvuPt.js} +947 -917
- package/lib/index-CkwDvuPt.js.map +1 -0
- package/lib/{index-LNp6rxyU.js → index-D06ATMgg.js} +2 -2
- package/lib/{index-LNp6rxyU.js.map → index-D06ATMgg.js.map} +1 -1
- package/lib/{index-BlJ2rj99.js → index-DA74gNq3.js} +1124 -974
- package/lib/index-DA74gNq3.js.map +1 -0
- package/lib/index-DJqnphbT.js +35 -0
- package/lib/{index-Bn6Lc9tq.js.map → index-DJqnphbT.js.map} +1 -1
- package/lib/{index-BngPzhKn.js → index-dgcPryXi.js} +3 -3
- package/lib/{index-BngPzhKn.js.map → index-dgcPryXi.js.map} +1 -1
- package/lib/{index-Dolisrci.js → index-g_JJcuFg.js} +603 -549
- package/lib/index-g_JJcuFg.js.map +1 -0
- package/lib/router-Oe6YmY6B.js +3024 -0
- package/lib/router-Oe6YmY6B.js.map +1 -0
- package/lib/state-CsuHT8ZO.js +183 -0
- package/lib/state-CsuHT8ZO.js.map +1 -0
- package/lib/urql-core-KJnLL26g.js +1455 -0
- package/lib/urql-core-KJnLL26g.js.map +1 -0
- package/lib/useExposedProps-Csw8oAlt.js +9 -0
- package/lib/useExposedProps-Csw8oAlt.js.map +1 -0
- package/lib/{utils-ByIc_KIM.js → utils-Chi3p5nE.js} +4 -4
- package/lib/utils-Chi3p5nE.js.map +1 -0
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-openid.js +363 -350
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +1697 -1623
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +4599 -4319
- package/lib/zudoku.openapi-worker.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +7 -7
- package/lib/zudoku.plugin-custom-pages.js +21 -0
- package/lib/zudoku.plugin-custom-pages.js.map +1 -0
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +8 -8
- package/lib/zudoku.plugin-redirect.js +1 -1
- package/package.json +61 -68
- package/src/app/main.tsx +3 -3
- package/src/lib/components/Banner.tsx +12 -2
- package/src/lib/components/Header.tsx +4 -2
- package/src/lib/components/Layout.tsx +1 -0
- package/src/lib/components/MobileTopNavigation.tsx +4 -0
- package/src/lib/components/Search.tsx +1 -1
- package/src/lib/components/SlotletProvider.tsx +27 -4
- package/src/lib/components/index.ts +1 -1
- package/src/lib/core/DevPortalContext.ts +1 -1
- package/src/lib/oas/graphql/index.ts +3 -11
- package/src/lib/plugins/custom-pages/CustomPage.tsx +15 -0
- package/src/lib/plugins/custom-pages/index.tsx +24 -0
- package/src/lib/plugins/openapi/Endpoint.tsx +1 -1
- package/src/lib/plugins/openapi/OperationList.tsx +1 -1
- package/src/lib/plugins/openapi/Route.tsx +1 -2
- package/src/lib/plugins/openapi/Sidecar.tsx +1 -1
- package/src/lib/plugins/openapi/client/createMemoryClient.ts +1 -6
- package/src/lib/plugins/openapi/client/createWorkerClient.ts +1 -6
- package/src/lib/plugins/openapi/index.tsx +1 -5
- package/src/lib/ui/Callout.tsx +7 -6
- package/src/lib/ui/Drawer.tsx +38 -36
- package/src/lib/util/useExposedProps.tsx +10 -0
- package/dist/lib/plugins/custom-page/index.d.ts +0 -8
- package/dist/lib/plugins/custom-page/index.js +0 -12
- package/dist/lib/plugins/custom-page/index.js.map +0 -1
- package/dist/lib/plugins/openapi/playground/Editor.d.ts +0 -1
- package/dist/lib/plugins/openapi/playground/Editor.js +0 -5
- package/dist/lib/plugins/openapi/playground/Editor.js.map +0 -1
- package/dist/lib/plugins/openapi/util/urql.d.ts +0 -7
- package/dist/lib/plugins/openapi/util/urql.js +0 -8
- package/dist/lib/plugins/openapi/util/urql.js.map +0 -1
- package/lib/CategoryHeading-ovR-zHRq.js +0 -10
- package/lib/CategoryHeading-ovR-zHRq.js.map +0 -1
- package/lib/ErrorPage-CsZAN_za.js +0 -16
- package/lib/Input-CtVUl3eT.js +0 -2198
- package/lib/Input-CtVUl3eT.js.map +0 -1
- package/lib/Markdown-DapSf3wG.js.map +0 -1
- package/lib/OperationList-CYrmxPa8.js.map +0 -1
- package/lib/Route-Q5mqNQrv.js.map +0 -1
- package/lib/SidebarBadge-Dx7jtnoA.js +0 -498
- package/lib/SidebarBadge-Dx7jtnoA.js.map +0 -1
- package/lib/ZudokuContext-cr-pTRY1.js +0 -1084
- package/lib/ZudokuContext-cr-pTRY1.js.map +0 -1
- package/lib/_commonjsHelpers-BkfeUUK-.js +0 -29
- package/lib/_commonjsHelpers-BkfeUUK-.js.map +0 -1
- package/lib/assets/index-B9EWVYfo.js.map +0 -1
- package/lib/assets/worker-Bcj4NA2p.js.map +0 -1
- package/lib/index-BG0g4WW0.js.map +0 -1
- package/lib/index-BlJ2rj99.js.map +0 -1
- package/lib/index-Bn6Lc9tq.js +0 -9
- package/lib/index-CLd8ycZz.js.map +0 -1
- package/lib/index-Dolisrci.js.map +0 -1
- package/lib/router-D2p7Olpn.js +0 -2971
- package/lib/router-D2p7Olpn.js.map +0 -1
- package/lib/state-hNe1dw4B.js +0 -548
- package/lib/state-hNe1dw4B.js.map +0 -1
- package/lib/urql-YhcsXYy8.js +0 -1591
- package/lib/urql-YhcsXYy8.js.map +0 -1
- package/lib/utils-ByIc_KIM.js.map +0 -1
- package/lib/zudoku.plugin-custom-page.js +0 -13
- package/lib/zudoku.plugin-custom-page.js.map +0 -1
- package/src/lib/plugins/custom-page/index.tsx +0 -22
- package/src/lib/plugins/openapi/playground/Editor.tsx +0 -4
- package/src/lib/plugins/openapi/util/urql.ts +0 -8
|
@@ -0,0 +1,2229 @@
|
|
|
1
|
+
var zt = (e) => {
|
|
2
|
+
throw TypeError(e);
|
|
3
|
+
};
|
|
4
|
+
var _t = (e, r, t) => r.has(e) || zt("Cannot " + t);
|
|
5
|
+
var Z = (e, r, t) => (_t(e, r, "read from private field"), t ? t.call(e) : r.get(e)), Ue = (e, r, t) => r.has(e) ? zt("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(e) : r.set(e, t), He = (e, r, t, s) => (_t(e, r, "write to private field"), s ? s.call(e, t) : r.set(e, t), t), We = (e, r, t) => (_t(e, r, "access private method"), t);
|
|
6
|
+
import * as p from "react";
|
|
7
|
+
import I from "react";
|
|
8
|
+
import { o as ps, f as hs, c as ms, p as ir, d as _e, A as ys, P as me, b as oe, e as De, j as gs, k as vs, R as xs, S as _s, F as Ss, D as bs, C as ws, a as Bt, q as Cs, V as As, i as Vs, m as Fs, h as Es, u as Yt, r as Ts } from "./index-g_JJcuFg.js";
|
|
9
|
+
import { S as Is, s as Rs, h as Xt, n as ar, a as Ns, d as Ds, e as Ps } from "./ZudokuContext-BEmsYQoq.js";
|
|
10
|
+
import { j as b } from "./jsx-runtime-B6kdoens.js";
|
|
11
|
+
import * as lr from "react-dom";
|
|
12
|
+
import { ChevronDown as cr, ChevronUp as ks, Check as Ms } from "lucide-react";
|
|
13
|
+
import { c as Ee } from "./cn-BmFQLtkS.js";
|
|
14
|
+
var Re, Ne, de, Ae, Fe, nt, Nt, nr, Os = (nr = class extends Is {
|
|
15
|
+
constructor(r, t) {
|
|
16
|
+
super();
|
|
17
|
+
Ue(this, Fe);
|
|
18
|
+
Ue(this, Re);
|
|
19
|
+
Ue(this, Ne);
|
|
20
|
+
Ue(this, de);
|
|
21
|
+
Ue(this, Ae);
|
|
22
|
+
He(this, Re, r), this.setOptions(t), this.bindMethods(), We(this, Fe, nt).call(this);
|
|
23
|
+
}
|
|
24
|
+
bindMethods() {
|
|
25
|
+
this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
|
|
26
|
+
}
|
|
27
|
+
setOptions(r) {
|
|
28
|
+
var s;
|
|
29
|
+
const t = this.options;
|
|
30
|
+
this.options = Z(this, Re).defaultMutationOptions(r), Rs(this.options, t) || Z(this, Re).getMutationCache().notify({
|
|
31
|
+
type: "observerOptionsUpdated",
|
|
32
|
+
mutation: Z(this, de),
|
|
33
|
+
observer: this
|
|
34
|
+
}), t != null && t.mutationKey && this.options.mutationKey && Xt(t.mutationKey) !== Xt(this.options.mutationKey) ? this.reset() : ((s = Z(this, de)) == null ? void 0 : s.state.status) === "pending" && Z(this, de).setOptions(this.options);
|
|
35
|
+
}
|
|
36
|
+
onUnsubscribe() {
|
|
37
|
+
var r;
|
|
38
|
+
this.hasListeners() || (r = Z(this, de)) == null || r.removeObserver(this);
|
|
39
|
+
}
|
|
40
|
+
onMutationUpdate(r) {
|
|
41
|
+
We(this, Fe, nt).call(this), We(this, Fe, Nt).call(this, r);
|
|
42
|
+
}
|
|
43
|
+
getCurrentResult() {
|
|
44
|
+
return Z(this, Ne);
|
|
45
|
+
}
|
|
46
|
+
reset() {
|
|
47
|
+
var r;
|
|
48
|
+
(r = Z(this, de)) == null || r.removeObserver(this), He(this, de, void 0), We(this, Fe, nt).call(this), We(this, Fe, Nt).call(this);
|
|
49
|
+
}
|
|
50
|
+
mutate(r, t) {
|
|
51
|
+
var s;
|
|
52
|
+
return He(this, Ae, t), (s = Z(this, de)) == null || s.removeObserver(this), He(this, de, Z(this, Re).getMutationCache().build(Z(this, Re), this.options)), Z(this, de).addObserver(this), Z(this, de).execute(r);
|
|
53
|
+
}
|
|
54
|
+
}, Re = new WeakMap(), Ne = new WeakMap(), de = new WeakMap(), Ae = new WeakMap(), Fe = new WeakSet(), nt = function() {
|
|
55
|
+
var t;
|
|
56
|
+
const r = ((t = Z(this, de)) == null ? void 0 : t.state) ?? ps();
|
|
57
|
+
He(this, Ne, {
|
|
58
|
+
...r,
|
|
59
|
+
isPending: r.status === "pending",
|
|
60
|
+
isSuccess: r.status === "success",
|
|
61
|
+
isError: r.status === "error",
|
|
62
|
+
isIdle: r.status === "idle",
|
|
63
|
+
mutate: this.mutate,
|
|
64
|
+
reset: this.reset
|
|
65
|
+
});
|
|
66
|
+
}, Nt = function(r) {
|
|
67
|
+
ar.batch(() => {
|
|
68
|
+
var t, s, n, i, l, c, d, _;
|
|
69
|
+
if (Z(this, Ae) && this.hasListeners()) {
|
|
70
|
+
const m = Z(this, Ne).variables, g = Z(this, Ne).context;
|
|
71
|
+
(r == null ? void 0 : r.type) === "success" ? ((s = (t = Z(this, Ae)).onSuccess) == null || s.call(t, r.data, m, g), (i = (n = Z(this, Ae)).onSettled) == null || i.call(n, r.data, null, m, g)) : (r == null ? void 0 : r.type) === "error" && ((c = (l = Z(this, Ae)).onError) == null || c.call(l, r.error, m, g), (_ = (d = Z(this, Ae)).onSettled) == null || _.call(
|
|
72
|
+
d,
|
|
73
|
+
void 0,
|
|
74
|
+
r.error,
|
|
75
|
+
m,
|
|
76
|
+
g
|
|
77
|
+
));
|
|
78
|
+
}
|
|
79
|
+
this.listeners.forEach((m) => {
|
|
80
|
+
m(Z(this, Ne));
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}, nr);
|
|
84
|
+
function Ho(e, r) {
|
|
85
|
+
const t = Ns(), [s] = p.useState(
|
|
86
|
+
() => new Os(
|
|
87
|
+
t,
|
|
88
|
+
e
|
|
89
|
+
)
|
|
90
|
+
);
|
|
91
|
+
p.useEffect(() => {
|
|
92
|
+
s.setOptions(e);
|
|
93
|
+
}, [s, e]);
|
|
94
|
+
const n = p.useSyncExternalStore(
|
|
95
|
+
p.useCallback(
|
|
96
|
+
(l) => s.subscribe(ar.batchCalls(l)),
|
|
97
|
+
[s]
|
|
98
|
+
),
|
|
99
|
+
() => s.getCurrentResult(),
|
|
100
|
+
() => s.getCurrentResult()
|
|
101
|
+
), i = p.useCallback(
|
|
102
|
+
(l, c) => {
|
|
103
|
+
s.mutate(l, c).catch(Ds);
|
|
104
|
+
},
|
|
105
|
+
[s]
|
|
106
|
+
);
|
|
107
|
+
if (n.error && Ps(s.options.throwOnError, [n.error]))
|
|
108
|
+
throw n.error;
|
|
109
|
+
return { ...n, mutate: i, mutateAsync: n.mutate };
|
|
110
|
+
}
|
|
111
|
+
var Qe = (e) => e.type === "checkbox", $e = (e) => e instanceof Date, le = (e) => e == null;
|
|
112
|
+
const ur = (e) => typeof e == "object";
|
|
113
|
+
var ee = (e) => !le(e) && !Array.isArray(e) && ur(e) && !$e(e), dr = (e) => ee(e) && e.target ? Qe(e.target) ? e.target.checked : e.target.value : e, js = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, fr = (e, r) => e.has(js(r)), Ls = (e) => {
|
|
114
|
+
const r = e.constructor && e.constructor.prototype;
|
|
115
|
+
return ee(r) && r.hasOwnProperty("isPrototypeOf");
|
|
116
|
+
}, Ut = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
117
|
+
function te(e) {
|
|
118
|
+
let r;
|
|
119
|
+
const t = Array.isArray(e);
|
|
120
|
+
if (e instanceof Date)
|
|
121
|
+
r = new Date(e);
|
|
122
|
+
else if (e instanceof Set)
|
|
123
|
+
r = new Set(e);
|
|
124
|
+
else if (!(Ut && (e instanceof Blob || e instanceof FileList)) && (t || ee(e)))
|
|
125
|
+
if (r = t ? [] : {}, !t && !Ls(e))
|
|
126
|
+
r = e;
|
|
127
|
+
else
|
|
128
|
+
for (const s in e)
|
|
129
|
+
e.hasOwnProperty(s) && (r[s] = te(e[s]));
|
|
130
|
+
else
|
|
131
|
+
return e;
|
|
132
|
+
return r;
|
|
133
|
+
}
|
|
134
|
+
var Je = (e) => Array.isArray(e) ? e.filter(Boolean) : [], q = (e) => e === void 0, h = (e, r, t) => {
|
|
135
|
+
if (!r || !ee(e))
|
|
136
|
+
return t;
|
|
137
|
+
const s = Je(r.split(/[,[\].]+?/)).reduce((n, i) => le(n) ? n : n[i], e);
|
|
138
|
+
return q(s) || s === e ? q(e[r]) ? t : e[r] : s;
|
|
139
|
+
}, pe = (e) => typeof e == "boolean", Ht = (e) => /^\w*$/.test(e), pr = (e) => Je(e.replace(/["|']|\]/g, "").split(/\.|\[/)), U = (e, r, t) => {
|
|
140
|
+
let s = -1;
|
|
141
|
+
const n = Ht(r) ? [r] : pr(r), i = n.length, l = i - 1;
|
|
142
|
+
for (; ++s < i; ) {
|
|
143
|
+
const c = n[s];
|
|
144
|
+
let d = t;
|
|
145
|
+
if (s !== l) {
|
|
146
|
+
const _ = e[c];
|
|
147
|
+
d = ee(_) || Array.isArray(_) ? _ : isNaN(+n[s + 1]) ? {} : [];
|
|
148
|
+
}
|
|
149
|
+
if (c === "__proto__")
|
|
150
|
+
return;
|
|
151
|
+
e[c] = d, e = e[c];
|
|
152
|
+
}
|
|
153
|
+
return e;
|
|
154
|
+
};
|
|
155
|
+
const at = {
|
|
156
|
+
BLUR: "blur",
|
|
157
|
+
FOCUS_OUT: "focusout",
|
|
158
|
+
CHANGE: "change"
|
|
159
|
+
}, he = {
|
|
160
|
+
onBlur: "onBlur",
|
|
161
|
+
onChange: "onChange",
|
|
162
|
+
onSubmit: "onSubmit",
|
|
163
|
+
onTouched: "onTouched",
|
|
164
|
+
all: "all"
|
|
165
|
+
}, Ce = {
|
|
166
|
+
max: "max",
|
|
167
|
+
min: "min",
|
|
168
|
+
maxLength: "maxLength",
|
|
169
|
+
minLength: "minLength",
|
|
170
|
+
pattern: "pattern",
|
|
171
|
+
required: "required",
|
|
172
|
+
validate: "validate"
|
|
173
|
+
}, hr = I.createContext(null), pt = () => I.useContext(hr), Wo = (e) => {
|
|
174
|
+
const { children: r, ...t } = e;
|
|
175
|
+
return I.createElement(hr.Provider, { value: t }, r);
|
|
176
|
+
};
|
|
177
|
+
var mr = (e, r, t, s = !0) => {
|
|
178
|
+
const n = {
|
|
179
|
+
defaultValues: r._defaultValues
|
|
180
|
+
};
|
|
181
|
+
for (const i in e)
|
|
182
|
+
Object.defineProperty(n, i, {
|
|
183
|
+
get: () => {
|
|
184
|
+
const l = i;
|
|
185
|
+
return r._proxyFormState[l] !== he.all && (r._proxyFormState[l] = !s || he.all), t && (t[l] = !0), e[l];
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
return n;
|
|
189
|
+
}, ae = (e) => ee(e) && !Object.keys(e).length, yr = (e, r, t, s) => {
|
|
190
|
+
t(e);
|
|
191
|
+
const { name: n, ...i } = e;
|
|
192
|
+
return ae(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((l) => r[l] === (!s || he.all));
|
|
193
|
+
}, fe = (e) => Array.isArray(e) ? e : [e], gr = (e, r, t) => !e || !r || e === r || fe(e).some((s) => s && (t ? s === r : s.startsWith(r) || r.startsWith(s)));
|
|
194
|
+
function ht(e) {
|
|
195
|
+
const r = I.useRef(e);
|
|
196
|
+
r.current = e, I.useEffect(() => {
|
|
197
|
+
const t = !e.disabled && r.current.subject && r.current.subject.subscribe({
|
|
198
|
+
next: r.current.next
|
|
199
|
+
});
|
|
200
|
+
return () => {
|
|
201
|
+
t && t.unsubscribe();
|
|
202
|
+
};
|
|
203
|
+
}, [e.disabled]);
|
|
204
|
+
}
|
|
205
|
+
function Bs(e) {
|
|
206
|
+
const r = pt(), { control: t = r.control, disabled: s, name: n, exact: i } = e || {}, [l, c] = I.useState(t._formState), d = I.useRef(!0), _ = I.useRef({
|
|
207
|
+
isDirty: !1,
|
|
208
|
+
isLoading: !1,
|
|
209
|
+
dirtyFields: !1,
|
|
210
|
+
touchedFields: !1,
|
|
211
|
+
validatingFields: !1,
|
|
212
|
+
isValidating: !1,
|
|
213
|
+
isValid: !1,
|
|
214
|
+
errors: !1
|
|
215
|
+
}), m = I.useRef(n);
|
|
216
|
+
return m.current = n, ht({
|
|
217
|
+
disabled: s,
|
|
218
|
+
next: (g) => d.current && gr(m.current, g.name, i) && yr(g, _.current, t._updateFormState) && c({
|
|
219
|
+
...t._formState,
|
|
220
|
+
...g
|
|
221
|
+
}),
|
|
222
|
+
subject: t._subjects.state
|
|
223
|
+
}), I.useEffect(() => (d.current = !0, _.current.isValid && t._updateValid(!0), () => {
|
|
224
|
+
d.current = !1;
|
|
225
|
+
}), [t]), mr(l, t, _.current, !1);
|
|
226
|
+
}
|
|
227
|
+
var xe = (e) => typeof e == "string", vr = (e, r, t, s, n) => xe(e) ? (s && r.watch.add(e), h(t, e, n)) : Array.isArray(e) ? e.map((i) => (s && r.watch.add(i), h(t, i))) : (s && (r.watchAll = !0), t);
|
|
228
|
+
function Us(e) {
|
|
229
|
+
const r = pt(), { control: t = r.control, name: s, defaultValue: n, disabled: i, exact: l } = e || {}, c = I.useRef(s);
|
|
230
|
+
c.current = s, ht({
|
|
231
|
+
disabled: i,
|
|
232
|
+
subject: t._subjects.values,
|
|
233
|
+
next: (m) => {
|
|
234
|
+
gr(c.current, m.name, l) && _(te(vr(c.current, t._names, m.values || t._formValues, !1, n)));
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
const [d, _] = I.useState(t._getWatch(s, n));
|
|
238
|
+
return I.useEffect(() => t._removeUnmounted()), d;
|
|
239
|
+
}
|
|
240
|
+
function Hs(e) {
|
|
241
|
+
const r = pt(), { name: t, disabled: s, control: n = r.control, shouldUnregister: i } = e, l = fr(n._names.array, t), c = Us({
|
|
242
|
+
control: n,
|
|
243
|
+
name: t,
|
|
244
|
+
defaultValue: h(n._formValues, t, h(n._defaultValues, t, e.defaultValue)),
|
|
245
|
+
exact: !0
|
|
246
|
+
}), d = Bs({
|
|
247
|
+
control: n,
|
|
248
|
+
name: t,
|
|
249
|
+
exact: !0
|
|
250
|
+
}), _ = I.useRef(n.register(t, {
|
|
251
|
+
...e.rules,
|
|
252
|
+
value: c,
|
|
253
|
+
...pe(e.disabled) ? { disabled: e.disabled } : {}
|
|
254
|
+
}));
|
|
255
|
+
return I.useEffect(() => {
|
|
256
|
+
const m = n._options.shouldUnregister || i, g = (E, O) => {
|
|
257
|
+
const D = h(n._fields, E);
|
|
258
|
+
D && D._f && (D._f.mount = O);
|
|
259
|
+
};
|
|
260
|
+
if (g(t, !0), m) {
|
|
261
|
+
const E = te(h(n._options.defaultValues, t));
|
|
262
|
+
U(n._defaultValues, t, E), q(h(n._formValues, t)) && U(n._formValues, t, E);
|
|
263
|
+
}
|
|
264
|
+
return () => {
|
|
265
|
+
(l ? m && !n._state.action : m) ? n.unregister(t) : g(t, !1);
|
|
266
|
+
};
|
|
267
|
+
}, [t, n, l, i]), I.useEffect(() => {
|
|
268
|
+
h(n._fields, t) && n._updateDisabledField({
|
|
269
|
+
disabled: s,
|
|
270
|
+
fields: n._fields,
|
|
271
|
+
name: t,
|
|
272
|
+
value: h(n._fields, t)._f.value
|
|
273
|
+
});
|
|
274
|
+
}, [s, t, n]), {
|
|
275
|
+
field: {
|
|
276
|
+
name: t,
|
|
277
|
+
value: c,
|
|
278
|
+
...pe(s) || d.disabled ? { disabled: d.disabled || s } : {},
|
|
279
|
+
onChange: I.useCallback((m) => _.current.onChange({
|
|
280
|
+
target: {
|
|
281
|
+
value: dr(m),
|
|
282
|
+
name: t
|
|
283
|
+
},
|
|
284
|
+
type: at.CHANGE
|
|
285
|
+
}), [t]),
|
|
286
|
+
onBlur: I.useCallback(() => _.current.onBlur({
|
|
287
|
+
target: {
|
|
288
|
+
value: h(n._formValues, t),
|
|
289
|
+
name: t
|
|
290
|
+
},
|
|
291
|
+
type: at.BLUR
|
|
292
|
+
}), [t, n]),
|
|
293
|
+
ref: I.useCallback((m) => {
|
|
294
|
+
const g = h(n._fields, t);
|
|
295
|
+
g && m && (g._f.ref = {
|
|
296
|
+
focus: () => m.focus(),
|
|
297
|
+
select: () => m.select(),
|
|
298
|
+
setCustomValidity: (E) => m.setCustomValidity(E),
|
|
299
|
+
reportValidity: () => m.reportValidity()
|
|
300
|
+
});
|
|
301
|
+
}, [n._fields, t])
|
|
302
|
+
},
|
|
303
|
+
formState: d,
|
|
304
|
+
fieldState: Object.defineProperties({}, {
|
|
305
|
+
invalid: {
|
|
306
|
+
enumerable: !0,
|
|
307
|
+
get: () => !!h(d.errors, t)
|
|
308
|
+
},
|
|
309
|
+
isDirty: {
|
|
310
|
+
enumerable: !0,
|
|
311
|
+
get: () => !!h(d.dirtyFields, t)
|
|
312
|
+
},
|
|
313
|
+
isTouched: {
|
|
314
|
+
enumerable: !0,
|
|
315
|
+
get: () => !!h(d.touchedFields, t)
|
|
316
|
+
},
|
|
317
|
+
isValidating: {
|
|
318
|
+
enumerable: !0,
|
|
319
|
+
get: () => !!h(d.validatingFields, t)
|
|
320
|
+
},
|
|
321
|
+
error: {
|
|
322
|
+
enumerable: !0,
|
|
323
|
+
get: () => h(d.errors, t)
|
|
324
|
+
}
|
|
325
|
+
})
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
const Ko = (e) => e.render(Hs(e));
|
|
329
|
+
var Ws = (e, r, t, s, n) => r ? {
|
|
330
|
+
...t[e],
|
|
331
|
+
types: {
|
|
332
|
+
...t[e] && t[e].types ? t[e].types : {},
|
|
333
|
+
[s]: n || !0
|
|
334
|
+
}
|
|
335
|
+
} : {}, Te = () => {
|
|
336
|
+
const e = typeof performance > "u" ? Date.now() : performance.now() * 1e3;
|
|
337
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
|
|
338
|
+
const t = (Math.random() * 16 + e) % 16 | 0;
|
|
339
|
+
return (r == "x" ? t : t & 3 | 8).toString(16);
|
|
340
|
+
});
|
|
341
|
+
}, St = (e, r, t = {}) => t.shouldFocus || q(t.shouldFocus) ? t.focusName || `${e}.${q(t.focusIndex) ? r : t.focusIndex}.` : "", Ze = (e) => ({
|
|
342
|
+
isOnSubmit: !e || e === he.onSubmit,
|
|
343
|
+
isOnBlur: e === he.onBlur,
|
|
344
|
+
isOnChange: e === he.onChange,
|
|
345
|
+
isOnAll: e === he.all,
|
|
346
|
+
isOnTouch: e === he.onTouched
|
|
347
|
+
}), Dt = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
|
|
348
|
+
const qe = (e, r, t, s) => {
|
|
349
|
+
for (const n of t || Object.keys(e)) {
|
|
350
|
+
const i = h(e, n);
|
|
351
|
+
if (i) {
|
|
352
|
+
const { _f: l, ...c } = i;
|
|
353
|
+
if (l) {
|
|
354
|
+
if (l.refs && l.refs[0] && r(l.refs[0], n) && !s)
|
|
355
|
+
return !0;
|
|
356
|
+
if (l.ref && r(l.ref, l.name) && !s)
|
|
357
|
+
return !0;
|
|
358
|
+
if (qe(c, r))
|
|
359
|
+
break;
|
|
360
|
+
} else if (ee(c) && qe(c, r))
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
var xr = (e, r, t) => {
|
|
366
|
+
const s = fe(h(e, t));
|
|
367
|
+
return U(s, "root", r[t]), U(e, t, s), e;
|
|
368
|
+
}, Wt = (e) => e.type === "file", Ve = (e) => typeof e == "function", lt = (e) => {
|
|
369
|
+
if (!Ut)
|
|
370
|
+
return !1;
|
|
371
|
+
const r = e ? e.ownerDocument : 0;
|
|
372
|
+
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
373
|
+
}, it = (e) => xe(e), Kt = (e) => e.type === "radio", ct = (e) => e instanceof RegExp;
|
|
374
|
+
const Zt = {
|
|
375
|
+
value: !1,
|
|
376
|
+
isValid: !1
|
|
377
|
+
}, Qt = { value: !0, isValid: !0 };
|
|
378
|
+
var _r = (e) => {
|
|
379
|
+
if (Array.isArray(e)) {
|
|
380
|
+
if (e.length > 1) {
|
|
381
|
+
const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
|
|
382
|
+
return { value: r, isValid: !!r.length };
|
|
383
|
+
}
|
|
384
|
+
return e[0].checked && !e[0].disabled ? (
|
|
385
|
+
// @ts-expect-error expected to work in the browser
|
|
386
|
+
e[0].attributes && !q(e[0].attributes.value) ? q(e[0].value) || e[0].value === "" ? Qt : { value: e[0].value, isValid: !0 } : Qt
|
|
387
|
+
) : Zt;
|
|
388
|
+
}
|
|
389
|
+
return Zt;
|
|
390
|
+
};
|
|
391
|
+
const Jt = {
|
|
392
|
+
isValid: !1,
|
|
393
|
+
value: null
|
|
394
|
+
};
|
|
395
|
+
var Sr = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
|
|
396
|
+
isValid: !0,
|
|
397
|
+
value: t.value
|
|
398
|
+
} : r, Jt) : Jt;
|
|
399
|
+
function er(e, r, t = "validate") {
|
|
400
|
+
if (it(e) || Array.isArray(e) && e.every(it) || pe(e) && !e)
|
|
401
|
+
return {
|
|
402
|
+
type: t,
|
|
403
|
+
message: it(e) ? e : "",
|
|
404
|
+
ref: r
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
var Ke = (e) => ee(e) && !ct(e) ? e : {
|
|
408
|
+
value: e,
|
|
409
|
+
message: ""
|
|
410
|
+
}, Pt = async (e, r, t, s, n) => {
|
|
411
|
+
const { ref: i, refs: l, required: c, maxLength: d, minLength: _, min: m, max: g, pattern: E, validate: O, name: D, valueAsNumber: C, mount: R, disabled: M } = e._f, y = h(r, D);
|
|
412
|
+
if (!R || M)
|
|
413
|
+
return {};
|
|
414
|
+
const V = l ? l[0] : i, z = (T) => {
|
|
415
|
+
s && V.reportValidity && (V.setCustomValidity(pe(T) ? "" : T || ""), V.reportValidity());
|
|
416
|
+
}, x = {}, w = Kt(i), F = Qe(i), k = w || F, Q = (C || Wt(i)) && q(i.value) && q(y) || lt(i) && i.value === "" || y === "" || Array.isArray(y) && !y.length, Y = Ws.bind(null, D, t, x), ce = (T, P, L, W = Ce.maxLength, K = Ce.minLength) => {
|
|
417
|
+
const X = T ? P : L;
|
|
418
|
+
x[D] = {
|
|
419
|
+
type: T ? W : K,
|
|
420
|
+
message: X,
|
|
421
|
+
ref: i,
|
|
422
|
+
...Y(T ? W : K, X)
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
if (n ? !Array.isArray(y) || !y.length : c && (!k && (Q || le(y)) || pe(y) && !y || F && !_r(l).isValid || w && !Sr(l).isValid)) {
|
|
426
|
+
const { value: T, message: P } = it(c) ? { value: !!c, message: c } : Ke(c);
|
|
427
|
+
if (T && (x[D] = {
|
|
428
|
+
type: Ce.required,
|
|
429
|
+
message: P,
|
|
430
|
+
ref: V,
|
|
431
|
+
...Y(Ce.required, P)
|
|
432
|
+
}, !t))
|
|
433
|
+
return z(P), x;
|
|
434
|
+
}
|
|
435
|
+
if (!Q && (!le(m) || !le(g))) {
|
|
436
|
+
let T, P;
|
|
437
|
+
const L = Ke(g), W = Ke(m);
|
|
438
|
+
if (!le(y) && !isNaN(y)) {
|
|
439
|
+
const K = i.valueAsNumber || y && +y;
|
|
440
|
+
le(L.value) || (T = K > L.value), le(W.value) || (P = K < W.value);
|
|
441
|
+
} else {
|
|
442
|
+
const K = i.valueAsDate || new Date(y), X = (Se) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Se), ie = i.type == "time", ue = i.type == "week";
|
|
443
|
+
xe(L.value) && y && (T = ie ? X(y) > X(L.value) : ue ? y > L.value : K > new Date(L.value)), xe(W.value) && y && (P = ie ? X(y) < X(W.value) : ue ? y < W.value : K < new Date(W.value));
|
|
444
|
+
}
|
|
445
|
+
if ((T || P) && (ce(!!T, L.message, W.message, Ce.max, Ce.min), !t))
|
|
446
|
+
return z(x[D].message), x;
|
|
447
|
+
}
|
|
448
|
+
if ((d || _) && !Q && (xe(y) || n && Array.isArray(y))) {
|
|
449
|
+
const T = Ke(d), P = Ke(_), L = !le(T.value) && y.length > +T.value, W = !le(P.value) && y.length < +P.value;
|
|
450
|
+
if ((L || W) && (ce(L, T.message, P.message), !t))
|
|
451
|
+
return z(x[D].message), x;
|
|
452
|
+
}
|
|
453
|
+
if (E && !Q && xe(y)) {
|
|
454
|
+
const { value: T, message: P } = Ke(E);
|
|
455
|
+
if (ct(T) && !y.match(T) && (x[D] = {
|
|
456
|
+
type: Ce.pattern,
|
|
457
|
+
message: P,
|
|
458
|
+
ref: i,
|
|
459
|
+
...Y(Ce.pattern, P)
|
|
460
|
+
}, !t))
|
|
461
|
+
return z(P), x;
|
|
462
|
+
}
|
|
463
|
+
if (O) {
|
|
464
|
+
if (Ve(O)) {
|
|
465
|
+
const T = await O(y, r), P = er(T, V);
|
|
466
|
+
if (P && (x[D] = {
|
|
467
|
+
...P,
|
|
468
|
+
...Y(Ce.validate, P.message)
|
|
469
|
+
}, !t))
|
|
470
|
+
return z(P.message), x;
|
|
471
|
+
} else if (ee(O)) {
|
|
472
|
+
let T = {};
|
|
473
|
+
for (const P in O) {
|
|
474
|
+
if (!ae(T) && !t)
|
|
475
|
+
break;
|
|
476
|
+
const L = er(await O[P](y, r), V, P);
|
|
477
|
+
L && (T = {
|
|
478
|
+
...L,
|
|
479
|
+
...Y(P, L.message)
|
|
480
|
+
}, z(L.message), t && (x[D] = T));
|
|
481
|
+
}
|
|
482
|
+
if (!ae(T) && (x[D] = {
|
|
483
|
+
ref: V,
|
|
484
|
+
...T
|
|
485
|
+
}, !t))
|
|
486
|
+
return x;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return z(!0), x;
|
|
490
|
+
}, bt = (e, r) => [
|
|
491
|
+
...e,
|
|
492
|
+
...fe(r)
|
|
493
|
+
], wt = (e) => Array.isArray(e) ? e.map(() => {
|
|
494
|
+
}) : void 0;
|
|
495
|
+
function Ct(e, r, t) {
|
|
496
|
+
return [
|
|
497
|
+
...e.slice(0, r),
|
|
498
|
+
...fe(t),
|
|
499
|
+
...e.slice(r)
|
|
500
|
+
];
|
|
501
|
+
}
|
|
502
|
+
var At = (e, r, t) => Array.isArray(e) ? (q(e[t]) && (e[t] = void 0), e.splice(t, 0, e.splice(r, 1)[0]), e) : [], Vt = (e, r) => [
|
|
503
|
+
...fe(r),
|
|
504
|
+
...fe(e)
|
|
505
|
+
];
|
|
506
|
+
function Ks(e, r) {
|
|
507
|
+
let t = 0;
|
|
508
|
+
const s = [...e];
|
|
509
|
+
for (const n of r)
|
|
510
|
+
s.splice(n - t, 1), t++;
|
|
511
|
+
return Je(s).length ? s : [];
|
|
512
|
+
}
|
|
513
|
+
var Ft = (e, r) => q(r) ? [] : Ks(e, fe(r).sort((t, s) => t - s)), Et = (e, r, t) => {
|
|
514
|
+
[e[r], e[t]] = [e[t], e[r]];
|
|
515
|
+
};
|
|
516
|
+
function $s(e, r) {
|
|
517
|
+
const t = r.slice(0, -1).length;
|
|
518
|
+
let s = 0;
|
|
519
|
+
for (; s < t; )
|
|
520
|
+
e = q(e) ? s++ : e[r[s++]];
|
|
521
|
+
return e;
|
|
522
|
+
}
|
|
523
|
+
function qs(e) {
|
|
524
|
+
for (const r in e)
|
|
525
|
+
if (e.hasOwnProperty(r) && !q(e[r]))
|
|
526
|
+
return !1;
|
|
527
|
+
return !0;
|
|
528
|
+
}
|
|
529
|
+
function J(e, r) {
|
|
530
|
+
const t = Array.isArray(r) ? r : Ht(r) ? [r] : pr(r), s = t.length === 1 ? e : $s(e, t), n = t.length - 1, i = t[n];
|
|
531
|
+
return s && delete s[i], n !== 0 && (ee(s) && ae(s) || Array.isArray(s) && qs(s)) && J(e, t.slice(0, -1)), e;
|
|
532
|
+
}
|
|
533
|
+
var tr = (e, r, t) => (e[r] = t, e);
|
|
534
|
+
function $o(e) {
|
|
535
|
+
const r = pt(), { control: t = r.control, name: s, keyName: n = "id", shouldUnregister: i } = e, [l, c] = I.useState(t._getFieldArray(s)), d = I.useRef(t._getFieldArray(s).map(Te)), _ = I.useRef(l), m = I.useRef(s), g = I.useRef(!1);
|
|
536
|
+
m.current = s, _.current = l, t._names.array.add(s), e.rules && t.register(s, e.rules), ht({
|
|
537
|
+
next: ({ values: x, name: w }) => {
|
|
538
|
+
if (w === m.current || !w) {
|
|
539
|
+
const F = h(x, m.current);
|
|
540
|
+
Array.isArray(F) && (c(F), d.current = F.map(Te));
|
|
541
|
+
}
|
|
542
|
+
},
|
|
543
|
+
subject: t._subjects.array
|
|
544
|
+
});
|
|
545
|
+
const E = I.useCallback((x) => {
|
|
546
|
+
g.current = !0, t._updateFieldArray(s, x);
|
|
547
|
+
}, [t, s]), O = (x, w) => {
|
|
548
|
+
const F = fe(te(x)), k = bt(t._getFieldArray(s), F);
|
|
549
|
+
t._names.focus = St(s, k.length - 1, w), d.current = bt(d.current, F.map(Te)), E(k), c(k), t._updateFieldArray(s, k, bt, {
|
|
550
|
+
argA: wt(x)
|
|
551
|
+
});
|
|
552
|
+
}, D = (x, w) => {
|
|
553
|
+
const F = fe(te(x)), k = Vt(t._getFieldArray(s), F);
|
|
554
|
+
t._names.focus = St(s, 0, w), d.current = Vt(d.current, F.map(Te)), E(k), c(k), t._updateFieldArray(s, k, Vt, {
|
|
555
|
+
argA: wt(x)
|
|
556
|
+
});
|
|
557
|
+
}, C = (x) => {
|
|
558
|
+
const w = Ft(t._getFieldArray(s), x);
|
|
559
|
+
d.current = Ft(d.current, x), E(w), c(w), t._updateFieldArray(s, w, Ft, {
|
|
560
|
+
argA: x
|
|
561
|
+
});
|
|
562
|
+
}, R = (x, w, F) => {
|
|
563
|
+
const k = fe(te(w)), Q = Ct(t._getFieldArray(s), x, k);
|
|
564
|
+
t._names.focus = St(s, x, F), d.current = Ct(d.current, x, k.map(Te)), E(Q), c(Q), t._updateFieldArray(s, Q, Ct, {
|
|
565
|
+
argA: x,
|
|
566
|
+
argB: wt(w)
|
|
567
|
+
});
|
|
568
|
+
}, M = (x, w) => {
|
|
569
|
+
const F = t._getFieldArray(s);
|
|
570
|
+
Et(F, x, w), Et(d.current, x, w), E(F), c(F), t._updateFieldArray(s, F, Et, {
|
|
571
|
+
argA: x,
|
|
572
|
+
argB: w
|
|
573
|
+
}, !1);
|
|
574
|
+
}, y = (x, w) => {
|
|
575
|
+
const F = t._getFieldArray(s);
|
|
576
|
+
At(F, x, w), At(d.current, x, w), E(F), c(F), t._updateFieldArray(s, F, At, {
|
|
577
|
+
argA: x,
|
|
578
|
+
argB: w
|
|
579
|
+
}, !1);
|
|
580
|
+
}, V = (x, w) => {
|
|
581
|
+
const F = te(w), k = tr(t._getFieldArray(s), x, F);
|
|
582
|
+
d.current = [...k].map((Q, Y) => !Q || Y === x ? Te() : d.current[Y]), E(k), c([...k]), t._updateFieldArray(s, k, tr, {
|
|
583
|
+
argA: x,
|
|
584
|
+
argB: F
|
|
585
|
+
}, !0, !1);
|
|
586
|
+
}, z = (x) => {
|
|
587
|
+
const w = fe(te(x));
|
|
588
|
+
d.current = w.map(Te), E([...w]), c([...w]), t._updateFieldArray(s, [...w], (F) => F, {}, !0, !1);
|
|
589
|
+
};
|
|
590
|
+
return I.useEffect(() => {
|
|
591
|
+
if (t._state.action = !1, Dt(s, t._names) && t._subjects.state.next({
|
|
592
|
+
...t._formState
|
|
593
|
+
}), g.current && (!Ze(t._options.mode).isOnSubmit || t._formState.isSubmitted))
|
|
594
|
+
if (t._options.resolver)
|
|
595
|
+
t._executeSchema([s]).then((x) => {
|
|
596
|
+
const w = h(x.errors, s), F = h(t._formState.errors, s);
|
|
597
|
+
(F ? !w && F.type || w && (F.type !== w.type || F.message !== w.message) : w && w.type) && (w ? U(t._formState.errors, s, w) : J(t._formState.errors, s), t._subjects.state.next({
|
|
598
|
+
errors: t._formState.errors
|
|
599
|
+
}));
|
|
600
|
+
});
|
|
601
|
+
else {
|
|
602
|
+
const x = h(t._fields, s);
|
|
603
|
+
x && x._f && !(Ze(t._options.reValidateMode).isOnSubmit && Ze(t._options.mode).isOnSubmit) && Pt(x, t._formValues, t._options.criteriaMode === he.all, t._options.shouldUseNativeValidation, !0).then((w) => !ae(w) && t._subjects.state.next({
|
|
604
|
+
errors: xr(t._formState.errors, w, s)
|
|
605
|
+
}));
|
|
606
|
+
}
|
|
607
|
+
t._subjects.values.next({
|
|
608
|
+
name: s,
|
|
609
|
+
values: { ...t._formValues }
|
|
610
|
+
}), t._names.focus && qe(t._fields, (x, w) => {
|
|
611
|
+
if (t._names.focus && w.startsWith(t._names.focus) && x.focus)
|
|
612
|
+
return x.focus(), 1;
|
|
613
|
+
}), t._names.focus = "", t._updateValid(), g.current = !1;
|
|
614
|
+
}, [l, s, t]), I.useEffect(() => (!h(t._formValues, s) && t._updateFieldArray(s), () => {
|
|
615
|
+
(t._options.shouldUnregister || i) && t.unregister(s);
|
|
616
|
+
}), [s, t, n, i]), {
|
|
617
|
+
swap: I.useCallback(M, [E, s, t]),
|
|
618
|
+
move: I.useCallback(y, [E, s, t]),
|
|
619
|
+
prepend: I.useCallback(D, [E, s, t]),
|
|
620
|
+
append: I.useCallback(O, [E, s, t]),
|
|
621
|
+
remove: I.useCallback(C, [E, s, t]),
|
|
622
|
+
insert: I.useCallback(R, [E, s, t]),
|
|
623
|
+
update: I.useCallback(V, [E, s, t]),
|
|
624
|
+
replace: I.useCallback(z, [E, s, t]),
|
|
625
|
+
fields: I.useMemo(() => l.map((x, w) => ({
|
|
626
|
+
...x,
|
|
627
|
+
[n]: d.current[w] || Te()
|
|
628
|
+
})), [l, n])
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
var Tt = () => {
|
|
632
|
+
let e = [];
|
|
633
|
+
return {
|
|
634
|
+
get observers() {
|
|
635
|
+
return e;
|
|
636
|
+
},
|
|
637
|
+
next: (n) => {
|
|
638
|
+
for (const i of e)
|
|
639
|
+
i.next && i.next(n);
|
|
640
|
+
},
|
|
641
|
+
subscribe: (n) => (e.push(n), {
|
|
642
|
+
unsubscribe: () => {
|
|
643
|
+
e = e.filter((i) => i !== n);
|
|
644
|
+
}
|
|
645
|
+
}),
|
|
646
|
+
unsubscribe: () => {
|
|
647
|
+
e = [];
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
}, ut = (e) => le(e) || !ur(e);
|
|
651
|
+
function Ie(e, r) {
|
|
652
|
+
if (ut(e) || ut(r))
|
|
653
|
+
return e === r;
|
|
654
|
+
if ($e(e) && $e(r))
|
|
655
|
+
return e.getTime() === r.getTime();
|
|
656
|
+
const t = Object.keys(e), s = Object.keys(r);
|
|
657
|
+
if (t.length !== s.length)
|
|
658
|
+
return !1;
|
|
659
|
+
for (const n of t) {
|
|
660
|
+
const i = e[n];
|
|
661
|
+
if (!s.includes(n))
|
|
662
|
+
return !1;
|
|
663
|
+
if (n !== "ref") {
|
|
664
|
+
const l = r[n];
|
|
665
|
+
if ($e(i) && $e(l) || ee(i) && ee(l) || Array.isArray(i) && Array.isArray(l) ? !Ie(i, l) : i !== l)
|
|
666
|
+
return !1;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
return !0;
|
|
670
|
+
}
|
|
671
|
+
var br = (e) => e.type === "select-multiple", Gs = (e) => Kt(e) || Qe(e), It = (e) => lt(e) && e.isConnected, wr = (e) => {
|
|
672
|
+
for (const r in e)
|
|
673
|
+
if (Ve(e[r]))
|
|
674
|
+
return !0;
|
|
675
|
+
return !1;
|
|
676
|
+
};
|
|
677
|
+
function dt(e, r = {}) {
|
|
678
|
+
const t = Array.isArray(e);
|
|
679
|
+
if (ee(e) || t)
|
|
680
|
+
for (const s in e)
|
|
681
|
+
Array.isArray(e[s]) || ee(e[s]) && !wr(e[s]) ? (r[s] = Array.isArray(e[s]) ? [] : {}, dt(e[s], r[s])) : le(e[s]) || (r[s] = !0);
|
|
682
|
+
return r;
|
|
683
|
+
}
|
|
684
|
+
function Cr(e, r, t) {
|
|
685
|
+
const s = Array.isArray(e);
|
|
686
|
+
if (ee(e) || s)
|
|
687
|
+
for (const n in e)
|
|
688
|
+
Array.isArray(e[n]) || ee(e[n]) && !wr(e[n]) ? q(r) || ut(t[n]) ? t[n] = Array.isArray(e[n]) ? dt(e[n], []) : { ...dt(e[n]) } : Cr(e[n], le(r) ? {} : r[n], t[n]) : t[n] = !Ie(e[n], r[n]);
|
|
689
|
+
return t;
|
|
690
|
+
}
|
|
691
|
+
var ot = (e, r) => Cr(e, r, dt(r)), Ar = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: s }) => q(e) ? e : r ? e === "" ? NaN : e && +e : t && xe(e) ? new Date(e) : s ? s(e) : e;
|
|
692
|
+
function Rt(e) {
|
|
693
|
+
const r = e.ref;
|
|
694
|
+
if (!(e.refs ? e.refs.every((t) => t.disabled) : r.disabled))
|
|
695
|
+
return Wt(r) ? r.files : Kt(r) ? Sr(e.refs).value : br(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Qe(r) ? _r(e.refs).value : Ar(q(r.value) ? e.ref.value : r.value, e);
|
|
696
|
+
}
|
|
697
|
+
var zs = (e, r, t, s) => {
|
|
698
|
+
const n = {};
|
|
699
|
+
for (const i of e) {
|
|
700
|
+
const l = h(r, i);
|
|
701
|
+
l && U(n, i, l._f);
|
|
702
|
+
}
|
|
703
|
+
return {
|
|
704
|
+
criteriaMode: t,
|
|
705
|
+
names: [...e],
|
|
706
|
+
fields: n,
|
|
707
|
+
shouldUseNativeValidation: s
|
|
708
|
+
};
|
|
709
|
+
}, Ye = (e) => q(e) ? e : ct(e) ? e.source : ee(e) ? ct(e.value) ? e.value.source : e.value : e;
|
|
710
|
+
const rr = "AsyncFunction";
|
|
711
|
+
var Ys = (e) => (!e || !e.validate) && !!(Ve(e.validate) && e.validate.constructor.name === rr || ee(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === rr)), Xs = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
|
|
712
|
+
function sr(e, r, t) {
|
|
713
|
+
const s = h(e, t);
|
|
714
|
+
if (s || Ht(t))
|
|
715
|
+
return {
|
|
716
|
+
error: s,
|
|
717
|
+
name: t
|
|
718
|
+
};
|
|
719
|
+
const n = t.split(".");
|
|
720
|
+
for (; n.length; ) {
|
|
721
|
+
const i = n.join("."), l = h(r, i), c = h(e, i);
|
|
722
|
+
if (l && !Array.isArray(l) && t !== i)
|
|
723
|
+
return { name: t };
|
|
724
|
+
if (c && c.type)
|
|
725
|
+
return {
|
|
726
|
+
name: i,
|
|
727
|
+
error: c
|
|
728
|
+
};
|
|
729
|
+
n.pop();
|
|
730
|
+
}
|
|
731
|
+
return {
|
|
732
|
+
name: t
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
var Zs = (e, r, t, s, n) => n.isOnAll ? !1 : !t && n.isOnTouch ? !(r || e) : (t ? s.isOnBlur : n.isOnBlur) ? !e : (t ? s.isOnChange : n.isOnChange) ? e : !0, Qs = (e, r) => !Je(h(e, r)).length && J(e, r);
|
|
736
|
+
const Js = {
|
|
737
|
+
mode: he.onSubmit,
|
|
738
|
+
reValidateMode: he.onChange,
|
|
739
|
+
shouldFocusError: !0
|
|
740
|
+
};
|
|
741
|
+
function eo(e = {}) {
|
|
742
|
+
let r = {
|
|
743
|
+
...Js,
|
|
744
|
+
...e
|
|
745
|
+
}, t = {
|
|
746
|
+
submitCount: 0,
|
|
747
|
+
isDirty: !1,
|
|
748
|
+
isLoading: Ve(r.defaultValues),
|
|
749
|
+
isValidating: !1,
|
|
750
|
+
isSubmitted: !1,
|
|
751
|
+
isSubmitting: !1,
|
|
752
|
+
isSubmitSuccessful: !1,
|
|
753
|
+
isValid: !1,
|
|
754
|
+
touchedFields: {},
|
|
755
|
+
dirtyFields: {},
|
|
756
|
+
validatingFields: {},
|
|
757
|
+
errors: r.errors || {},
|
|
758
|
+
disabled: r.disabled || !1
|
|
759
|
+
}, s = {}, n = ee(r.defaultValues) || ee(r.values) ? te(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : te(n), l = {
|
|
760
|
+
action: !1,
|
|
761
|
+
mount: !1,
|
|
762
|
+
watch: !1
|
|
763
|
+
}, c = {
|
|
764
|
+
mount: /* @__PURE__ */ new Set(),
|
|
765
|
+
unMount: /* @__PURE__ */ new Set(),
|
|
766
|
+
array: /* @__PURE__ */ new Set(),
|
|
767
|
+
watch: /* @__PURE__ */ new Set()
|
|
768
|
+
}, d, _ = 0;
|
|
769
|
+
const m = {
|
|
770
|
+
isDirty: !1,
|
|
771
|
+
dirtyFields: !1,
|
|
772
|
+
validatingFields: !1,
|
|
773
|
+
touchedFields: !1,
|
|
774
|
+
isValidating: !1,
|
|
775
|
+
isValid: !1,
|
|
776
|
+
errors: !1
|
|
777
|
+
}, g = {
|
|
778
|
+
values: Tt(),
|
|
779
|
+
array: Tt(),
|
|
780
|
+
state: Tt()
|
|
781
|
+
}, E = Ze(r.mode), O = Ze(r.reValidateMode), D = r.criteriaMode === he.all, C = (o) => (a) => {
|
|
782
|
+
clearTimeout(_), _ = setTimeout(o, a);
|
|
783
|
+
}, R = async (o) => {
|
|
784
|
+
if (m.isValid || o) {
|
|
785
|
+
const a = r.resolver ? ae((await k()).errors) : await Y(s, !0);
|
|
786
|
+
a !== t.isValid && g.state.next({
|
|
787
|
+
isValid: a
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
}, M = (o, a) => {
|
|
791
|
+
(m.isValidating || m.validatingFields) && ((o || Array.from(c.mount)).forEach((u) => {
|
|
792
|
+
u && (a ? U(t.validatingFields, u, a) : J(t.validatingFields, u));
|
|
793
|
+
}), g.state.next({
|
|
794
|
+
validatingFields: t.validatingFields,
|
|
795
|
+
isValidating: !ae(t.validatingFields)
|
|
796
|
+
}));
|
|
797
|
+
}, y = (o, a = [], u, S, v = !0, f = !0) => {
|
|
798
|
+
if (S && u) {
|
|
799
|
+
if (l.action = !0, f && Array.isArray(h(s, o))) {
|
|
800
|
+
const A = u(h(s, o), S.argA, S.argB);
|
|
801
|
+
v && U(s, o, A);
|
|
802
|
+
}
|
|
803
|
+
if (f && Array.isArray(h(t.errors, o))) {
|
|
804
|
+
const A = u(h(t.errors, o), S.argA, S.argB);
|
|
805
|
+
v && U(t.errors, o, A), Qs(t.errors, o);
|
|
806
|
+
}
|
|
807
|
+
if (m.touchedFields && f && Array.isArray(h(t.touchedFields, o))) {
|
|
808
|
+
const A = u(h(t.touchedFields, o), S.argA, S.argB);
|
|
809
|
+
v && U(t.touchedFields, o, A);
|
|
810
|
+
}
|
|
811
|
+
m.dirtyFields && (t.dirtyFields = ot(n, i)), g.state.next({
|
|
812
|
+
name: o,
|
|
813
|
+
isDirty: T(o, a),
|
|
814
|
+
dirtyFields: t.dirtyFields,
|
|
815
|
+
errors: t.errors,
|
|
816
|
+
isValid: t.isValid
|
|
817
|
+
});
|
|
818
|
+
} else
|
|
819
|
+
U(i, o, a);
|
|
820
|
+
}, V = (o, a) => {
|
|
821
|
+
U(t.errors, o, a), g.state.next({
|
|
822
|
+
errors: t.errors
|
|
823
|
+
});
|
|
824
|
+
}, z = (o) => {
|
|
825
|
+
t.errors = o, g.state.next({
|
|
826
|
+
errors: t.errors,
|
|
827
|
+
isValid: !1
|
|
828
|
+
});
|
|
829
|
+
}, x = (o, a, u, S) => {
|
|
830
|
+
const v = h(s, o);
|
|
831
|
+
if (v) {
|
|
832
|
+
const f = h(i, o, q(u) ? h(n, o) : u);
|
|
833
|
+
q(f) || S && S.defaultChecked || a ? U(i, o, a ? f : Rt(v._f)) : W(o, f), l.mount && R();
|
|
834
|
+
}
|
|
835
|
+
}, w = (o, a, u, S, v) => {
|
|
836
|
+
let f = !1, A = !1;
|
|
837
|
+
const j = {
|
|
838
|
+
name: o
|
|
839
|
+
}, re = !!(h(s, o) && h(s, o)._f && h(s, o)._f.disabled);
|
|
840
|
+
if (!u || S) {
|
|
841
|
+
m.isDirty && (A = t.isDirty, t.isDirty = j.isDirty = T(), f = A !== j.isDirty);
|
|
842
|
+
const se = re || Ie(h(n, o), a);
|
|
843
|
+
A = !!(!re && h(t.dirtyFields, o)), se || re ? J(t.dirtyFields, o) : U(t.dirtyFields, o, !0), j.dirtyFields = t.dirtyFields, f = f || m.dirtyFields && A !== !se;
|
|
844
|
+
}
|
|
845
|
+
if (u) {
|
|
846
|
+
const se = h(t.touchedFields, o);
|
|
847
|
+
se || (U(t.touchedFields, o, u), j.touchedFields = t.touchedFields, f = f || m.touchedFields && se !== u);
|
|
848
|
+
}
|
|
849
|
+
return f && v && g.state.next(j), f ? j : {};
|
|
850
|
+
}, F = (o, a, u, S) => {
|
|
851
|
+
const v = h(t.errors, o), f = m.isValid && pe(a) && t.isValid !== a;
|
|
852
|
+
if (e.delayError && u ? (d = C(() => V(o, u)), d(e.delayError)) : (clearTimeout(_), d = null, u ? U(t.errors, o, u) : J(t.errors, o)), (u ? !Ie(v, u) : v) || !ae(S) || f) {
|
|
853
|
+
const A = {
|
|
854
|
+
...S,
|
|
855
|
+
...f && pe(a) ? { isValid: a } : {},
|
|
856
|
+
errors: t.errors,
|
|
857
|
+
name: o
|
|
858
|
+
};
|
|
859
|
+
t = {
|
|
860
|
+
...t,
|
|
861
|
+
...A
|
|
862
|
+
}, g.state.next(A);
|
|
863
|
+
}
|
|
864
|
+
}, k = async (o) => {
|
|
865
|
+
M(o, !0);
|
|
866
|
+
const a = await r.resolver(i, r.context, zs(o || c.mount, s, r.criteriaMode, r.shouldUseNativeValidation));
|
|
867
|
+
return M(o), a;
|
|
868
|
+
}, Q = async (o) => {
|
|
869
|
+
const { errors: a } = await k(o);
|
|
870
|
+
if (o)
|
|
871
|
+
for (const u of o) {
|
|
872
|
+
const S = h(a, u);
|
|
873
|
+
S ? U(t.errors, u, S) : J(t.errors, u);
|
|
874
|
+
}
|
|
875
|
+
else
|
|
876
|
+
t.errors = a;
|
|
877
|
+
return a;
|
|
878
|
+
}, Y = async (o, a, u = {
|
|
879
|
+
valid: !0
|
|
880
|
+
}) => {
|
|
881
|
+
for (const S in o) {
|
|
882
|
+
const v = o[S];
|
|
883
|
+
if (v) {
|
|
884
|
+
const { _f: f, ...A } = v;
|
|
885
|
+
if (f) {
|
|
886
|
+
const j = c.array.has(f.name), re = v._f && Ys(v._f);
|
|
887
|
+
re && m.validatingFields && M([S], !0);
|
|
888
|
+
const se = await Pt(v, i, D, r.shouldUseNativeValidation && !a, j);
|
|
889
|
+
if (re && m.validatingFields && M([S]), se[f.name] && (u.valid = !1, a))
|
|
890
|
+
break;
|
|
891
|
+
!a && (h(se, f.name) ? j ? xr(t.errors, se, f.name) : U(t.errors, f.name, se[f.name]) : J(t.errors, f.name));
|
|
892
|
+
}
|
|
893
|
+
!ae(A) && await Y(A, a, u);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
return u.valid;
|
|
897
|
+
}, ce = () => {
|
|
898
|
+
for (const o of c.unMount) {
|
|
899
|
+
const a = h(s, o);
|
|
900
|
+
a && (a._f.refs ? a._f.refs.every((u) => !It(u)) : !It(a._f.ref)) && we(o);
|
|
901
|
+
}
|
|
902
|
+
c.unMount = /* @__PURE__ */ new Set();
|
|
903
|
+
}, T = (o, a) => (o && a && U(i, o, a), !Ie(Me(), n)), P = (o, a, u) => vr(o, c, {
|
|
904
|
+
...l.mount ? i : q(a) ? n : xe(o) ? { [o]: a } : a
|
|
905
|
+
}, u, a), L = (o) => Je(h(l.mount ? i : n, o, e.shouldUnregister ? h(n, o, []) : [])), W = (o, a, u = {}) => {
|
|
906
|
+
const S = h(s, o);
|
|
907
|
+
let v = a;
|
|
908
|
+
if (S) {
|
|
909
|
+
const f = S._f;
|
|
910
|
+
f && (!f.disabled && U(i, o, Ar(a, f)), v = lt(f.ref) && le(a) ? "" : a, br(f.ref) ? [...f.ref.options].forEach((A) => A.selected = v.includes(A.value)) : f.refs ? Qe(f.ref) ? f.refs.length > 1 ? f.refs.forEach((A) => (!A.defaultChecked || !A.disabled) && (A.checked = Array.isArray(v) ? !!v.find((j) => j === A.value) : v === A.value)) : f.refs[0] && (f.refs[0].checked = !!v) : f.refs.forEach((A) => A.checked = A.value === v) : Wt(f.ref) ? f.ref.value = "" : (f.ref.value = v, f.ref.type || g.values.next({
|
|
911
|
+
name: o,
|
|
912
|
+
values: { ...i }
|
|
913
|
+
})));
|
|
914
|
+
}
|
|
915
|
+
(u.shouldDirty || u.shouldTouch) && w(o, v, u.shouldTouch, u.shouldDirty, !0), u.shouldValidate && Se(o);
|
|
916
|
+
}, K = (o, a, u) => {
|
|
917
|
+
for (const S in a) {
|
|
918
|
+
const v = a[S], f = `${o}.${S}`, A = h(s, f);
|
|
919
|
+
(c.array.has(o) || !ut(v) || A && !A._f) && !$e(v) ? K(f, v, u) : W(f, v, u);
|
|
920
|
+
}
|
|
921
|
+
}, X = (o, a, u = {}) => {
|
|
922
|
+
const S = h(s, o), v = c.array.has(o), f = te(a);
|
|
923
|
+
U(i, o, f), v ? (g.array.next({
|
|
924
|
+
name: o,
|
|
925
|
+
values: { ...i }
|
|
926
|
+
}), (m.isDirty || m.dirtyFields) && u.shouldDirty && g.state.next({
|
|
927
|
+
name: o,
|
|
928
|
+
dirtyFields: ot(n, i),
|
|
929
|
+
isDirty: T(o, f)
|
|
930
|
+
})) : S && !S._f && !le(f) ? K(o, f, u) : W(o, f, u), Dt(o, c) && g.state.next({ ...t }), g.values.next({
|
|
931
|
+
name: l.mount ? o : void 0,
|
|
932
|
+
values: { ...i }
|
|
933
|
+
});
|
|
934
|
+
}, ie = async (o) => {
|
|
935
|
+
l.mount = !0;
|
|
936
|
+
const a = o.target;
|
|
937
|
+
let u = a.name, S = !0;
|
|
938
|
+
const v = h(s, u), f = () => a.type ? Rt(v._f) : dr(o), A = (j) => {
|
|
939
|
+
S = Number.isNaN(j) || Ie(j, h(i, u, j));
|
|
940
|
+
};
|
|
941
|
+
if (v) {
|
|
942
|
+
let j, re;
|
|
943
|
+
const se = f(), Oe = o.type === at.BLUR || o.type === at.FOCUS_OUT, us = !Xs(v._f) && !r.resolver && !h(t.errors, u) && !v._f.deps || Zs(Oe, h(t.touchedFields, u), t.isSubmitted, O, E), vt = Dt(u, c, Oe);
|
|
944
|
+
U(i, u, se), Oe ? (v._f.onBlur && v._f.onBlur(o), d && d(0)) : v._f.onChange && v._f.onChange(o);
|
|
945
|
+
const xt = w(u, se, Oe, !1), ds = !ae(xt) || vt;
|
|
946
|
+
if (!Oe && g.values.next({
|
|
947
|
+
name: u,
|
|
948
|
+
type: o.type,
|
|
949
|
+
values: { ...i }
|
|
950
|
+
}), us)
|
|
951
|
+
return m.isValid && (e.mode === "onBlur" ? Oe && R() : R()), ds && g.state.next({ name: u, ...vt ? {} : xt });
|
|
952
|
+
if (!Oe && vt && g.state.next({ ...t }), r.resolver) {
|
|
953
|
+
const { errors: qt } = await k([u]);
|
|
954
|
+
if (A(se), S) {
|
|
955
|
+
const fs = sr(t.errors, s, u), Gt = sr(qt, s, fs.name || u);
|
|
956
|
+
j = Gt.error, u = Gt.name, re = ae(qt);
|
|
957
|
+
}
|
|
958
|
+
} else
|
|
959
|
+
M([u], !0), j = (await Pt(v, i, D, r.shouldUseNativeValidation))[u], M([u]), A(se), S && (j ? re = !1 : m.isValid && (re = await Y(s, !0)));
|
|
960
|
+
S && (v._f.deps && Se(v._f.deps), F(u, re, j, xt));
|
|
961
|
+
}
|
|
962
|
+
}, ue = (o, a) => {
|
|
963
|
+
if (h(t.errors, a) && o.focus)
|
|
964
|
+
return o.focus(), 1;
|
|
965
|
+
}, Se = async (o, a = {}) => {
|
|
966
|
+
let u, S;
|
|
967
|
+
const v = fe(o);
|
|
968
|
+
if (r.resolver) {
|
|
969
|
+
const f = await Q(q(o) ? o : v);
|
|
970
|
+
u = ae(f), S = o ? !v.some((A) => h(f, A)) : u;
|
|
971
|
+
} else o ? (S = (await Promise.all(v.map(async (f) => {
|
|
972
|
+
const A = h(s, f);
|
|
973
|
+
return await Y(A && A._f ? { [f]: A } : A);
|
|
974
|
+
}))).every(Boolean), !(!S && !t.isValid) && R()) : S = u = await Y(s);
|
|
975
|
+
return g.state.next({
|
|
976
|
+
...!xe(o) || m.isValid && u !== t.isValid ? {} : { name: o },
|
|
977
|
+
...r.resolver || !o ? { isValid: u } : {},
|
|
978
|
+
errors: t.errors
|
|
979
|
+
}), a.shouldFocus && !S && qe(s, ue, o ? v : c.mount), S;
|
|
980
|
+
}, Me = (o) => {
|
|
981
|
+
const a = {
|
|
982
|
+
...l.mount ? i : n
|
|
983
|
+
};
|
|
984
|
+
return q(o) ? a : xe(o) ? h(a, o) : o.map((u) => h(a, u));
|
|
985
|
+
}, Le = (o, a) => ({
|
|
986
|
+
invalid: !!h((a || t).errors, o),
|
|
987
|
+
isDirty: !!h((a || t).dirtyFields, o),
|
|
988
|
+
error: h((a || t).errors, o),
|
|
989
|
+
isValidating: !!h(t.validatingFields, o),
|
|
990
|
+
isTouched: !!h((a || t).touchedFields, o)
|
|
991
|
+
}), ze = (o) => {
|
|
992
|
+
o && fe(o).forEach((a) => J(t.errors, a)), g.state.next({
|
|
993
|
+
errors: o ? t.errors : {}
|
|
994
|
+
});
|
|
995
|
+
}, be = (o, a, u) => {
|
|
996
|
+
const S = (h(s, o, { _f: {} })._f || {}).ref, v = h(t.errors, o) || {}, { ref: f, message: A, type: j, ...re } = v;
|
|
997
|
+
U(t.errors, o, {
|
|
998
|
+
...re,
|
|
999
|
+
...a,
|
|
1000
|
+
ref: S
|
|
1001
|
+
}), g.state.next({
|
|
1002
|
+
name: o,
|
|
1003
|
+
errors: t.errors,
|
|
1004
|
+
isValid: !1
|
|
1005
|
+
}), u && u.shouldFocus && S && S.focus && S.focus();
|
|
1006
|
+
}, Be = (o, a) => Ve(o) ? g.values.subscribe({
|
|
1007
|
+
next: (u) => o(P(void 0, a), u)
|
|
1008
|
+
}) : P(o, a, !0), we = (o, a = {}) => {
|
|
1009
|
+
for (const u of o ? fe(o) : c.mount)
|
|
1010
|
+
c.mount.delete(u), c.array.delete(u), a.keepValue || (J(s, u), J(i, u)), !a.keepError && J(t.errors, u), !a.keepDirty && J(t.dirtyFields, u), !a.keepTouched && J(t.touchedFields, u), !a.keepIsValidating && J(t.validatingFields, u), !r.shouldUnregister && !a.keepDefaultValue && J(n, u);
|
|
1011
|
+
g.values.next({
|
|
1012
|
+
values: { ...i }
|
|
1013
|
+
}), g.state.next({
|
|
1014
|
+
...t,
|
|
1015
|
+
...a.keepDirty ? { isDirty: T() } : {}
|
|
1016
|
+
}), !a.keepIsValid && R();
|
|
1017
|
+
}, N = ({ disabled: o, name: a, field: u, fields: S, value: v }) => {
|
|
1018
|
+
if (pe(o) && l.mount || o) {
|
|
1019
|
+
const f = o ? void 0 : q(v) ? Rt(u ? u._f : h(S, a)._f) : v;
|
|
1020
|
+
U(i, a, f), w(a, f, !1, !1, !0);
|
|
1021
|
+
}
|
|
1022
|
+
}, $ = (o, a = {}) => {
|
|
1023
|
+
let u = h(s, o);
|
|
1024
|
+
const S = pe(a.disabled) || pe(e.disabled);
|
|
1025
|
+
return U(s, o, {
|
|
1026
|
+
...u || {},
|
|
1027
|
+
_f: {
|
|
1028
|
+
...u && u._f ? u._f : { ref: { name: o } },
|
|
1029
|
+
name: o,
|
|
1030
|
+
mount: !0,
|
|
1031
|
+
...a
|
|
1032
|
+
}
|
|
1033
|
+
}), c.mount.add(o), u ? N({
|
|
1034
|
+
field: u,
|
|
1035
|
+
disabled: pe(a.disabled) ? a.disabled : e.disabled,
|
|
1036
|
+
name: o,
|
|
1037
|
+
value: a.value
|
|
1038
|
+
}) : x(o, !0, a.value), {
|
|
1039
|
+
...S ? { disabled: a.disabled || e.disabled } : {},
|
|
1040
|
+
...r.progressive ? {
|
|
1041
|
+
required: !!a.required,
|
|
1042
|
+
min: Ye(a.min),
|
|
1043
|
+
max: Ye(a.max),
|
|
1044
|
+
minLength: Ye(a.minLength),
|
|
1045
|
+
maxLength: Ye(a.maxLength),
|
|
1046
|
+
pattern: Ye(a.pattern)
|
|
1047
|
+
} : {},
|
|
1048
|
+
name: o,
|
|
1049
|
+
onChange: ie,
|
|
1050
|
+
onBlur: ie,
|
|
1051
|
+
ref: (v) => {
|
|
1052
|
+
if (v) {
|
|
1053
|
+
$(o, a), u = h(s, o);
|
|
1054
|
+
const f = q(v.value) && v.querySelectorAll && v.querySelectorAll("input,select,textarea")[0] || v, A = Gs(f), j = u._f.refs || [];
|
|
1055
|
+
if (A ? j.find((re) => re === f) : f === u._f.ref)
|
|
1056
|
+
return;
|
|
1057
|
+
U(s, o, {
|
|
1058
|
+
_f: {
|
|
1059
|
+
...u._f,
|
|
1060
|
+
...A ? {
|
|
1061
|
+
refs: [
|
|
1062
|
+
...j.filter(It),
|
|
1063
|
+
f,
|
|
1064
|
+
...Array.isArray(h(n, o)) ? [{}] : []
|
|
1065
|
+
],
|
|
1066
|
+
ref: { type: f.type, name: o }
|
|
1067
|
+
} : { ref: f }
|
|
1068
|
+
}
|
|
1069
|
+
}), x(o, !1, void 0, f);
|
|
1070
|
+
} else
|
|
1071
|
+
u = h(s, o, {}), u._f && (u._f.mount = !1), (r.shouldUnregister || a.shouldUnregister) && !(fr(c.array, o) && l.action) && c.unMount.add(o);
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
}, ne = () => r.shouldFocusError && qe(s, ue, c.mount), G = (o) => {
|
|
1075
|
+
pe(o) && (g.state.next({ disabled: o }), qe(s, (a, u) => {
|
|
1076
|
+
const S = h(s, u);
|
|
1077
|
+
S && (a.disabled = S._f.disabled || o, Array.isArray(S._f.refs) && S._f.refs.forEach((v) => {
|
|
1078
|
+
v.disabled = S._f.disabled || o;
|
|
1079
|
+
}));
|
|
1080
|
+
}, 0, !1));
|
|
1081
|
+
}, B = (o, a) => async (u) => {
|
|
1082
|
+
let S;
|
|
1083
|
+
u && (u.preventDefault && u.preventDefault(), u.persist && u.persist());
|
|
1084
|
+
let v = te(i);
|
|
1085
|
+
if (g.state.next({
|
|
1086
|
+
isSubmitting: !0
|
|
1087
|
+
}), r.resolver) {
|
|
1088
|
+
const { errors: f, values: A } = await k();
|
|
1089
|
+
t.errors = f, v = A;
|
|
1090
|
+
} else
|
|
1091
|
+
await Y(s);
|
|
1092
|
+
if (J(t.errors, "root"), ae(t.errors)) {
|
|
1093
|
+
g.state.next({
|
|
1094
|
+
errors: {}
|
|
1095
|
+
});
|
|
1096
|
+
try {
|
|
1097
|
+
await o(v, u);
|
|
1098
|
+
} catch (f) {
|
|
1099
|
+
S = f;
|
|
1100
|
+
}
|
|
1101
|
+
} else
|
|
1102
|
+
a && await a({ ...t.errors }, u), ne(), setTimeout(ne);
|
|
1103
|
+
if (g.state.next({
|
|
1104
|
+
isSubmitted: !0,
|
|
1105
|
+
isSubmitting: !1,
|
|
1106
|
+
isSubmitSuccessful: ae(t.errors) && !S,
|
|
1107
|
+
submitCount: t.submitCount + 1,
|
|
1108
|
+
errors: t.errors
|
|
1109
|
+
}), S)
|
|
1110
|
+
throw S;
|
|
1111
|
+
}, H = (o, a = {}) => {
|
|
1112
|
+
h(s, o) && (q(a.defaultValue) ? X(o, te(h(n, o))) : (X(o, a.defaultValue), U(n, o, te(a.defaultValue))), a.keepTouched || J(t.touchedFields, o), a.keepDirty || (J(t.dirtyFields, o), t.isDirty = a.defaultValue ? T(o, te(h(n, o))) : T()), a.keepError || (J(t.errors, o), m.isValid && R()), g.state.next({ ...t }));
|
|
1113
|
+
}, ge = (o, a = {}) => {
|
|
1114
|
+
const u = o ? te(o) : n, S = te(u), v = ae(o), f = v ? n : S;
|
|
1115
|
+
if (a.keepDefaultValues || (n = u), !a.keepValues) {
|
|
1116
|
+
if (a.keepDirtyValues)
|
|
1117
|
+
for (const A of c.mount)
|
|
1118
|
+
h(t.dirtyFields, A) ? U(f, A, h(i, A)) : X(A, h(f, A));
|
|
1119
|
+
else {
|
|
1120
|
+
if (Ut && q(o))
|
|
1121
|
+
for (const A of c.mount) {
|
|
1122
|
+
const j = h(s, A);
|
|
1123
|
+
if (j && j._f) {
|
|
1124
|
+
const re = Array.isArray(j._f.refs) ? j._f.refs[0] : j._f.ref;
|
|
1125
|
+
if (lt(re)) {
|
|
1126
|
+
const se = re.closest("form");
|
|
1127
|
+
if (se) {
|
|
1128
|
+
se.reset();
|
|
1129
|
+
break;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
s = {};
|
|
1135
|
+
}
|
|
1136
|
+
i = e.shouldUnregister ? a.keepDefaultValues ? te(n) : {} : te(f), g.array.next({
|
|
1137
|
+
values: { ...f }
|
|
1138
|
+
}), g.values.next({
|
|
1139
|
+
values: { ...f }
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
c = {
|
|
1143
|
+
mount: a.keepDirtyValues ? c.mount : /* @__PURE__ */ new Set(),
|
|
1144
|
+
unMount: /* @__PURE__ */ new Set(),
|
|
1145
|
+
array: /* @__PURE__ */ new Set(),
|
|
1146
|
+
watch: /* @__PURE__ */ new Set(),
|
|
1147
|
+
watchAll: !1,
|
|
1148
|
+
focus: ""
|
|
1149
|
+
}, l.mount = !m.isValid || !!a.keepIsValid || !!a.keepDirtyValues, l.watch = !!e.shouldUnregister, g.state.next({
|
|
1150
|
+
submitCount: a.keepSubmitCount ? t.submitCount : 0,
|
|
1151
|
+
isDirty: v ? !1 : a.keepDirty ? t.isDirty : !!(a.keepDefaultValues && !Ie(o, n)),
|
|
1152
|
+
isSubmitted: a.keepIsSubmitted ? t.isSubmitted : !1,
|
|
1153
|
+
dirtyFields: v ? {} : a.keepDirtyValues ? a.keepDefaultValues && i ? ot(n, i) : t.dirtyFields : a.keepDefaultValues && o ? ot(n, o) : a.keepDirty ? t.dirtyFields : {},
|
|
1154
|
+
touchedFields: a.keepTouched ? t.touchedFields : {},
|
|
1155
|
+
errors: a.keepErrors ? t.errors : {},
|
|
1156
|
+
isSubmitSuccessful: a.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
1157
|
+
isSubmitting: !1
|
|
1158
|
+
});
|
|
1159
|
+
}, ve = (o, a) => ge(Ve(o) ? o(i) : o, a);
|
|
1160
|
+
return {
|
|
1161
|
+
control: {
|
|
1162
|
+
register: $,
|
|
1163
|
+
unregister: we,
|
|
1164
|
+
getFieldState: Le,
|
|
1165
|
+
handleSubmit: B,
|
|
1166
|
+
setError: be,
|
|
1167
|
+
_executeSchema: k,
|
|
1168
|
+
_getWatch: P,
|
|
1169
|
+
_getDirty: T,
|
|
1170
|
+
_updateValid: R,
|
|
1171
|
+
_removeUnmounted: ce,
|
|
1172
|
+
_updateFieldArray: y,
|
|
1173
|
+
_updateDisabledField: N,
|
|
1174
|
+
_getFieldArray: L,
|
|
1175
|
+
_reset: ge,
|
|
1176
|
+
_resetDefaultValues: () => Ve(r.defaultValues) && r.defaultValues().then((o) => {
|
|
1177
|
+
ve(o, r.resetOptions), g.state.next({
|
|
1178
|
+
isLoading: !1
|
|
1179
|
+
});
|
|
1180
|
+
}),
|
|
1181
|
+
_updateFormState: (o) => {
|
|
1182
|
+
t = {
|
|
1183
|
+
...t,
|
|
1184
|
+
...o
|
|
1185
|
+
};
|
|
1186
|
+
},
|
|
1187
|
+
_disableForm: G,
|
|
1188
|
+
_subjects: g,
|
|
1189
|
+
_proxyFormState: m,
|
|
1190
|
+
_setErrors: z,
|
|
1191
|
+
get _fields() {
|
|
1192
|
+
return s;
|
|
1193
|
+
},
|
|
1194
|
+
get _formValues() {
|
|
1195
|
+
return i;
|
|
1196
|
+
},
|
|
1197
|
+
get _state() {
|
|
1198
|
+
return l;
|
|
1199
|
+
},
|
|
1200
|
+
set _state(o) {
|
|
1201
|
+
l = o;
|
|
1202
|
+
},
|
|
1203
|
+
get _defaultValues() {
|
|
1204
|
+
return n;
|
|
1205
|
+
},
|
|
1206
|
+
get _names() {
|
|
1207
|
+
return c;
|
|
1208
|
+
},
|
|
1209
|
+
set _names(o) {
|
|
1210
|
+
c = o;
|
|
1211
|
+
},
|
|
1212
|
+
get _formState() {
|
|
1213
|
+
return t;
|
|
1214
|
+
},
|
|
1215
|
+
set _formState(o) {
|
|
1216
|
+
t = o;
|
|
1217
|
+
},
|
|
1218
|
+
get _options() {
|
|
1219
|
+
return r;
|
|
1220
|
+
},
|
|
1221
|
+
set _options(o) {
|
|
1222
|
+
r = {
|
|
1223
|
+
...r,
|
|
1224
|
+
...o
|
|
1225
|
+
};
|
|
1226
|
+
}
|
|
1227
|
+
},
|
|
1228
|
+
trigger: Se,
|
|
1229
|
+
register: $,
|
|
1230
|
+
handleSubmit: B,
|
|
1231
|
+
watch: Be,
|
|
1232
|
+
setValue: X,
|
|
1233
|
+
getValues: Me,
|
|
1234
|
+
reset: ve,
|
|
1235
|
+
resetField: H,
|
|
1236
|
+
clearErrors: ze,
|
|
1237
|
+
unregister: we,
|
|
1238
|
+
setError: be,
|
|
1239
|
+
setFocus: (o, a = {}) => {
|
|
1240
|
+
const u = h(s, o), S = u && u._f;
|
|
1241
|
+
if (S) {
|
|
1242
|
+
const v = S.refs ? S.refs[0] : S.ref;
|
|
1243
|
+
v.focus && (v.focus(), a.shouldSelect && v.select());
|
|
1244
|
+
}
|
|
1245
|
+
},
|
|
1246
|
+
getFieldState: Le
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
function qo(e = {}) {
|
|
1250
|
+
const r = I.useRef(), t = I.useRef(), [s, n] = I.useState({
|
|
1251
|
+
isDirty: !1,
|
|
1252
|
+
isValidating: !1,
|
|
1253
|
+
isLoading: Ve(e.defaultValues),
|
|
1254
|
+
isSubmitted: !1,
|
|
1255
|
+
isSubmitting: !1,
|
|
1256
|
+
isSubmitSuccessful: !1,
|
|
1257
|
+
isValid: !1,
|
|
1258
|
+
submitCount: 0,
|
|
1259
|
+
dirtyFields: {},
|
|
1260
|
+
touchedFields: {},
|
|
1261
|
+
validatingFields: {},
|
|
1262
|
+
errors: e.errors || {},
|
|
1263
|
+
disabled: e.disabled || !1,
|
|
1264
|
+
defaultValues: Ve(e.defaultValues) ? void 0 : e.defaultValues
|
|
1265
|
+
});
|
|
1266
|
+
r.current || (r.current = {
|
|
1267
|
+
...eo(e),
|
|
1268
|
+
formState: s
|
|
1269
|
+
});
|
|
1270
|
+
const i = r.current.control;
|
|
1271
|
+
return i._options = e, ht({
|
|
1272
|
+
subject: i._subjects.state,
|
|
1273
|
+
next: (l) => {
|
|
1274
|
+
yr(l, i._proxyFormState, i._updateFormState, !0) && n({ ...i._formState });
|
|
1275
|
+
}
|
|
1276
|
+
}), I.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), I.useEffect(() => {
|
|
1277
|
+
if (i._proxyFormState.isDirty) {
|
|
1278
|
+
const l = i._getDirty();
|
|
1279
|
+
l !== s.isDirty && i._subjects.state.next({
|
|
1280
|
+
isDirty: l
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
}, [i, s.isDirty]), I.useEffect(() => {
|
|
1284
|
+
e.values && !Ie(e.values, t.current) ? (i._reset(e.values, i._options.resetOptions), t.current = e.values, n((l) => ({ ...l }))) : i._resetDefaultValues();
|
|
1285
|
+
}, [e.values, i]), I.useEffect(() => {
|
|
1286
|
+
e.errors && i._setErrors(e.errors);
|
|
1287
|
+
}, [e.errors, i]), I.useEffect(() => {
|
|
1288
|
+
i._state.mount || (i._updateValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
|
|
1289
|
+
}), I.useEffect(() => {
|
|
1290
|
+
e.shouldUnregister && i._subjects.values.next({
|
|
1291
|
+
values: i._getWatch()
|
|
1292
|
+
});
|
|
1293
|
+
}, [e.shouldUnregister, i]), r.current.formState = mr(s, i), r.current;
|
|
1294
|
+
}
|
|
1295
|
+
function or(e, [r, t]) {
|
|
1296
|
+
return Math.min(t, Math.max(r, e));
|
|
1297
|
+
}
|
|
1298
|
+
function to(e) {
|
|
1299
|
+
const r = p.useRef({ value: e, previous: e });
|
|
1300
|
+
return p.useMemo(() => (r.current.value !== e && (r.current.previous = r.current.value, r.current.value = e), r.current.previous), [e]);
|
|
1301
|
+
}
|
|
1302
|
+
var ro = [" ", "Enter", "ArrowUp", "ArrowDown"], so = [" ", "Enter"], et = "Select", [mt, yt, oo] = hs(et), [Ge, Go] = ms(et, [
|
|
1303
|
+
oo,
|
|
1304
|
+
ir
|
|
1305
|
+
]), gt = ir(), [no, Pe] = Ge(et), [io, ao] = Ge(et), Vr = (e) => {
|
|
1306
|
+
const {
|
|
1307
|
+
__scopeSelect: r,
|
|
1308
|
+
children: t,
|
|
1309
|
+
open: s,
|
|
1310
|
+
defaultOpen: n,
|
|
1311
|
+
onOpenChange: i,
|
|
1312
|
+
value: l,
|
|
1313
|
+
defaultValue: c,
|
|
1314
|
+
onValueChange: d,
|
|
1315
|
+
dir: _,
|
|
1316
|
+
name: m,
|
|
1317
|
+
autoComplete: g,
|
|
1318
|
+
disabled: E,
|
|
1319
|
+
required: O,
|
|
1320
|
+
form: D
|
|
1321
|
+
} = e, C = gt(r), [R, M] = p.useState(null), [y, V] = p.useState(null), [z, x] = p.useState(!1), w = Es(_), [F = !1, k] = Yt({
|
|
1322
|
+
prop: s,
|
|
1323
|
+
defaultProp: n,
|
|
1324
|
+
onChange: i
|
|
1325
|
+
}), [Q, Y] = Yt({
|
|
1326
|
+
prop: l,
|
|
1327
|
+
defaultProp: c,
|
|
1328
|
+
onChange: d
|
|
1329
|
+
}), ce = p.useRef(null), T = R ? D || !!R.closest("form") : !0, [P, L] = p.useState(/* @__PURE__ */ new Set()), W = Array.from(P).map((K) => K.props.value).join(";");
|
|
1330
|
+
return /* @__PURE__ */ b.jsx(Ts, { ...C, children: /* @__PURE__ */ b.jsxs(
|
|
1331
|
+
no,
|
|
1332
|
+
{
|
|
1333
|
+
required: O,
|
|
1334
|
+
scope: r,
|
|
1335
|
+
trigger: R,
|
|
1336
|
+
onTriggerChange: M,
|
|
1337
|
+
valueNode: y,
|
|
1338
|
+
onValueNodeChange: V,
|
|
1339
|
+
valueNodeHasChildren: z,
|
|
1340
|
+
onValueNodeHasChildrenChange: x,
|
|
1341
|
+
contentId: Bt(),
|
|
1342
|
+
value: Q,
|
|
1343
|
+
onValueChange: Y,
|
|
1344
|
+
open: F,
|
|
1345
|
+
onOpenChange: k,
|
|
1346
|
+
dir: w,
|
|
1347
|
+
triggerPointerDownPosRef: ce,
|
|
1348
|
+
disabled: E,
|
|
1349
|
+
children: [
|
|
1350
|
+
/* @__PURE__ */ b.jsx(mt.Provider, { scope: r, children: /* @__PURE__ */ b.jsx(
|
|
1351
|
+
io,
|
|
1352
|
+
{
|
|
1353
|
+
scope: e.__scopeSelect,
|
|
1354
|
+
onNativeOptionAdd: p.useCallback((K) => {
|
|
1355
|
+
L((X) => new Set(X).add(K));
|
|
1356
|
+
}, []),
|
|
1357
|
+
onNativeOptionRemove: p.useCallback((K) => {
|
|
1358
|
+
L((X) => {
|
|
1359
|
+
const ie = new Set(X);
|
|
1360
|
+
return ie.delete(K), ie;
|
|
1361
|
+
});
|
|
1362
|
+
}, []),
|
|
1363
|
+
children: t
|
|
1364
|
+
}
|
|
1365
|
+
) }),
|
|
1366
|
+
T ? /* @__PURE__ */ b.jsxs(
|
|
1367
|
+
Qr,
|
|
1368
|
+
{
|
|
1369
|
+
"aria-hidden": !0,
|
|
1370
|
+
required: O,
|
|
1371
|
+
tabIndex: -1,
|
|
1372
|
+
name: m,
|
|
1373
|
+
autoComplete: g,
|
|
1374
|
+
value: Q,
|
|
1375
|
+
onChange: (K) => Y(K.target.value),
|
|
1376
|
+
disabled: E,
|
|
1377
|
+
form: D,
|
|
1378
|
+
children: [
|
|
1379
|
+
Q === void 0 ? /* @__PURE__ */ b.jsx("option", { value: "" }) : null,
|
|
1380
|
+
Array.from(P)
|
|
1381
|
+
]
|
|
1382
|
+
},
|
|
1383
|
+
W
|
|
1384
|
+
) : null
|
|
1385
|
+
]
|
|
1386
|
+
}
|
|
1387
|
+
) });
|
|
1388
|
+
};
|
|
1389
|
+
Vr.displayName = et;
|
|
1390
|
+
var Fr = "SelectTrigger", Er = p.forwardRef(
|
|
1391
|
+
(e, r) => {
|
|
1392
|
+
const { __scopeSelect: t, disabled: s = !1, ...n } = e, i = gt(t), l = Pe(Fr, t), c = l.disabled || s, d = _e(r, l.onTriggerChange), _ = yt(t), m = p.useRef("touch"), [g, E, O] = Jr((C) => {
|
|
1393
|
+
const R = _().filter((V) => !V.disabled), M = R.find((V) => V.value === l.value), y = es(R, C, M);
|
|
1394
|
+
y !== void 0 && l.onValueChange(y.value);
|
|
1395
|
+
}), D = (C) => {
|
|
1396
|
+
c || (l.onOpenChange(!0), O()), C && (l.triggerPointerDownPosRef.current = {
|
|
1397
|
+
x: Math.round(C.pageX),
|
|
1398
|
+
y: Math.round(C.pageY)
|
|
1399
|
+
});
|
|
1400
|
+
};
|
|
1401
|
+
return /* @__PURE__ */ b.jsx(ys, { asChild: !0, ...i, children: /* @__PURE__ */ b.jsx(
|
|
1402
|
+
me.button,
|
|
1403
|
+
{
|
|
1404
|
+
type: "button",
|
|
1405
|
+
role: "combobox",
|
|
1406
|
+
"aria-controls": l.contentId,
|
|
1407
|
+
"aria-expanded": l.open,
|
|
1408
|
+
"aria-required": l.required,
|
|
1409
|
+
"aria-autocomplete": "none",
|
|
1410
|
+
dir: l.dir,
|
|
1411
|
+
"data-state": l.open ? "open" : "closed",
|
|
1412
|
+
disabled: c,
|
|
1413
|
+
"data-disabled": c ? "" : void 0,
|
|
1414
|
+
"data-placeholder": Zr(l.value) ? "" : void 0,
|
|
1415
|
+
...n,
|
|
1416
|
+
ref: d,
|
|
1417
|
+
onClick: oe(n.onClick, (C) => {
|
|
1418
|
+
C.currentTarget.focus(), m.current !== "mouse" && D(C);
|
|
1419
|
+
}),
|
|
1420
|
+
onPointerDown: oe(n.onPointerDown, (C) => {
|
|
1421
|
+
m.current = C.pointerType;
|
|
1422
|
+
const R = C.target;
|
|
1423
|
+
R.hasPointerCapture(C.pointerId) && R.releasePointerCapture(C.pointerId), C.button === 0 && C.ctrlKey === !1 && C.pointerType === "mouse" && (D(C), C.preventDefault());
|
|
1424
|
+
}),
|
|
1425
|
+
onKeyDown: oe(n.onKeyDown, (C) => {
|
|
1426
|
+
const R = g.current !== "";
|
|
1427
|
+
!(C.ctrlKey || C.altKey || C.metaKey) && C.key.length === 1 && E(C.key), !(R && C.key === " ") && ro.includes(C.key) && (D(), C.preventDefault());
|
|
1428
|
+
})
|
|
1429
|
+
}
|
|
1430
|
+
) });
|
|
1431
|
+
}
|
|
1432
|
+
);
|
|
1433
|
+
Er.displayName = Fr;
|
|
1434
|
+
var Tr = "SelectValue", Ir = p.forwardRef(
|
|
1435
|
+
(e, r) => {
|
|
1436
|
+
const { __scopeSelect: t, className: s, style: n, children: i, placeholder: l = "", ...c } = e, d = Pe(Tr, t), { onValueNodeHasChildrenChange: _ } = d, m = i !== void 0, g = _e(r, d.onValueNodeChange);
|
|
1437
|
+
return De(() => {
|
|
1438
|
+
_(m);
|
|
1439
|
+
}, [_, m]), /* @__PURE__ */ b.jsx(
|
|
1440
|
+
me.span,
|
|
1441
|
+
{
|
|
1442
|
+
...c,
|
|
1443
|
+
ref: g,
|
|
1444
|
+
style: { pointerEvents: "none" },
|
|
1445
|
+
children: Zr(d.value) ? /* @__PURE__ */ b.jsx(b.Fragment, { children: l }) : i
|
|
1446
|
+
}
|
|
1447
|
+
);
|
|
1448
|
+
}
|
|
1449
|
+
);
|
|
1450
|
+
Ir.displayName = Tr;
|
|
1451
|
+
var lo = "SelectIcon", Rr = p.forwardRef(
|
|
1452
|
+
(e, r) => {
|
|
1453
|
+
const { __scopeSelect: t, children: s, ...n } = e;
|
|
1454
|
+
return /* @__PURE__ */ b.jsx(me.span, { "aria-hidden": !0, ...n, ref: r, children: s || "▼" });
|
|
1455
|
+
}
|
|
1456
|
+
);
|
|
1457
|
+
Rr.displayName = lo;
|
|
1458
|
+
var co = "SelectPortal", Nr = (e) => /* @__PURE__ */ b.jsx(Fs, { asChild: !0, ...e });
|
|
1459
|
+
Nr.displayName = co;
|
|
1460
|
+
var je = "SelectContent", Dr = p.forwardRef(
|
|
1461
|
+
(e, r) => {
|
|
1462
|
+
const t = Pe(je, e.__scopeSelect), [s, n] = p.useState();
|
|
1463
|
+
if (De(() => {
|
|
1464
|
+
n(new DocumentFragment());
|
|
1465
|
+
}, []), !t.open) {
|
|
1466
|
+
const i = s;
|
|
1467
|
+
return i ? lr.createPortal(
|
|
1468
|
+
/* @__PURE__ */ b.jsx(Pr, { scope: e.__scopeSelect, children: /* @__PURE__ */ b.jsx(mt.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ b.jsx("div", { children: e.children }) }) }),
|
|
1469
|
+
i
|
|
1470
|
+
) : null;
|
|
1471
|
+
}
|
|
1472
|
+
return /* @__PURE__ */ b.jsx(kr, { ...e, ref: r });
|
|
1473
|
+
}
|
|
1474
|
+
);
|
|
1475
|
+
Dr.displayName = je;
|
|
1476
|
+
var ye = 10, [Pr, ke] = Ge(je), uo = "SelectContentImpl", kr = p.forwardRef(
|
|
1477
|
+
(e, r) => {
|
|
1478
|
+
const {
|
|
1479
|
+
__scopeSelect: t,
|
|
1480
|
+
position: s = "item-aligned",
|
|
1481
|
+
onCloseAutoFocus: n,
|
|
1482
|
+
onEscapeKeyDown: i,
|
|
1483
|
+
onPointerDownOutside: l,
|
|
1484
|
+
//
|
|
1485
|
+
// PopperContent props
|
|
1486
|
+
side: c,
|
|
1487
|
+
sideOffset: d,
|
|
1488
|
+
align: _,
|
|
1489
|
+
alignOffset: m,
|
|
1490
|
+
arrowPadding: g,
|
|
1491
|
+
collisionBoundary: E,
|
|
1492
|
+
collisionPadding: O,
|
|
1493
|
+
sticky: D,
|
|
1494
|
+
hideWhenDetached: C,
|
|
1495
|
+
avoidCollisions: R,
|
|
1496
|
+
//
|
|
1497
|
+
...M
|
|
1498
|
+
} = e, y = Pe(je, t), [V, z] = p.useState(null), [x, w] = p.useState(null), F = _e(r, (N) => z(N)), [k, Q] = p.useState(null), [Y, ce] = p.useState(
|
|
1499
|
+
null
|
|
1500
|
+
), T = yt(t), [P, L] = p.useState(!1), W = p.useRef(!1);
|
|
1501
|
+
p.useEffect(() => {
|
|
1502
|
+
if (V) return gs(V);
|
|
1503
|
+
}, [V]), vs();
|
|
1504
|
+
const K = p.useCallback(
|
|
1505
|
+
(N) => {
|
|
1506
|
+
const [$, ...ne] = T().map((H) => H.ref.current), [G] = ne.slice(-1), B = document.activeElement;
|
|
1507
|
+
for (const H of N)
|
|
1508
|
+
if (H === B || (H == null || H.scrollIntoView({ block: "nearest" }), H === $ && x && (x.scrollTop = 0), H === G && x && (x.scrollTop = x.scrollHeight), H == null || H.focus(), document.activeElement !== B)) return;
|
|
1509
|
+
},
|
|
1510
|
+
[T, x]
|
|
1511
|
+
), X = p.useCallback(
|
|
1512
|
+
() => K([k, V]),
|
|
1513
|
+
[K, k, V]
|
|
1514
|
+
);
|
|
1515
|
+
p.useEffect(() => {
|
|
1516
|
+
P && X();
|
|
1517
|
+
}, [P, X]);
|
|
1518
|
+
const { onOpenChange: ie, triggerPointerDownPosRef: ue } = y;
|
|
1519
|
+
p.useEffect(() => {
|
|
1520
|
+
if (V) {
|
|
1521
|
+
let N = { x: 0, y: 0 };
|
|
1522
|
+
const $ = (G) => {
|
|
1523
|
+
var B, H;
|
|
1524
|
+
N = {
|
|
1525
|
+
x: Math.abs(Math.round(G.pageX) - (((B = ue.current) == null ? void 0 : B.x) ?? 0)),
|
|
1526
|
+
y: Math.abs(Math.round(G.pageY) - (((H = ue.current) == null ? void 0 : H.y) ?? 0))
|
|
1527
|
+
};
|
|
1528
|
+
}, ne = (G) => {
|
|
1529
|
+
N.x <= 10 && N.y <= 10 ? G.preventDefault() : V.contains(G.target) || ie(!1), document.removeEventListener("pointermove", $), ue.current = null;
|
|
1530
|
+
};
|
|
1531
|
+
return ue.current !== null && (document.addEventListener("pointermove", $), document.addEventListener("pointerup", ne, { capture: !0, once: !0 })), () => {
|
|
1532
|
+
document.removeEventListener("pointermove", $), document.removeEventListener("pointerup", ne, { capture: !0 });
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
}, [V, ie, ue]), p.useEffect(() => {
|
|
1536
|
+
const N = () => ie(!1);
|
|
1537
|
+
return window.addEventListener("blur", N), window.addEventListener("resize", N), () => {
|
|
1538
|
+
window.removeEventListener("blur", N), window.removeEventListener("resize", N);
|
|
1539
|
+
};
|
|
1540
|
+
}, [ie]);
|
|
1541
|
+
const [Se, Me] = Jr((N) => {
|
|
1542
|
+
const $ = T().filter((B) => !B.disabled), ne = $.find((B) => B.ref.current === document.activeElement), G = es($, N, ne);
|
|
1543
|
+
G && setTimeout(() => G.ref.current.focus());
|
|
1544
|
+
}), Le = p.useCallback(
|
|
1545
|
+
(N, $, ne) => {
|
|
1546
|
+
const G = !W.current && !ne;
|
|
1547
|
+
(y.value !== void 0 && y.value === $ || G) && (Q(N), G && (W.current = !0));
|
|
1548
|
+
},
|
|
1549
|
+
[y.value]
|
|
1550
|
+
), ze = p.useCallback(() => V == null ? void 0 : V.focus(), [V]), be = p.useCallback(
|
|
1551
|
+
(N, $, ne) => {
|
|
1552
|
+
const G = !W.current && !ne;
|
|
1553
|
+
(y.value !== void 0 && y.value === $ || G) && ce(N);
|
|
1554
|
+
},
|
|
1555
|
+
[y.value]
|
|
1556
|
+
), Be = s === "popper" ? kt : Mr, we = Be === kt ? {
|
|
1557
|
+
side: c,
|
|
1558
|
+
sideOffset: d,
|
|
1559
|
+
align: _,
|
|
1560
|
+
alignOffset: m,
|
|
1561
|
+
arrowPadding: g,
|
|
1562
|
+
collisionBoundary: E,
|
|
1563
|
+
collisionPadding: O,
|
|
1564
|
+
sticky: D,
|
|
1565
|
+
hideWhenDetached: C,
|
|
1566
|
+
avoidCollisions: R
|
|
1567
|
+
} : {};
|
|
1568
|
+
return /* @__PURE__ */ b.jsx(
|
|
1569
|
+
Pr,
|
|
1570
|
+
{
|
|
1571
|
+
scope: t,
|
|
1572
|
+
content: V,
|
|
1573
|
+
viewport: x,
|
|
1574
|
+
onViewportChange: w,
|
|
1575
|
+
itemRefCallback: Le,
|
|
1576
|
+
selectedItem: k,
|
|
1577
|
+
onItemLeave: ze,
|
|
1578
|
+
itemTextRefCallback: be,
|
|
1579
|
+
focusSelectedItem: X,
|
|
1580
|
+
selectedItemText: Y,
|
|
1581
|
+
position: s,
|
|
1582
|
+
isPositioned: P,
|
|
1583
|
+
searchRef: Se,
|
|
1584
|
+
children: /* @__PURE__ */ b.jsx(xs, { as: _s, allowPinchZoom: !0, children: /* @__PURE__ */ b.jsx(
|
|
1585
|
+
Ss,
|
|
1586
|
+
{
|
|
1587
|
+
asChild: !0,
|
|
1588
|
+
trapped: y.open,
|
|
1589
|
+
onMountAutoFocus: (N) => {
|
|
1590
|
+
N.preventDefault();
|
|
1591
|
+
},
|
|
1592
|
+
onUnmountAutoFocus: oe(n, (N) => {
|
|
1593
|
+
var $;
|
|
1594
|
+
($ = y.trigger) == null || $.focus({ preventScroll: !0 }), N.preventDefault();
|
|
1595
|
+
}),
|
|
1596
|
+
children: /* @__PURE__ */ b.jsx(
|
|
1597
|
+
bs,
|
|
1598
|
+
{
|
|
1599
|
+
asChild: !0,
|
|
1600
|
+
disableOutsidePointerEvents: !0,
|
|
1601
|
+
onEscapeKeyDown: i,
|
|
1602
|
+
onPointerDownOutside: l,
|
|
1603
|
+
onFocusOutside: (N) => N.preventDefault(),
|
|
1604
|
+
onDismiss: () => y.onOpenChange(!1),
|
|
1605
|
+
children: /* @__PURE__ */ b.jsx(
|
|
1606
|
+
Be,
|
|
1607
|
+
{
|
|
1608
|
+
role: "listbox",
|
|
1609
|
+
id: y.contentId,
|
|
1610
|
+
"data-state": y.open ? "open" : "closed",
|
|
1611
|
+
dir: y.dir,
|
|
1612
|
+
onContextMenu: (N) => N.preventDefault(),
|
|
1613
|
+
...M,
|
|
1614
|
+
...we,
|
|
1615
|
+
onPlaced: () => L(!0),
|
|
1616
|
+
ref: F,
|
|
1617
|
+
style: {
|
|
1618
|
+
// flex layout so we can place the scroll buttons properly
|
|
1619
|
+
display: "flex",
|
|
1620
|
+
flexDirection: "column",
|
|
1621
|
+
// reset the outline by default as the content MAY get focused
|
|
1622
|
+
outline: "none",
|
|
1623
|
+
...M.style
|
|
1624
|
+
},
|
|
1625
|
+
onKeyDown: oe(M.onKeyDown, (N) => {
|
|
1626
|
+
const $ = N.ctrlKey || N.altKey || N.metaKey;
|
|
1627
|
+
if (N.key === "Tab" && N.preventDefault(), !$ && N.key.length === 1 && Me(N.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(N.key)) {
|
|
1628
|
+
let G = T().filter((B) => !B.disabled).map((B) => B.ref.current);
|
|
1629
|
+
if (["ArrowUp", "End"].includes(N.key) && (G = G.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(N.key)) {
|
|
1630
|
+
const B = N.target, H = G.indexOf(B);
|
|
1631
|
+
G = G.slice(H + 1);
|
|
1632
|
+
}
|
|
1633
|
+
setTimeout(() => K(G)), N.preventDefault();
|
|
1634
|
+
}
|
|
1635
|
+
})
|
|
1636
|
+
}
|
|
1637
|
+
)
|
|
1638
|
+
}
|
|
1639
|
+
)
|
|
1640
|
+
}
|
|
1641
|
+
) })
|
|
1642
|
+
}
|
|
1643
|
+
);
|
|
1644
|
+
}
|
|
1645
|
+
);
|
|
1646
|
+
kr.displayName = uo;
|
|
1647
|
+
var fo = "SelectItemAlignedPosition", Mr = p.forwardRef((e, r) => {
|
|
1648
|
+
const { __scopeSelect: t, onPlaced: s, ...n } = e, i = Pe(je, t), l = ke(je, t), [c, d] = p.useState(null), [_, m] = p.useState(null), g = _e(r, (F) => m(F)), E = yt(t), O = p.useRef(!1), D = p.useRef(!0), { viewport: C, selectedItem: R, selectedItemText: M, focusSelectedItem: y } = l, V = p.useCallback(() => {
|
|
1649
|
+
if (i.trigger && i.valueNode && c && _ && C && R && M) {
|
|
1650
|
+
const F = i.trigger.getBoundingClientRect(), k = _.getBoundingClientRect(), Q = i.valueNode.getBoundingClientRect(), Y = M.getBoundingClientRect();
|
|
1651
|
+
if (i.dir !== "rtl") {
|
|
1652
|
+
const B = Y.left - k.left, H = Q.left - B, ge = F.left - H, ve = F.width + ge, tt = Math.max(ve, k.width), rt = window.innerWidth - ye, st = or(H, [
|
|
1653
|
+
ye,
|
|
1654
|
+
// Prevents the content from going off the starting edge of the
|
|
1655
|
+
// viewport. It may still go off the ending edge, but this can be
|
|
1656
|
+
// controlled by the user since they may want to manage overflow in a
|
|
1657
|
+
// specific way.
|
|
1658
|
+
// https://github.com/radix-ui/primitives/issues/2049
|
|
1659
|
+
Math.max(ye, rt - tt)
|
|
1660
|
+
]);
|
|
1661
|
+
c.style.minWidth = ve + "px", c.style.left = st + "px";
|
|
1662
|
+
} else {
|
|
1663
|
+
const B = k.right - Y.right, H = window.innerWidth - Q.right - B, ge = window.innerWidth - F.right - H, ve = F.width + ge, tt = Math.max(ve, k.width), rt = window.innerWidth - ye, st = or(H, [
|
|
1664
|
+
ye,
|
|
1665
|
+
Math.max(ye, rt - tt)
|
|
1666
|
+
]);
|
|
1667
|
+
c.style.minWidth = ve + "px", c.style.right = st + "px";
|
|
1668
|
+
}
|
|
1669
|
+
const ce = E(), T = window.innerHeight - ye * 2, P = C.scrollHeight, L = window.getComputedStyle(_), W = parseInt(L.borderTopWidth, 10), K = parseInt(L.paddingTop, 10), X = parseInt(L.borderBottomWidth, 10), ie = parseInt(L.paddingBottom, 10), ue = W + K + P + ie + X, Se = Math.min(R.offsetHeight * 5, ue), Me = window.getComputedStyle(C), Le = parseInt(Me.paddingTop, 10), ze = parseInt(Me.paddingBottom, 10), be = F.top + F.height / 2 - ye, Be = T - be, we = R.offsetHeight / 2, N = R.offsetTop + we, $ = W + K + N, ne = ue - $;
|
|
1670
|
+
if ($ <= be) {
|
|
1671
|
+
const B = ce.length > 0 && R === ce[ce.length - 1].ref.current;
|
|
1672
|
+
c.style.bottom = "0px";
|
|
1673
|
+
const H = _.clientHeight - C.offsetTop - C.offsetHeight, ge = Math.max(
|
|
1674
|
+
Be,
|
|
1675
|
+
we + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
1676
|
+
(B ? ze : 0) + H + X
|
|
1677
|
+
), ve = $ + ge;
|
|
1678
|
+
c.style.height = ve + "px";
|
|
1679
|
+
} else {
|
|
1680
|
+
const B = ce.length > 0 && R === ce[0].ref.current;
|
|
1681
|
+
c.style.top = "0px";
|
|
1682
|
+
const ge = Math.max(
|
|
1683
|
+
be,
|
|
1684
|
+
W + C.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
1685
|
+
(B ? Le : 0) + we
|
|
1686
|
+
) + ne;
|
|
1687
|
+
c.style.height = ge + "px", C.scrollTop = $ - be + C.offsetTop;
|
|
1688
|
+
}
|
|
1689
|
+
c.style.margin = `${ye}px 0`, c.style.minHeight = Se + "px", c.style.maxHeight = T + "px", s == null || s(), requestAnimationFrame(() => O.current = !0);
|
|
1690
|
+
}
|
|
1691
|
+
}, [
|
|
1692
|
+
E,
|
|
1693
|
+
i.trigger,
|
|
1694
|
+
i.valueNode,
|
|
1695
|
+
c,
|
|
1696
|
+
_,
|
|
1697
|
+
C,
|
|
1698
|
+
R,
|
|
1699
|
+
M,
|
|
1700
|
+
i.dir,
|
|
1701
|
+
s
|
|
1702
|
+
]);
|
|
1703
|
+
De(() => V(), [V]);
|
|
1704
|
+
const [z, x] = p.useState();
|
|
1705
|
+
De(() => {
|
|
1706
|
+
_ && x(window.getComputedStyle(_).zIndex);
|
|
1707
|
+
}, [_]);
|
|
1708
|
+
const w = p.useCallback(
|
|
1709
|
+
(F) => {
|
|
1710
|
+
F && D.current === !0 && (V(), y == null || y(), D.current = !1);
|
|
1711
|
+
},
|
|
1712
|
+
[V, y]
|
|
1713
|
+
);
|
|
1714
|
+
return /* @__PURE__ */ b.jsx(
|
|
1715
|
+
ho,
|
|
1716
|
+
{
|
|
1717
|
+
scope: t,
|
|
1718
|
+
contentWrapper: c,
|
|
1719
|
+
shouldExpandOnScrollRef: O,
|
|
1720
|
+
onScrollButtonChange: w,
|
|
1721
|
+
children: /* @__PURE__ */ b.jsx(
|
|
1722
|
+
"div",
|
|
1723
|
+
{
|
|
1724
|
+
ref: d,
|
|
1725
|
+
style: {
|
|
1726
|
+
display: "flex",
|
|
1727
|
+
flexDirection: "column",
|
|
1728
|
+
position: "fixed",
|
|
1729
|
+
zIndex: z
|
|
1730
|
+
},
|
|
1731
|
+
children: /* @__PURE__ */ b.jsx(
|
|
1732
|
+
me.div,
|
|
1733
|
+
{
|
|
1734
|
+
...n,
|
|
1735
|
+
ref: g,
|
|
1736
|
+
style: {
|
|
1737
|
+
// When we get the height of the content, it includes borders. If we were to set
|
|
1738
|
+
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
1739
|
+
boxSizing: "border-box",
|
|
1740
|
+
// We need to ensure the content doesn't get taller than the wrapper
|
|
1741
|
+
maxHeight: "100%",
|
|
1742
|
+
...n.style
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
)
|
|
1746
|
+
}
|
|
1747
|
+
)
|
|
1748
|
+
}
|
|
1749
|
+
);
|
|
1750
|
+
});
|
|
1751
|
+
Mr.displayName = fo;
|
|
1752
|
+
var po = "SelectPopperPosition", kt = p.forwardRef((e, r) => {
|
|
1753
|
+
const {
|
|
1754
|
+
__scopeSelect: t,
|
|
1755
|
+
align: s = "start",
|
|
1756
|
+
collisionPadding: n = ye,
|
|
1757
|
+
...i
|
|
1758
|
+
} = e, l = gt(t);
|
|
1759
|
+
return /* @__PURE__ */ b.jsx(
|
|
1760
|
+
ws,
|
|
1761
|
+
{
|
|
1762
|
+
...l,
|
|
1763
|
+
...i,
|
|
1764
|
+
ref: r,
|
|
1765
|
+
align: s,
|
|
1766
|
+
collisionPadding: n,
|
|
1767
|
+
style: {
|
|
1768
|
+
// Ensure border-box for floating-ui calculations
|
|
1769
|
+
boxSizing: "border-box",
|
|
1770
|
+
...i.style,
|
|
1771
|
+
"--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1772
|
+
"--radix-select-content-available-width": "var(--radix-popper-available-width)",
|
|
1773
|
+
"--radix-select-content-available-height": "var(--radix-popper-available-height)",
|
|
1774
|
+
"--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1775
|
+
"--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
);
|
|
1779
|
+
});
|
|
1780
|
+
kt.displayName = po;
|
|
1781
|
+
var [ho, $t] = Ge(je, {}), Mt = "SelectViewport", Or = p.forwardRef(
|
|
1782
|
+
(e, r) => {
|
|
1783
|
+
const { __scopeSelect: t, nonce: s, ...n } = e, i = ke(Mt, t), l = $t(Mt, t), c = _e(r, i.onViewportChange), d = p.useRef(0);
|
|
1784
|
+
return /* @__PURE__ */ b.jsxs(b.Fragment, { children: [
|
|
1785
|
+
/* @__PURE__ */ b.jsx(
|
|
1786
|
+
"style",
|
|
1787
|
+
{
|
|
1788
|
+
dangerouslySetInnerHTML: {
|
|
1789
|
+
__html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
|
|
1790
|
+
},
|
|
1791
|
+
nonce: s
|
|
1792
|
+
}
|
|
1793
|
+
),
|
|
1794
|
+
/* @__PURE__ */ b.jsx(mt.Slot, { scope: t, children: /* @__PURE__ */ b.jsx(
|
|
1795
|
+
me.div,
|
|
1796
|
+
{
|
|
1797
|
+
"data-radix-select-viewport": "",
|
|
1798
|
+
role: "presentation",
|
|
1799
|
+
...n,
|
|
1800
|
+
ref: c,
|
|
1801
|
+
style: {
|
|
1802
|
+
// we use position: 'relative' here on the `viewport` so that when we call
|
|
1803
|
+
// `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
|
|
1804
|
+
// (independent of the scrollUpButton).
|
|
1805
|
+
position: "relative",
|
|
1806
|
+
flex: 1,
|
|
1807
|
+
// Viewport should only be scrollable in the vertical direction.
|
|
1808
|
+
// This won't work in vertical writing modes, so we'll need to
|
|
1809
|
+
// revisit this if/when that is supported
|
|
1810
|
+
// https://developer.chrome.com/blog/vertical-form-controls
|
|
1811
|
+
overflow: "hidden auto",
|
|
1812
|
+
...n.style
|
|
1813
|
+
},
|
|
1814
|
+
onScroll: oe(n.onScroll, (_) => {
|
|
1815
|
+
const m = _.currentTarget, { contentWrapper: g, shouldExpandOnScrollRef: E } = l;
|
|
1816
|
+
if (E != null && E.current && g) {
|
|
1817
|
+
const O = Math.abs(d.current - m.scrollTop);
|
|
1818
|
+
if (O > 0) {
|
|
1819
|
+
const D = window.innerHeight - ye * 2, C = parseFloat(g.style.minHeight), R = parseFloat(g.style.height), M = Math.max(C, R);
|
|
1820
|
+
if (M < D) {
|
|
1821
|
+
const y = M + O, V = Math.min(D, y), z = y - V;
|
|
1822
|
+
g.style.height = V + "px", g.style.bottom === "0px" && (m.scrollTop = z > 0 ? z : 0, g.style.justifyContent = "flex-end");
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
d.current = m.scrollTop;
|
|
1827
|
+
})
|
|
1828
|
+
}
|
|
1829
|
+
) })
|
|
1830
|
+
] });
|
|
1831
|
+
}
|
|
1832
|
+
);
|
|
1833
|
+
Or.displayName = Mt;
|
|
1834
|
+
var jr = "SelectGroup", [mo, yo] = Ge(jr), Lr = p.forwardRef(
|
|
1835
|
+
(e, r) => {
|
|
1836
|
+
const { __scopeSelect: t, ...s } = e, n = Bt();
|
|
1837
|
+
return /* @__PURE__ */ b.jsx(mo, { scope: t, id: n, children: /* @__PURE__ */ b.jsx(me.div, { role: "group", "aria-labelledby": n, ...s, ref: r }) });
|
|
1838
|
+
}
|
|
1839
|
+
);
|
|
1840
|
+
Lr.displayName = jr;
|
|
1841
|
+
var Br = "SelectLabel", Ur = p.forwardRef(
|
|
1842
|
+
(e, r) => {
|
|
1843
|
+
const { __scopeSelect: t, ...s } = e, n = yo(Br, t);
|
|
1844
|
+
return /* @__PURE__ */ b.jsx(me.div, { id: n.id, ...s, ref: r });
|
|
1845
|
+
}
|
|
1846
|
+
);
|
|
1847
|
+
Ur.displayName = Br;
|
|
1848
|
+
var ft = "SelectItem", [go, Hr] = Ge(ft), Wr = p.forwardRef(
|
|
1849
|
+
(e, r) => {
|
|
1850
|
+
const {
|
|
1851
|
+
__scopeSelect: t,
|
|
1852
|
+
value: s,
|
|
1853
|
+
disabled: n = !1,
|
|
1854
|
+
textValue: i,
|
|
1855
|
+
...l
|
|
1856
|
+
} = e, c = Pe(ft, t), d = ke(ft, t), _ = c.value === s, [m, g] = p.useState(i ?? ""), [E, O] = p.useState(!1), D = _e(
|
|
1857
|
+
r,
|
|
1858
|
+
(y) => {
|
|
1859
|
+
var V;
|
|
1860
|
+
return (V = d.itemRefCallback) == null ? void 0 : V.call(d, y, s, n);
|
|
1861
|
+
}
|
|
1862
|
+
), C = Bt(), R = p.useRef("touch"), M = () => {
|
|
1863
|
+
n || (c.onValueChange(s), c.onOpenChange(!1));
|
|
1864
|
+
};
|
|
1865
|
+
if (s === "")
|
|
1866
|
+
throw new Error(
|
|
1867
|
+
"A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
|
|
1868
|
+
);
|
|
1869
|
+
return /* @__PURE__ */ b.jsx(
|
|
1870
|
+
go,
|
|
1871
|
+
{
|
|
1872
|
+
scope: t,
|
|
1873
|
+
value: s,
|
|
1874
|
+
disabled: n,
|
|
1875
|
+
textId: C,
|
|
1876
|
+
isSelected: _,
|
|
1877
|
+
onItemTextChange: p.useCallback((y) => {
|
|
1878
|
+
g((V) => V || ((y == null ? void 0 : y.textContent) ?? "").trim());
|
|
1879
|
+
}, []),
|
|
1880
|
+
children: /* @__PURE__ */ b.jsx(
|
|
1881
|
+
mt.ItemSlot,
|
|
1882
|
+
{
|
|
1883
|
+
scope: t,
|
|
1884
|
+
value: s,
|
|
1885
|
+
disabled: n,
|
|
1886
|
+
textValue: m,
|
|
1887
|
+
children: /* @__PURE__ */ b.jsx(
|
|
1888
|
+
me.div,
|
|
1889
|
+
{
|
|
1890
|
+
role: "option",
|
|
1891
|
+
"aria-labelledby": C,
|
|
1892
|
+
"data-highlighted": E ? "" : void 0,
|
|
1893
|
+
"aria-selected": _ && E,
|
|
1894
|
+
"data-state": _ ? "checked" : "unchecked",
|
|
1895
|
+
"aria-disabled": n || void 0,
|
|
1896
|
+
"data-disabled": n ? "" : void 0,
|
|
1897
|
+
tabIndex: n ? void 0 : -1,
|
|
1898
|
+
...l,
|
|
1899
|
+
ref: D,
|
|
1900
|
+
onFocus: oe(l.onFocus, () => O(!0)),
|
|
1901
|
+
onBlur: oe(l.onBlur, () => O(!1)),
|
|
1902
|
+
onClick: oe(l.onClick, () => {
|
|
1903
|
+
R.current !== "mouse" && M();
|
|
1904
|
+
}),
|
|
1905
|
+
onPointerUp: oe(l.onPointerUp, () => {
|
|
1906
|
+
R.current === "mouse" && M();
|
|
1907
|
+
}),
|
|
1908
|
+
onPointerDown: oe(l.onPointerDown, (y) => {
|
|
1909
|
+
R.current = y.pointerType;
|
|
1910
|
+
}),
|
|
1911
|
+
onPointerMove: oe(l.onPointerMove, (y) => {
|
|
1912
|
+
var V;
|
|
1913
|
+
R.current = y.pointerType, n ? (V = d.onItemLeave) == null || V.call(d) : R.current === "mouse" && y.currentTarget.focus({ preventScroll: !0 });
|
|
1914
|
+
}),
|
|
1915
|
+
onPointerLeave: oe(l.onPointerLeave, (y) => {
|
|
1916
|
+
var V;
|
|
1917
|
+
y.currentTarget === document.activeElement && ((V = d.onItemLeave) == null || V.call(d));
|
|
1918
|
+
}),
|
|
1919
|
+
onKeyDown: oe(l.onKeyDown, (y) => {
|
|
1920
|
+
var z;
|
|
1921
|
+
((z = d.searchRef) == null ? void 0 : z.current) !== "" && y.key === " " || (so.includes(y.key) && M(), y.key === " " && y.preventDefault());
|
|
1922
|
+
})
|
|
1923
|
+
}
|
|
1924
|
+
)
|
|
1925
|
+
}
|
|
1926
|
+
)
|
|
1927
|
+
}
|
|
1928
|
+
);
|
|
1929
|
+
}
|
|
1930
|
+
);
|
|
1931
|
+
Wr.displayName = ft;
|
|
1932
|
+
var Xe = "SelectItemText", Kr = p.forwardRef(
|
|
1933
|
+
(e, r) => {
|
|
1934
|
+
const { __scopeSelect: t, className: s, style: n, ...i } = e, l = Pe(Xe, t), c = ke(Xe, t), d = Hr(Xe, t), _ = ao(Xe, t), [m, g] = p.useState(null), E = _e(
|
|
1935
|
+
r,
|
|
1936
|
+
(M) => g(M),
|
|
1937
|
+
d.onItemTextChange,
|
|
1938
|
+
(M) => {
|
|
1939
|
+
var y;
|
|
1940
|
+
return (y = c.itemTextRefCallback) == null ? void 0 : y.call(c, M, d.value, d.disabled);
|
|
1941
|
+
}
|
|
1942
|
+
), O = m == null ? void 0 : m.textContent, D = p.useMemo(
|
|
1943
|
+
() => /* @__PURE__ */ b.jsx("option", { value: d.value, disabled: d.disabled, children: O }, d.value),
|
|
1944
|
+
[d.disabled, d.value, O]
|
|
1945
|
+
), { onNativeOptionAdd: C, onNativeOptionRemove: R } = _;
|
|
1946
|
+
return De(() => (C(D), () => R(D)), [C, R, D]), /* @__PURE__ */ b.jsxs(b.Fragment, { children: [
|
|
1947
|
+
/* @__PURE__ */ b.jsx(me.span, { id: d.textId, ...i, ref: E }),
|
|
1948
|
+
d.isSelected && l.valueNode && !l.valueNodeHasChildren ? lr.createPortal(i.children, l.valueNode) : null
|
|
1949
|
+
] });
|
|
1950
|
+
}
|
|
1951
|
+
);
|
|
1952
|
+
Kr.displayName = Xe;
|
|
1953
|
+
var $r = "SelectItemIndicator", qr = p.forwardRef(
|
|
1954
|
+
(e, r) => {
|
|
1955
|
+
const { __scopeSelect: t, ...s } = e;
|
|
1956
|
+
return Hr($r, t).isSelected ? /* @__PURE__ */ b.jsx(me.span, { "aria-hidden": !0, ...s, ref: r }) : null;
|
|
1957
|
+
}
|
|
1958
|
+
);
|
|
1959
|
+
qr.displayName = $r;
|
|
1960
|
+
var Ot = "SelectScrollUpButton", Gr = p.forwardRef((e, r) => {
|
|
1961
|
+
const t = ke(Ot, e.__scopeSelect), s = $t(Ot, e.__scopeSelect), [n, i] = p.useState(!1), l = _e(r, s.onScrollButtonChange);
|
|
1962
|
+
return De(() => {
|
|
1963
|
+
if (t.viewport && t.isPositioned) {
|
|
1964
|
+
let c = function() {
|
|
1965
|
+
const _ = d.scrollTop > 0;
|
|
1966
|
+
i(_);
|
|
1967
|
+
};
|
|
1968
|
+
const d = t.viewport;
|
|
1969
|
+
return c(), d.addEventListener("scroll", c), () => d.removeEventListener("scroll", c);
|
|
1970
|
+
}
|
|
1971
|
+
}, [t.viewport, t.isPositioned]), n ? /* @__PURE__ */ b.jsx(
|
|
1972
|
+
Yr,
|
|
1973
|
+
{
|
|
1974
|
+
...e,
|
|
1975
|
+
ref: l,
|
|
1976
|
+
onAutoScroll: () => {
|
|
1977
|
+
const { viewport: c, selectedItem: d } = t;
|
|
1978
|
+
c && d && (c.scrollTop = c.scrollTop - d.offsetHeight);
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
) : null;
|
|
1982
|
+
});
|
|
1983
|
+
Gr.displayName = Ot;
|
|
1984
|
+
var jt = "SelectScrollDownButton", zr = p.forwardRef((e, r) => {
|
|
1985
|
+
const t = ke(jt, e.__scopeSelect), s = $t(jt, e.__scopeSelect), [n, i] = p.useState(!1), l = _e(r, s.onScrollButtonChange);
|
|
1986
|
+
return De(() => {
|
|
1987
|
+
if (t.viewport && t.isPositioned) {
|
|
1988
|
+
let c = function() {
|
|
1989
|
+
const _ = d.scrollHeight - d.clientHeight, m = Math.ceil(d.scrollTop) < _;
|
|
1990
|
+
i(m);
|
|
1991
|
+
};
|
|
1992
|
+
const d = t.viewport;
|
|
1993
|
+
return c(), d.addEventListener("scroll", c), () => d.removeEventListener("scroll", c);
|
|
1994
|
+
}
|
|
1995
|
+
}, [t.viewport, t.isPositioned]), n ? /* @__PURE__ */ b.jsx(
|
|
1996
|
+
Yr,
|
|
1997
|
+
{
|
|
1998
|
+
...e,
|
|
1999
|
+
ref: l,
|
|
2000
|
+
onAutoScroll: () => {
|
|
2001
|
+
const { viewport: c, selectedItem: d } = t;
|
|
2002
|
+
c && d && (c.scrollTop = c.scrollTop + d.offsetHeight);
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
) : null;
|
|
2006
|
+
});
|
|
2007
|
+
zr.displayName = jt;
|
|
2008
|
+
var Yr = p.forwardRef((e, r) => {
|
|
2009
|
+
const { __scopeSelect: t, onAutoScroll: s, ...n } = e, i = ke("SelectScrollButton", t), l = p.useRef(null), c = yt(t), d = p.useCallback(() => {
|
|
2010
|
+
l.current !== null && (window.clearInterval(l.current), l.current = null);
|
|
2011
|
+
}, []);
|
|
2012
|
+
return p.useEffect(() => () => d(), [d]), De(() => {
|
|
2013
|
+
var m;
|
|
2014
|
+
const _ = c().find((g) => g.ref.current === document.activeElement);
|
|
2015
|
+
(m = _ == null ? void 0 : _.ref.current) == null || m.scrollIntoView({ block: "nearest" });
|
|
2016
|
+
}, [c]), /* @__PURE__ */ b.jsx(
|
|
2017
|
+
me.div,
|
|
2018
|
+
{
|
|
2019
|
+
"aria-hidden": !0,
|
|
2020
|
+
...n,
|
|
2021
|
+
ref: r,
|
|
2022
|
+
style: { flexShrink: 0, ...n.style },
|
|
2023
|
+
onPointerDown: oe(n.onPointerDown, () => {
|
|
2024
|
+
l.current === null && (l.current = window.setInterval(s, 50));
|
|
2025
|
+
}),
|
|
2026
|
+
onPointerMove: oe(n.onPointerMove, () => {
|
|
2027
|
+
var _;
|
|
2028
|
+
(_ = i.onItemLeave) == null || _.call(i), l.current === null && (l.current = window.setInterval(s, 50));
|
|
2029
|
+
}),
|
|
2030
|
+
onPointerLeave: oe(n.onPointerLeave, () => {
|
|
2031
|
+
d();
|
|
2032
|
+
})
|
|
2033
|
+
}
|
|
2034
|
+
);
|
|
2035
|
+
}), vo = "SelectSeparator", Xr = p.forwardRef(
|
|
2036
|
+
(e, r) => {
|
|
2037
|
+
const { __scopeSelect: t, ...s } = e;
|
|
2038
|
+
return /* @__PURE__ */ b.jsx(me.div, { "aria-hidden": !0, ...s, ref: r });
|
|
2039
|
+
}
|
|
2040
|
+
);
|
|
2041
|
+
Xr.displayName = vo;
|
|
2042
|
+
var Lt = "SelectArrow", xo = p.forwardRef(
|
|
2043
|
+
(e, r) => {
|
|
2044
|
+
const { __scopeSelect: t, ...s } = e, n = gt(t), i = Pe(Lt, t), l = ke(Lt, t);
|
|
2045
|
+
return i.open && l.position === "popper" ? /* @__PURE__ */ b.jsx(Cs, { ...n, ...s, ref: r }) : null;
|
|
2046
|
+
}
|
|
2047
|
+
);
|
|
2048
|
+
xo.displayName = Lt;
|
|
2049
|
+
function Zr(e) {
|
|
2050
|
+
return e === "" || e === void 0;
|
|
2051
|
+
}
|
|
2052
|
+
var Qr = p.forwardRef(
|
|
2053
|
+
(e, r) => {
|
|
2054
|
+
const { value: t, ...s } = e, n = p.useRef(null), i = _e(r, n), l = to(t);
|
|
2055
|
+
return p.useEffect(() => {
|
|
2056
|
+
const c = n.current, d = window.HTMLSelectElement.prototype, m = Object.getOwnPropertyDescriptor(
|
|
2057
|
+
d,
|
|
2058
|
+
"value"
|
|
2059
|
+
).set;
|
|
2060
|
+
if (l !== t && m) {
|
|
2061
|
+
const g = new Event("change", { bubbles: !0 });
|
|
2062
|
+
m.call(c, t), c.dispatchEvent(g);
|
|
2063
|
+
}
|
|
2064
|
+
}, [l, t]), /* @__PURE__ */ b.jsx(As, { asChild: !0, children: /* @__PURE__ */ b.jsx("select", { ...s, ref: i, defaultValue: t }) });
|
|
2065
|
+
}
|
|
2066
|
+
);
|
|
2067
|
+
Qr.displayName = "BubbleSelect";
|
|
2068
|
+
function Jr(e) {
|
|
2069
|
+
const r = Vs(e), t = p.useRef(""), s = p.useRef(0), n = p.useCallback(
|
|
2070
|
+
(l) => {
|
|
2071
|
+
const c = t.current + l;
|
|
2072
|
+
r(c), function d(_) {
|
|
2073
|
+
t.current = _, window.clearTimeout(s.current), _ !== "" && (s.current = window.setTimeout(() => d(""), 1e3));
|
|
2074
|
+
}(c);
|
|
2075
|
+
},
|
|
2076
|
+
[r]
|
|
2077
|
+
), i = p.useCallback(() => {
|
|
2078
|
+
t.current = "", window.clearTimeout(s.current);
|
|
2079
|
+
}, []);
|
|
2080
|
+
return p.useEffect(() => () => window.clearTimeout(s.current), []), [t, n, i];
|
|
2081
|
+
}
|
|
2082
|
+
function es(e, r, t) {
|
|
2083
|
+
const n = r.length > 1 && Array.from(r).every((_) => _ === r[0]) ? r[0] : r, i = t ? e.indexOf(t) : -1;
|
|
2084
|
+
let l = _o(e, Math.max(i, 0));
|
|
2085
|
+
n.length === 1 && (l = l.filter((_) => _ !== t));
|
|
2086
|
+
const d = l.find(
|
|
2087
|
+
(_) => _.textValue.toLowerCase().startsWith(n.toLowerCase())
|
|
2088
|
+
);
|
|
2089
|
+
return d !== t ? d : void 0;
|
|
2090
|
+
}
|
|
2091
|
+
function _o(e, r) {
|
|
2092
|
+
return e.map((t, s) => e[(r + s) % e.length]);
|
|
2093
|
+
}
|
|
2094
|
+
var So = Vr, ts = Er, bo = Ir, wo = Rr, Co = Nr, rs = Dr, Ao = Or, Vo = Lr, ss = Ur, os = Wr, Fo = Kr, Eo = qr, ns = Gr, is = zr, as = Xr;
|
|
2095
|
+
const zo = So, Yo = Vo, Xo = bo, To = p.forwardRef(({ className: e, children: r, ...t }, s) => /* @__PURE__ */ b.jsxs(
|
|
2096
|
+
ts,
|
|
2097
|
+
{
|
|
2098
|
+
ref: s,
|
|
2099
|
+
className: Ee(
|
|
2100
|
+
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
2101
|
+
e
|
|
2102
|
+
),
|
|
2103
|
+
...t,
|
|
2104
|
+
children: [
|
|
2105
|
+
/* @__PURE__ */ b.jsx("span", { className: "truncate", children: r }),
|
|
2106
|
+
/* @__PURE__ */ b.jsx(wo, { asChild: !0, children: /* @__PURE__ */ b.jsx(cr, { className: "flex-shrink-0 h-4 w-4 opacity-50" }) })
|
|
2107
|
+
]
|
|
2108
|
+
}
|
|
2109
|
+
));
|
|
2110
|
+
To.displayName = ts.displayName;
|
|
2111
|
+
const ls = p.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ b.jsx(
|
|
2112
|
+
ns,
|
|
2113
|
+
{
|
|
2114
|
+
ref: t,
|
|
2115
|
+
className: Ee(
|
|
2116
|
+
"flex cursor-default items-center justify-center py-1",
|
|
2117
|
+
e
|
|
2118
|
+
),
|
|
2119
|
+
...r,
|
|
2120
|
+
children: /* @__PURE__ */ b.jsx(ks, { className: "h-4 w-4" })
|
|
2121
|
+
}
|
|
2122
|
+
));
|
|
2123
|
+
ls.displayName = ns.displayName;
|
|
2124
|
+
const cs = p.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ b.jsx(
|
|
2125
|
+
is,
|
|
2126
|
+
{
|
|
2127
|
+
ref: t,
|
|
2128
|
+
className: Ee(
|
|
2129
|
+
"flex cursor-default items-center justify-center py-1",
|
|
2130
|
+
e
|
|
2131
|
+
),
|
|
2132
|
+
...r,
|
|
2133
|
+
children: /* @__PURE__ */ b.jsx(cr, { className: "h-4 w-4" })
|
|
2134
|
+
}
|
|
2135
|
+
));
|
|
2136
|
+
cs.displayName = is.displayName;
|
|
2137
|
+
const Io = p.forwardRef(({ className: e, children: r, position: t = "popper", ...s }, n) => /* @__PURE__ */ b.jsx(Co, { children: /* @__PURE__ */ b.jsxs(
|
|
2138
|
+
rs,
|
|
2139
|
+
{
|
|
2140
|
+
ref: n,
|
|
2141
|
+
className: Ee(
|
|
2142
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
2143
|
+
t === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
2144
|
+
e
|
|
2145
|
+
),
|
|
2146
|
+
position: t,
|
|
2147
|
+
...s,
|
|
2148
|
+
children: [
|
|
2149
|
+
/* @__PURE__ */ b.jsx(ls, {}),
|
|
2150
|
+
/* @__PURE__ */ b.jsx(
|
|
2151
|
+
Ao,
|
|
2152
|
+
{
|
|
2153
|
+
className: Ee(
|
|
2154
|
+
"p-1",
|
|
2155
|
+
t === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
2156
|
+
),
|
|
2157
|
+
children: r
|
|
2158
|
+
}
|
|
2159
|
+
),
|
|
2160
|
+
/* @__PURE__ */ b.jsx(cs, {})
|
|
2161
|
+
]
|
|
2162
|
+
}
|
|
2163
|
+
) }));
|
|
2164
|
+
Io.displayName = rs.displayName;
|
|
2165
|
+
const Ro = p.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ b.jsx(
|
|
2166
|
+
ss,
|
|
2167
|
+
{
|
|
2168
|
+
ref: t,
|
|
2169
|
+
className: Ee("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
|
|
2170
|
+
...r
|
|
2171
|
+
}
|
|
2172
|
+
));
|
|
2173
|
+
Ro.displayName = ss.displayName;
|
|
2174
|
+
const No = p.forwardRef(({ className: e, children: r, ...t }, s) => /* @__PURE__ */ b.jsxs(
|
|
2175
|
+
os,
|
|
2176
|
+
{
|
|
2177
|
+
ref: s,
|
|
2178
|
+
className: Ee(
|
|
2179
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
2180
|
+
e
|
|
2181
|
+
),
|
|
2182
|
+
...t,
|
|
2183
|
+
children: [
|
|
2184
|
+
/* @__PURE__ */ b.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ b.jsx(Eo, { children: /* @__PURE__ */ b.jsx(Ms, { className: "h-4 w-4" }) }) }),
|
|
2185
|
+
/* @__PURE__ */ b.jsx(Fo, { children: r })
|
|
2186
|
+
]
|
|
2187
|
+
}
|
|
2188
|
+
));
|
|
2189
|
+
No.displayName = os.displayName;
|
|
2190
|
+
const Do = p.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ b.jsx(
|
|
2191
|
+
as,
|
|
2192
|
+
{
|
|
2193
|
+
ref: t,
|
|
2194
|
+
className: Ee("-mx-1 my-1 h-px bg-muted", e),
|
|
2195
|
+
...r
|
|
2196
|
+
}
|
|
2197
|
+
));
|
|
2198
|
+
Do.displayName = as.displayName;
|
|
2199
|
+
const Po = p.forwardRef(
|
|
2200
|
+
({ className: e, type: r, ...t }, s) => /* @__PURE__ */ b.jsx(
|
|
2201
|
+
"input",
|
|
2202
|
+
{
|
|
2203
|
+
type: r,
|
|
2204
|
+
className: Ee(
|
|
2205
|
+
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
2206
|
+
e
|
|
2207
|
+
),
|
|
2208
|
+
ref: s,
|
|
2209
|
+
...t
|
|
2210
|
+
}
|
|
2211
|
+
)
|
|
2212
|
+
);
|
|
2213
|
+
Po.displayName = "Input";
|
|
2214
|
+
export {
|
|
2215
|
+
Ko as C,
|
|
2216
|
+
Wo as F,
|
|
2217
|
+
Po as I,
|
|
2218
|
+
zo as S,
|
|
2219
|
+
Ho as a,
|
|
2220
|
+
To as b,
|
|
2221
|
+
Xo as c,
|
|
2222
|
+
Io as d,
|
|
2223
|
+
Yo as e,
|
|
2224
|
+
No as f,
|
|
2225
|
+
$o as g,
|
|
2226
|
+
pt as h,
|
|
2227
|
+
qo as u
|
|
2228
|
+
};
|
|
2229
|
+
//# sourceMappingURL=Input-QMLhK7Rb.js.map
|