zudoku 0.3.0-dev.57 → 0.3.0-dev.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/dist/app/entry.client.js +1 -1
  2. package/dist/app/entry.client.js.map +1 -1
  3. package/dist/app/entry.server.d.ts +2 -0
  4. package/dist/app/entry.server.js +1 -0
  5. package/dist/app/entry.server.js.map +1 -1
  6. package/dist/app/main.js +8 -2
  7. package/dist/app/main.js.map +1 -1
  8. package/dist/config/validators/validate.d.ts +121 -102
  9. package/dist/config/validators/validate.js +4 -0
  10. package/dist/config/validators/validate.js.map +1 -1
  11. package/dist/lib/authentication/AuthenticationPlugin.d.ts +16 -0
  12. package/dist/lib/authentication/AuthenticationPlugin.js +31 -0
  13. package/dist/lib/authentication/AuthenticationPlugin.js.map +1 -0
  14. package/dist/lib/authentication/authentication.d.ts +3 -4
  15. package/dist/lib/authentication/components/Login.d.ts +1 -0
  16. package/dist/lib/authentication/components/Login.js +10 -0
  17. package/dist/lib/authentication/components/Login.js.map +1 -0
  18. package/dist/lib/authentication/components/Logout.d.ts +1 -0
  19. package/dist/lib/authentication/components/Logout.js +10 -0
  20. package/dist/lib/authentication/components/Logout.js.map +1 -0
  21. package/dist/lib/authentication/providers/clerk.js +43 -27
  22. package/dist/lib/authentication/providers/clerk.js.map +1 -1
  23. package/dist/lib/authentication/providers/openid.d.ts +11 -3
  24. package/dist/lib/authentication/providers/openid.js +22 -11
  25. package/dist/lib/authentication/providers/openid.js.map +1 -1
  26. package/dist/lib/authentication/routes.d.ts +5 -0
  27. package/dist/lib/authentication/routes.js +12 -0
  28. package/dist/lib/authentication/routes.js.map +1 -0
  29. package/dist/lib/components/Bootstrap.d.ts +2 -1
  30. package/dist/lib/components/Bootstrap.js +4 -1
  31. package/dist/lib/components/Bootstrap.js.map +1 -1
  32. package/dist/lib/components/DevPortal.js +14 -2
  33. package/dist/lib/components/DevPortal.js.map +1 -1
  34. package/dist/lib/components/Header.js +16 -2
  35. package/dist/lib/components/Header.js.map +1 -1
  36. package/dist/lib/components/InlineCode.js +1 -1
  37. package/dist/lib/components/InlineCode.js.map +1 -1
  38. package/dist/lib/components/TopNavigation.js +1 -1
  39. package/dist/lib/components/TopNavigation.js.map +1 -1
  40. package/dist/lib/components/context/DevPortalProvider.js +18 -1
  41. package/dist/lib/components/context/DevPortalProvider.js.map +1 -1
  42. package/dist/lib/components/index.d.ts +5 -1
  43. package/dist/lib/components/index.js +4 -0
  44. package/dist/lib/components/index.js.map +1 -1
  45. package/dist/lib/components/navigation/SideNavigationItem.js +1 -1
  46. package/dist/lib/components/navigation/SideNavigationItem.js.map +1 -1
  47. package/dist/lib/core/DevPortalContext.d.ts +1 -1
  48. package/dist/lib/core/DevPortalContext.js.map +1 -1
  49. package/dist/lib/core/plugins.d.ts +10 -1
  50. package/dist/lib/core/plugins.js +1 -0
  51. package/dist/lib/core/plugins.js.map +1 -1
  52. package/dist/lib/plugins/api-keys/CreateApiKey.js +1 -1
  53. package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -1
  54. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +2 -2
  55. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
  56. package/dist/lib/plugins/api-keys/index.d.ts +2 -2
  57. package/dist/lib/plugins/api-keys/index.js +6 -0
  58. package/dist/lib/plugins/api-keys/index.js.map +1 -1
  59. package/dist/lib/plugins/custom-page/index.d.ts +8 -0
  60. package/dist/lib/plugins/custom-page/index.js +12 -0
  61. package/dist/lib/plugins/custom-page/index.js.map +1 -0
  62. package/dist/lib/plugins/markdown/MdxPage.js +1 -1
  63. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  64. package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
  65. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  66. package/dist/lib/plugins/openapi/ParameterList.js +1 -1
  67. package/dist/lib/plugins/openapi/ParameterList.js.map +1 -1
  68. package/dist/lib/plugins/openapi/SchemaListViewItem.js +3 -3
  69. package/dist/lib/plugins/openapi/SchemaListViewItem.js.map +1 -1
  70. package/dist/lib/plugins/openapi/SidecarBox.js +1 -1
  71. package/dist/lib/plugins/openapi/SidecarBox.js.map +1 -1
  72. package/dist/lib/plugins/openapi/StaggeredRender.d.ts +3 -0
  73. package/dist/lib/plugins/openapi/StaggeredRender.js +10 -5
  74. package/dist/lib/plugins/openapi/StaggeredRender.js.map +1 -1
  75. package/dist/lib/plugins/openapi/playground/Playground.js +2 -2
  76. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  77. package/dist/lib/ui/Card.js +1 -1
  78. package/dist/lib/ui/Card.js.map +1 -1
  79. package/dist/lib/ui/DropdownMenu.d.ts +27 -0
  80. package/dist/lib/ui/DropdownMenu.js +36 -0
  81. package/dist/lib/ui/DropdownMenu.js.map +1 -0
  82. package/dist/lib/ui/button-variants.d.ts +2 -2
  83. package/dist/lib/ui/button-variants.js +1 -0
  84. package/dist/lib/ui/button-variants.js.map +1 -1
  85. package/dist/lib/util/MdxComponents.js +1 -1
  86. package/dist/lib/util/MdxComponents.js.map +1 -1
  87. package/dist/lib/util/joinPath.js +2 -1
  88. package/dist/lib/util/joinPath.js.map +1 -1
  89. package/dist/vite/build.js +5 -2
  90. package/dist/vite/build.js.map +1 -1
  91. package/dist/vite/config.d.ts +8 -1
  92. package/dist/vite/config.js +13 -6
  93. package/dist/vite/config.js.map +1 -1
  94. package/dist/vite/plugin-component.js +1 -0
  95. package/dist/vite/plugin-component.js.map +1 -1
  96. package/dist/vite/prerender.d.ts +1 -1
  97. package/dist/vite/prerender.js +23 -3
  98. package/dist/vite/prerender.js.map +1 -1
  99. package/lib/{AnchorLink-GNsUeGSX.js → AnchorLink-Bj1hwDuD.js} +3 -3
  100. package/lib/{AnchorLink-GNsUeGSX.js.map → AnchorLink-Bj1hwDuD.js.map} +1 -1
  101. package/lib/AuthenticationPlugin-CG6Bw32B.js +46 -0
  102. package/lib/AuthenticationPlugin-CG6Bw32B.js.map +1 -0
  103. package/lib/CategoryHeading-DMkTmmBh.js +10 -0
  104. package/lib/CategoryHeading-DMkTmmBh.js.map +1 -0
  105. package/lib/Combination-lAFQBd6U.js +2774 -0
  106. package/lib/Combination-lAFQBd6U.js.map +1 -0
  107. package/lib/DevPortalProvider-BBhQ8kgI.js +1125 -0
  108. package/lib/DevPortalProvider-BBhQ8kgI.js.map +1 -0
  109. package/lib/{Markdown-DtLFdxD1.js → Markdown-BjRJKl_E.js} +1376 -1379
  110. package/lib/Markdown-BjRJKl_E.js.map +1 -0
  111. package/lib/{MdxPage-CbwYRKf5.js → MdxPage-DJTFOCbZ.js} +17 -17
  112. package/lib/{MdxPage-CbwYRKf5.js.map → MdxPage-DJTFOCbZ.js.map} +1 -1
  113. package/lib/OperationList-DDTtK3I7.js +5403 -0
  114. package/lib/OperationList-DDTtK3I7.js.map +1 -0
  115. package/lib/{Route-C1LyvITr.js → Route-Bsrd0acQ.js} +2 -2
  116. package/lib/{Route-C1LyvITr.js.map → Route-Bsrd0acQ.js.map} +1 -1
  117. package/lib/Select-CEnkyfyn.js +2223 -0
  118. package/lib/Select-CEnkyfyn.js.map +1 -0
  119. package/lib/Spinner-Ciq_pWU7.js +359 -0
  120. package/lib/Spinner-Ciq_pWU7.js.map +1 -0
  121. package/lib/{hook-Biq3zYel.js → hook-Q_gAL2NZ.js} +20 -19
  122. package/lib/{hook-Biq3zYel.js.map → hook-Q_gAL2NZ.js.map} +1 -1
  123. package/lib/{index-Bg82-bqR.js → index-BE2a6gGC.js} +24 -23
  124. package/lib/{index-Bg82-bqR.js.map → index-BE2a6gGC.js.map} +1 -1
  125. package/lib/{jsx-runtime-CJZJivg2.js → jsx-runtime-BIr0WBt_.js} +119 -119
  126. package/lib/jsx-runtime-BIr0WBt_.js.map +1 -0
  127. package/lib/{router-CBw2vqJE.js → router-BiRCp01d.js} +671 -673
  128. package/lib/router-BiRCp01d.js.map +1 -0
  129. package/lib/zudoku.auth-clerk.js +47 -32
  130. package/lib/zudoku.auth-clerk.js.map +1 -1
  131. package/lib/zudoku.auth-openid.js +170 -159
  132. package/lib/zudoku.auth-openid.js.map +1 -1
  133. package/lib/zudoku.components.js +1514 -598
  134. package/lib/zudoku.components.js.map +1 -1
  135. package/lib/zudoku.plugin-api-keys.js +30 -24
  136. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  137. package/lib/zudoku.plugin-custom-page.js +13 -0
  138. package/lib/zudoku.plugin-custom-page.js.map +1 -0
  139. package/lib/zudoku.plugin-markdown.js +19 -20
  140. package/lib/zudoku.plugin-markdown.js.map +1 -1
  141. package/lib/zudoku.plugin-openapi.js +4 -4
  142. package/lib/zudoku.plugin-redirect.js +3 -3
  143. package/package.json +29 -14
  144. package/src/app/entry.client.tsx +1 -1
  145. package/src/app/entry.server.tsx +2 -0
  146. package/src/app/main.css +6 -0
  147. package/src/app/main.tsx +8 -2
  148. package/src/lib/authentication/AuthenticationPlugin.tsx +36 -0
  149. package/src/lib/authentication/authentication.ts +3 -4
  150. package/src/lib/authentication/components/Login.tsx +11 -0
  151. package/src/lib/authentication/components/Logout.tsx +11 -0
  152. package/src/lib/authentication/providers/clerk.tsx +43 -27
  153. package/src/lib/authentication/providers/openid.tsx +25 -13
  154. package/src/lib/authentication/routes.tsx +10 -0
  155. package/src/lib/components/Bootstrap.tsx +14 -7
  156. package/src/lib/components/DevPortal.tsx +29 -9
  157. package/src/lib/components/Header.tsx +80 -30
  158. package/src/lib/components/InlineCode.tsx +1 -1
  159. package/src/lib/components/TopNavigation.tsx +1 -1
  160. package/src/lib/components/context/DevPortalProvider.ts +22 -2
  161. package/src/lib/components/index.ts +4 -0
  162. package/src/lib/components/navigation/SideNavigationItem.tsx +1 -1
  163. package/src/lib/core/DevPortalContext.ts +1 -1
  164. package/src/lib/core/plugins.ts +16 -0
  165. package/src/lib/plugins/api-keys/CreateApiKey.tsx +1 -1
  166. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +4 -4
  167. package/src/lib/plugins/api-keys/index.tsx +8 -1
  168. package/src/lib/plugins/custom-page/index.tsx +22 -0
  169. package/src/lib/plugins/markdown/MdxPage.tsx +2 -2
  170. package/src/lib/plugins/openapi/OperationListItem.tsx +1 -4
  171. package/src/lib/plugins/openapi/ParameterList.tsx +1 -1
  172. package/src/lib/plugins/openapi/SchemaListViewItem.tsx +3 -3
  173. package/src/lib/plugins/openapi/SidecarBox.tsx +1 -1
  174. package/src/lib/plugins/openapi/StaggeredRender.tsx +19 -5
  175. package/src/lib/plugins/openapi/playground/Playground.tsx +2 -2
  176. package/src/lib/ui/Card.tsx +1 -1
  177. package/src/lib/ui/DropdownMenu.tsx +199 -0
  178. package/src/lib/ui/button-variants.ts +1 -0
  179. package/src/lib/util/MdxComponents.tsx +1 -1
  180. package/src/lib/util/joinPath.tsx +2 -1
  181. package/dist/app/zudoku-manifest.d.ts +0 -1
  182. package/dist/app/zudoku-manifest.js +0 -20
  183. package/dist/app/zudoku-manifest.js.map +0 -1
  184. package/lib/Button-DpHMZvVs.js +0 -4571
  185. package/lib/Button-DpHMZvVs.js.map +0 -1
  186. package/lib/DevPortalProvider-Do9oJqme.js +0 -1081
  187. package/lib/DevPortalProvider-Do9oJqme.js.map +0 -1
  188. package/lib/Markdown-DtLFdxD1.js.map +0 -1
  189. package/lib/OperationList-DypxLtSC.js +0 -5578
  190. package/lib/OperationList-DypxLtSC.js.map +0 -1
  191. package/lib/Spinner-Bhbs5aPI.js +0 -182
  192. package/lib/Spinner-Bhbs5aPI.js.map +0 -1
  193. package/lib/index-gsAuUwQh.js +0 -418
  194. package/lib/index-gsAuUwQh.js.map +0 -1
  195. package/lib/jsx-runtime-CJZJivg2.js.map +0 -1
  196. package/lib/router-CBw2vqJE.js.map +0 -1
  197. package/lib/util-_jwUlTBU.js +0 -41
  198. package/lib/util-_jwUlTBU.js.map +0 -1
  199. package/src/app/zudoku-manifest.ts +0 -22
@@ -1,4571 +0,0 @@
1
- var sn = (e) => {
2
- throw TypeError(e);
3
- };
4
- var cr = (e, r, t) => r.has(e) || sn("Cannot " + t);
5
- var te = (e, r, t) => (cr(e, r, "read from private field"), t ? t.call(e) : r.get(e)), it = (e, r, t) => r.has(e) ? sn("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(e) : r.set(e, t), at = (e, r, t, n) => (cr(e, r, "write to private field"), n ? n.call(e, t) : r.set(e, t), t), ct = (e, r, t) => (cr(e, r, "access private method"), t);
6
- import * as h from "react";
7
- import j, { useLayoutEffect as Rs, useEffect as Ps, useState as Ts } from "react";
8
- import { h as Os, c as Br, u as le, S as Ht, b as Je, P as oe, d as ce, i as Fs, g as be, e as Wr, a as an } from "./index-gsAuUwQh.js";
9
- import { S as Ns, w as Ds, i as cn, n as Ln, q as Ms, x as ks, y as Is } from "./DevPortalProvider-Do9oJqme.js";
10
- import { j as P } from "./jsx-runtime-CJZJivg2.js";
11
- import * as Hr from "react-dom";
12
- import Vs from "react-dom";
13
- import { c as jn, e as ke, k as Ls, f as js } from "./Markdown-DtLFdxD1.js";
14
- /**
15
- * @license lucide-react v0.378.0 - ISC
16
- *
17
- * This source code is licensed under the ISC license.
18
- * See the LICENSE file in the root directory of this source tree.
19
- */
20
- const Bn = jn("ChevronDown", [
21
- ["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
22
- ]);
23
- /**
24
- * @license lucide-react v0.378.0 - ISC
25
- *
26
- * This source code is licensed under the ISC license.
27
- * See the LICENSE file in the root directory of this source tree.
28
- */
29
- const Bs = jn("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
30
- var Ue, $e, fe, De, Me, Vt, Pr, Vn, Ws = (Vn = class extends Ns {
31
- constructor(t, n) {
32
- super();
33
- it(this, Me);
34
- it(this, Ue);
35
- it(this, $e);
36
- it(this, fe);
37
- it(this, De);
38
- at(this, Ue, t), this.setOptions(n), this.bindMethods(), ct(this, Me, Vt).call(this);
39
- }
40
- bindMethods() {
41
- this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
42
- }
43
- setOptions(t) {
44
- var o;
45
- const n = this.options;
46
- this.options = te(this, Ue).defaultMutationOptions(t), Ds(this.options, n) || te(this, Ue).getMutationCache().notify({
47
- type: "observerOptionsUpdated",
48
- mutation: te(this, fe),
49
- observer: this
50
- }), n != null && n.mutationKey && this.options.mutationKey && cn(n.mutationKey) !== cn(this.options.mutationKey) ? this.reset() : ((o = te(this, fe)) == null ? void 0 : o.state.status) === "pending" && te(this, fe).setOptions(this.options);
51
- }
52
- onUnsubscribe() {
53
- var t;
54
- this.hasListeners() || (t = te(this, fe)) == null || t.removeObserver(this);
55
- }
56
- onMutationUpdate(t) {
57
- ct(this, Me, Vt).call(this), ct(this, Me, Pr).call(this, t);
58
- }
59
- getCurrentResult() {
60
- return te(this, $e);
61
- }
62
- reset() {
63
- var t;
64
- (t = te(this, fe)) == null || t.removeObserver(this), at(this, fe, void 0), ct(this, Me, Vt).call(this), ct(this, Me, Pr).call(this);
65
- }
66
- mutate(t, n) {
67
- var o;
68
- return at(this, De, n), (o = te(this, fe)) == null || o.removeObserver(this), at(this, fe, te(this, Ue).getMutationCache().build(te(this, Ue), this.options)), te(this, fe).addObserver(this), te(this, fe).execute(t);
69
- }
70
- }, Ue = new WeakMap(), $e = new WeakMap(), fe = new WeakMap(), De = new WeakMap(), Me = new WeakSet(), Vt = function() {
71
- var n;
72
- const t = ((n = te(this, fe)) == null ? void 0 : n.state) ?? Os();
73
- at(this, $e, {
74
- ...t,
75
- isPending: t.status === "pending",
76
- isSuccess: t.status === "success",
77
- isError: t.status === "error",
78
- isIdle: t.status === "idle",
79
- mutate: this.mutate,
80
- reset: this.reset
81
- });
82
- }, Pr = function(t) {
83
- Ln.batch(() => {
84
- var n, o, s, i, a, c, u, f;
85
- if (te(this, De) && this.hasListeners()) {
86
- const d = te(this, $e).variables, g = te(this, $e).context;
87
- (t == null ? void 0 : t.type) === "success" ? ((o = (n = te(this, De)).onSuccess) == null || o.call(n, t.data, d, g), (i = (s = te(this, De)).onSettled) == null || i.call(s, t.data, null, d, g)) : (t == null ? void 0 : t.type) === "error" && ((c = (a = te(this, De)).onError) == null || c.call(a, t.error, d, g), (f = (u = te(this, De)).onSettled) == null || f.call(
88
- u,
89
- void 0,
90
- t.error,
91
- d,
92
- g
93
- ));
94
- }
95
- this.listeners.forEach((d) => {
96
- d(te(this, $e));
97
- });
98
- });
99
- }, Vn);
100
- function nl(e, r) {
101
- const t = Ms(), [n] = h.useState(
102
- () => new Ws(
103
- t,
104
- e
105
- )
106
- );
107
- h.useEffect(() => {
108
- n.setOptions(e);
109
- }, [n, e]);
110
- const o = h.useSyncExternalStore(
111
- h.useCallback(
112
- (i) => n.subscribe(Ln.batchCalls(i)),
113
- [n]
114
- ),
115
- () => n.getCurrentResult(),
116
- () => n.getCurrentResult()
117
- ), s = h.useCallback(
118
- (i, a) => {
119
- n.mutate(i, a).catch(ks);
120
- },
121
- [n]
122
- );
123
- if (o.error && Is(n.options.throwOnError, [o.error]))
124
- throw o.error;
125
- return { ...o, mutate: s, mutateAsync: o.mutate };
126
- }
127
- var Rt = (e) => e.type === "checkbox", ht = (e) => e instanceof Date, de = (e) => e == null;
128
- const Wn = (e) => typeof e == "object";
129
- var ae = (e) => !de(e) && !Array.isArray(e) && Wn(e) && !ht(e), Hn = (e) => ae(e) && e.target ? Rt(e.target) ? e.target.checked : e.target.value : e, Hs = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Un = (e, r) => e.has(Hs(r)), Us = (e) => {
130
- const r = e.constructor && e.constructor.prototype;
131
- return ae(r) && r.hasOwnProperty("isPrototypeOf");
132
- }, Ur = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
133
- function ie(e) {
134
- let r;
135
- const t = Array.isArray(e);
136
- if (e instanceof Date)
137
- r = new Date(e);
138
- else if (e instanceof Set)
139
- r = new Set(e);
140
- else if (!(Ur && (e instanceof Blob || e instanceof FileList)) && (t || ae(e)))
141
- if (r = t ? [] : {}, !t && !Us(e))
142
- r = e;
143
- else
144
- for (const n in e)
145
- e.hasOwnProperty(n) && (r[n] = ie(e[n]));
146
- else
147
- return e;
148
- return r;
149
- }
150
- var Pt = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Q = (e) => e === void 0, O = (e, r, t) => {
151
- if (!r || !ae(e))
152
- return t;
153
- const n = Pt(r.split(/[,[\].]+?/)).reduce((o, s) => de(o) ? o : o[s], e);
154
- return Q(n) || n === e ? Q(e[r]) ? t : e[r] : n;
155
- }, _e = (e) => typeof e == "boolean", $r = (e) => /^\w*$/.test(e), $n = (e) => Pt(e.replace(/["|']|\]/g, "").split(/\.|\[/)), G = (e, r, t) => {
156
- let n = -1;
157
- const o = $r(r) ? [r] : $n(r), s = o.length, i = s - 1;
158
- for (; ++n < s; ) {
159
- const a = o[n];
160
- let c = t;
161
- if (n !== i) {
162
- const u = e[a];
163
- c = ae(u) || Array.isArray(u) ? u : isNaN(+o[n + 1]) ? {} : [];
164
- }
165
- if (a === "__proto__")
166
- return;
167
- e[a] = c, e = e[a];
168
- }
169
- return e;
170
- };
171
- const Ut = {
172
- BLUR: "blur",
173
- FOCUS_OUT: "focusout",
174
- CHANGE: "change"
175
- }, xe = {
176
- onBlur: "onBlur",
177
- onChange: "onChange",
178
- onSubmit: "onSubmit",
179
- onTouched: "onTouched",
180
- all: "all"
181
- }, Fe = {
182
- max: "max",
183
- min: "min",
184
- maxLength: "maxLength",
185
- minLength: "minLength",
186
- pattern: "pattern",
187
- required: "required",
188
- validate: "validate"
189
- }, zn = j.createContext(null), Jt = () => j.useContext(zn), ol = (e) => {
190
- const { children: r, ...t } = e;
191
- return j.createElement(zn.Provider, { value: t }, r);
192
- };
193
- var Kn = (e, r, t, n = !0) => {
194
- const o = {
195
- defaultValues: r._defaultValues
196
- };
197
- for (const s in e)
198
- Object.defineProperty(o, s, {
199
- get: () => {
200
- const i = s;
201
- return r._proxyFormState[i] !== xe.all && (r._proxyFormState[i] = !n || xe.all), t && (t[i] = !0), e[i];
202
- }
203
- });
204
- return o;
205
- }, he = (e) => ae(e) && !Object.keys(e).length, Yn = (e, r, t, n) => {
206
- t(e);
207
- const { name: o, ...s } = e;
208
- return he(s) || Object.keys(s).length >= Object.keys(r).length || Object.keys(s).find((i) => r[i] === (!n || xe.all));
209
- }, pe = (e) => Array.isArray(e) ? e : [e], qn = (e, r, t) => !e || !r || e === r || pe(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n)));
210
- function er(e) {
211
- const r = j.useRef(e);
212
- r.current = e, j.useEffect(() => {
213
- const t = !e.disabled && r.current.subject && r.current.subject.subscribe({
214
- next: r.current.next
215
- });
216
- return () => {
217
- t && t.unsubscribe();
218
- };
219
- }, [e.disabled]);
220
- }
221
- function $s(e) {
222
- const r = Jt(), { control: t = r.control, disabled: n, name: o, exact: s } = e || {}, [i, a] = j.useState(t._formState), c = j.useRef(!0), u = j.useRef({
223
- isDirty: !1,
224
- isLoading: !1,
225
- dirtyFields: !1,
226
- touchedFields: !1,
227
- validatingFields: !1,
228
- isValidating: !1,
229
- isValid: !1,
230
- errors: !1
231
- }), f = j.useRef(o);
232
- return f.current = o, er({
233
- disabled: n,
234
- next: (d) => c.current && qn(f.current, d.name, s) && Yn(d, u.current, t._updateFormState) && a({
235
- ...t._formState,
236
- ...d
237
- }),
238
- subject: t._subjects.state
239
- }), j.useEffect(() => (c.current = !0, u.current.isValid && t._updateValid(!0), () => {
240
- c.current = !1;
241
- }), [t]), Kn(i, t, u.current, !1);
242
- }
243
- var Pe = (e) => typeof e == "string", Xn = (e, r, t, n, o) => Pe(e) ? (n && r.watch.add(e), O(t, e, o)) : Array.isArray(e) ? e.map((s) => (n && r.watch.add(s), O(t, s))) : (n && (r.watchAll = !0), t);
244
- function zs(e) {
245
- const r = Jt(), { control: t = r.control, name: n, defaultValue: o, disabled: s, exact: i } = e || {}, a = j.useRef(n);
246
- a.current = n, er({
247
- disabled: s,
248
- subject: t._subjects.values,
249
- next: (f) => {
250
- qn(a.current, f.name, i) && u(ie(Xn(a.current, t._names, f.values || t._formValues, !1, o)));
251
- }
252
- });
253
- const [c, u] = j.useState(t._getWatch(n, o));
254
- return j.useEffect(() => t._removeUnmounted()), c;
255
- }
256
- function Ks(e) {
257
- const r = Jt(), { name: t, disabled: n, control: o = r.control, shouldUnregister: s } = e, i = Un(o._names.array, t), a = zs({
258
- control: o,
259
- name: t,
260
- defaultValue: O(o._formValues, t, O(o._defaultValues, t, e.defaultValue)),
261
- exact: !0
262
- }), c = $s({
263
- control: o,
264
- name: t
265
- }), u = j.useRef(o.register(t, {
266
- ...e.rules,
267
- value: a,
268
- ..._e(e.disabled) ? { disabled: e.disabled } : {}
269
- }));
270
- return j.useEffect(() => {
271
- const f = o._options.shouldUnregister || s, d = (g, x) => {
272
- const y = O(o._fields, g);
273
- y && y._f && (y._f.mount = x);
274
- };
275
- if (d(t, !0), f) {
276
- const g = ie(O(o._options.defaultValues, t));
277
- G(o._defaultValues, t, g), Q(O(o._formValues, t)) && G(o._formValues, t, g);
278
- }
279
- return () => {
280
- (i ? f && !o._state.action : f) ? o.unregister(t) : d(t, !1);
281
- };
282
- }, [t, o, i, s]), j.useEffect(() => {
283
- O(o._fields, t) && o._updateDisabledField({
284
- disabled: n,
285
- fields: o._fields,
286
- name: t,
287
- value: O(o._fields, t)._f.value
288
- });
289
- }, [n, t, o]), {
290
- field: {
291
- name: t,
292
- value: a,
293
- ..._e(n) || c.disabled ? { disabled: c.disabled || n } : {},
294
- onChange: j.useCallback((f) => u.current.onChange({
295
- target: {
296
- value: Hn(f),
297
- name: t
298
- },
299
- type: Ut.CHANGE
300
- }), [t]),
301
- onBlur: j.useCallback(() => u.current.onBlur({
302
- target: {
303
- value: O(o._formValues, t),
304
- name: t
305
- },
306
- type: Ut.BLUR
307
- }), [t, o]),
308
- ref: (f) => {
309
- const d = O(o._fields, t);
310
- d && f && (d._f.ref = {
311
- focus: () => f.focus(),
312
- select: () => f.select(),
313
- setCustomValidity: (g) => f.setCustomValidity(g),
314
- reportValidity: () => f.reportValidity()
315
- });
316
- }
317
- },
318
- formState: c,
319
- fieldState: Object.defineProperties({}, {
320
- invalid: {
321
- enumerable: !0,
322
- get: () => !!O(c.errors, t)
323
- },
324
- isDirty: {
325
- enumerable: !0,
326
- get: () => !!O(c.dirtyFields, t)
327
- },
328
- isTouched: {
329
- enumerable: !0,
330
- get: () => !!O(c.touchedFields, t)
331
- },
332
- isValidating: {
333
- enumerable: !0,
334
- get: () => !!O(c.validatingFields, t)
335
- },
336
- error: {
337
- enumerable: !0,
338
- get: () => O(c.errors, t)
339
- }
340
- })
341
- };
342
- }
343
- const sl = (e) => e.render(Ks(e));
344
- var Ys = (e, r, t, n, o) => r ? {
345
- ...t[e],
346
- types: {
347
- ...t[e] && t[e].types ? t[e].types : {},
348
- [n]: o || !0
349
- }
350
- } : {}, We = () => {
351
- const e = typeof performance > "u" ? Date.now() : performance.now() * 1e3;
352
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
353
- const t = (Math.random() * 16 + e) % 16 | 0;
354
- return (r == "x" ? t : t & 3 | 8).toString(16);
355
- });
356
- }, lr = (e, r, t = {}) => t.shouldFocus || Q(t.shouldFocus) ? t.focusName || `${e}.${Q(t.focusIndex) ? r : t.focusIndex}.` : "", Ct = (e) => ({
357
- isOnSubmit: !e || e === xe.onSubmit,
358
- isOnBlur: e === xe.onBlur,
359
- isOnChange: e === xe.onChange,
360
- isOnAll: e === xe.all,
361
- isOnTouch: e === xe.onTouched
362
- }), Tr = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
363
- const pt = (e, r, t, n) => {
364
- for (const o of t || Object.keys(e)) {
365
- const s = O(e, o);
366
- if (s) {
367
- const { _f: i, ...a } = s;
368
- if (i) {
369
- if (i.refs && i.refs[0] && r(i.refs[0], o) && !n)
370
- break;
371
- if (i.ref && r(i.ref, i.name) && !n)
372
- break;
373
- pt(a, r);
374
- } else ae(a) && pt(a, r);
375
- }
376
- }
377
- };
378
- var Gn = (e, r, t) => {
379
- const n = pe(O(e, t));
380
- return G(n, "root", r[t]), G(e, t, n), e;
381
- }, zr = (e) => e.type === "file", ze = (e) => typeof e == "function", $t = (e) => {
382
- if (!Ur)
383
- return !1;
384
- const r = e ? e.ownerDocument : 0;
385
- return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
386
- }, Lt = (e) => Pe(e), Kr = (e) => e.type === "radio", zt = (e) => e instanceof RegExp;
387
- const ln = {
388
- value: !1,
389
- isValid: !1
390
- }, un = { value: !0, isValid: !0 };
391
- var Zn = (e) => {
392
- if (Array.isArray(e)) {
393
- if (e.length > 1) {
394
- const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
395
- return { value: r, isValid: !!r.length };
396
- }
397
- return e[0].checked && !e[0].disabled ? (
398
- // @ts-expect-error expected to work in the browser
399
- e[0].attributes && !Q(e[0].attributes.value) ? Q(e[0].value) || e[0].value === "" ? un : { value: e[0].value, isValid: !0 } : un
400
- ) : ln;
401
- }
402
- return ln;
403
- };
404
- const dn = {
405
- isValid: !1,
406
- value: null
407
- };
408
- var Qn = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
409
- isValid: !0,
410
- value: t.value
411
- } : r, dn) : dn;
412
- function fn(e, r, t = "validate") {
413
- if (Lt(e) || Array.isArray(e) && e.every(Lt) || _e(e) && !e)
414
- return {
415
- type: t,
416
- message: Lt(e) ? e : "",
417
- ref: r
418
- };
419
- }
420
- var lt = (e) => ae(e) && !zt(e) ? e : {
421
- value: e,
422
- message: ""
423
- }, Or = async (e, r, t, n, o) => {
424
- const { ref: s, refs: i, required: a, maxLength: c, minLength: u, min: f, max: d, pattern: g, validate: x, name: y, valueAsNumber: p, mount: S, disabled: b } = e._f, v = O(r, y);
425
- if (!S || b)
426
- return {};
427
- const C = i ? i[0] : s, R = (D) => {
428
- n && C.reportValidity && (C.setCustomValidity(_e(D) ? "" : D || ""), C.reportValidity());
429
- }, w = {}, A = Kr(s), _ = Rt(s), M = A || _, H = (p || zr(s)) && Q(s.value) && Q(v) || $t(s) && s.value === "" || v === "" || Array.isArray(v) && !v.length, U = Ys.bind(null, y, t, w), J = (D, I, B, V = Fe.maxLength, $ = Fe.minLength) => {
430
- const L = D ? I : B;
431
- w[y] = {
432
- type: D ? V : $,
433
- message: L,
434
- ref: s,
435
- ...U(D ? V : $, L)
436
- };
437
- };
438
- if (o ? !Array.isArray(v) || !v.length : a && (!M && (H || de(v)) || _e(v) && !v || _ && !Zn(i).isValid || A && !Qn(i).isValid)) {
439
- const { value: D, message: I } = Lt(a) ? { value: !!a, message: a } : lt(a);
440
- if (D && (w[y] = {
441
- type: Fe.required,
442
- message: I,
443
- ref: C,
444
- ...U(Fe.required, I)
445
- }, !t))
446
- return R(I), w;
447
- }
448
- if (!H && (!de(f) || !de(d))) {
449
- let D, I;
450
- const B = lt(d), V = lt(f);
451
- if (!de(v) && !isNaN(v)) {
452
- const $ = s.valueAsNumber || v && +v;
453
- de(B.value) || (D = $ > B.value), de(V.value) || (I = $ < V.value);
454
- } else {
455
- const $ = s.valueAsDate || new Date(v), L = (Se) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Se), Z = s.type == "time", ee = s.type == "week";
456
- Pe(B.value) && v && (D = Z ? L(v) > L(B.value) : ee ? v > B.value : $ > new Date(B.value)), Pe(V.value) && v && (I = Z ? L(v) < L(V.value) : ee ? v < V.value : $ < new Date(V.value));
457
- }
458
- if ((D || I) && (J(!!D, B.message, V.message, Fe.max, Fe.min), !t))
459
- return R(w[y].message), w;
460
- }
461
- if ((c || u) && !H && (Pe(v) || o && Array.isArray(v))) {
462
- const D = lt(c), I = lt(u), B = !de(D.value) && v.length > +D.value, V = !de(I.value) && v.length < +I.value;
463
- if ((B || V) && (J(B, D.message, I.message), !t))
464
- return R(w[y].message), w;
465
- }
466
- if (g && !H && Pe(v)) {
467
- const { value: D, message: I } = lt(g);
468
- if (zt(D) && !v.match(D) && (w[y] = {
469
- type: Fe.pattern,
470
- message: I,
471
- ref: s,
472
- ...U(Fe.pattern, I)
473
- }, !t))
474
- return R(I), w;
475
- }
476
- if (x) {
477
- if (ze(x)) {
478
- const D = await x(v, r), I = fn(D, C);
479
- if (I && (w[y] = {
480
- ...I,
481
- ...U(Fe.validate, I.message)
482
- }, !t))
483
- return R(I.message), w;
484
- } else if (ae(x)) {
485
- let D = {};
486
- for (const I in x) {
487
- if (!he(D) && !t)
488
- break;
489
- const B = fn(await x[I](v, r), C, I);
490
- B && (D = {
491
- ...B,
492
- ...U(I, B.message)
493
- }, R(B.message), t && (w[y] = D));
494
- }
495
- if (!he(D) && (w[y] = {
496
- ref: C,
497
- ...D
498
- }, !t))
499
- return w;
500
- }
501
- }
502
- return R(!0), w;
503
- }, ur = (e, r) => [
504
- ...e,
505
- ...pe(r)
506
- ], dr = (e) => Array.isArray(e) ? e.map(() => {
507
- }) : void 0;
508
- function fr(e, r, t) {
509
- return [
510
- ...e.slice(0, r),
511
- ...pe(t),
512
- ...e.slice(r)
513
- ];
514
- }
515
- var hr = (e, r, t) => Array.isArray(e) ? (Q(e[t]) && (e[t] = void 0), e.splice(t, 0, e.splice(r, 1)[0]), e) : [], pr = (e, r) => [
516
- ...pe(r),
517
- ...pe(e)
518
- ];
519
- function qs(e, r) {
520
- let t = 0;
521
- const n = [...e];
522
- for (const o of r)
523
- n.splice(o - t, 1), t++;
524
- return Pt(n).length ? n : [];
525
- }
526
- var mr = (e, r) => Q(r) ? [] : qs(e, pe(r).sort((t, n) => t - n)), vr = (e, r, t) => {
527
- [e[r], e[t]] = [e[t], e[r]];
528
- };
529
- function Xs(e, r) {
530
- const t = r.slice(0, -1).length;
531
- let n = 0;
532
- for (; n < t; )
533
- e = Q(e) ? n++ : e[r[n++]];
534
- return e;
535
- }
536
- function Gs(e) {
537
- for (const r in e)
538
- if (e.hasOwnProperty(r) && !Q(e[r]))
539
- return !1;
540
- return !0;
541
- }
542
- function ne(e, r) {
543
- const t = Array.isArray(r) ? r : $r(r) ? [r] : $n(r), n = t.length === 1 ? e : Xs(e, t), o = t.length - 1, s = t[o];
544
- return n && delete n[s], o !== 0 && (ae(n) && he(n) || Array.isArray(n) && Gs(n)) && ne(e, t.slice(0, -1)), e;
545
- }
546
- var hn = (e, r, t) => (e[r] = t, e);
547
- function il(e) {
548
- const r = Jt(), { control: t = r.control, name: n, keyName: o = "id", shouldUnregister: s } = e, [i, a] = j.useState(t._getFieldArray(n)), c = j.useRef(t._getFieldArray(n).map(We)), u = j.useRef(i), f = j.useRef(n), d = j.useRef(!1);
549
- f.current = n, u.current = i, t._names.array.add(n), e.rules && t.register(n, e.rules), er({
550
- next: ({ values: w, name: A }) => {
551
- if (A === f.current || !A) {
552
- const _ = O(w, f.current);
553
- Array.isArray(_) && (a(_), c.current = _.map(We));
554
- }
555
- },
556
- subject: t._subjects.array
557
- });
558
- const g = j.useCallback((w) => {
559
- d.current = !0, t._updateFieldArray(n, w);
560
- }, [t, n]), x = (w, A) => {
561
- const _ = pe(ie(w)), M = ur(t._getFieldArray(n), _);
562
- t._names.focus = lr(n, M.length - 1, A), c.current = ur(c.current, _.map(We)), g(M), a(M), t._updateFieldArray(n, M, ur, {
563
- argA: dr(w)
564
- });
565
- }, y = (w, A) => {
566
- const _ = pe(ie(w)), M = pr(t._getFieldArray(n), _);
567
- t._names.focus = lr(n, 0, A), c.current = pr(c.current, _.map(We)), g(M), a(M), t._updateFieldArray(n, M, pr, {
568
- argA: dr(w)
569
- });
570
- }, p = (w) => {
571
- const A = mr(t._getFieldArray(n), w);
572
- c.current = mr(c.current, w), g(A), a(A), t._updateFieldArray(n, A, mr, {
573
- argA: w
574
- });
575
- }, S = (w, A, _) => {
576
- const M = pe(ie(A)), H = fr(t._getFieldArray(n), w, M);
577
- t._names.focus = lr(n, w, _), c.current = fr(c.current, w, M.map(We)), g(H), a(H), t._updateFieldArray(n, H, fr, {
578
- argA: w,
579
- argB: dr(A)
580
- });
581
- }, b = (w, A) => {
582
- const _ = t._getFieldArray(n);
583
- vr(_, w, A), vr(c.current, w, A), g(_), a(_), t._updateFieldArray(n, _, vr, {
584
- argA: w,
585
- argB: A
586
- }, !1);
587
- }, v = (w, A) => {
588
- const _ = t._getFieldArray(n);
589
- hr(_, w, A), hr(c.current, w, A), g(_), a(_), t._updateFieldArray(n, _, hr, {
590
- argA: w,
591
- argB: A
592
- }, !1);
593
- }, C = (w, A) => {
594
- const _ = ie(A), M = hn(t._getFieldArray(n), w, _);
595
- c.current = [...M].map((H, U) => !H || U === w ? We() : c.current[U]), g(M), a([...M]), t._updateFieldArray(n, M, hn, {
596
- argA: w,
597
- argB: _
598
- }, !0, !1);
599
- }, R = (w) => {
600
- const A = pe(ie(w));
601
- c.current = A.map(We), g([...A]), a([...A]), t._updateFieldArray(n, [...A], (_) => _, {}, !0, !1);
602
- };
603
- return j.useEffect(() => {
604
- if (t._state.action = !1, Tr(n, t._names) && t._subjects.state.next({
605
- ...t._formState
606
- }), d.current && (!Ct(t._options.mode).isOnSubmit || t._formState.isSubmitted))
607
- if (t._options.resolver)
608
- t._executeSchema([n]).then((w) => {
609
- const A = O(w.errors, n), _ = O(t._formState.errors, n);
610
- (_ ? !A && _.type || A && (_.type !== A.type || _.message !== A.message) : A && A.type) && (A ? G(t._formState.errors, n, A) : ne(t._formState.errors, n), t._subjects.state.next({
611
- errors: t._formState.errors
612
- }));
613
- });
614
- else {
615
- const w = O(t._fields, n);
616
- w && w._f && !(Ct(t._options.reValidateMode).isOnSubmit && Ct(t._options.mode).isOnSubmit) && Or(w, t._formValues, t._options.criteriaMode === xe.all, t._options.shouldUseNativeValidation, !0).then((A) => !he(A) && t._subjects.state.next({
617
- errors: Gn(t._formState.errors, A, n)
618
- }));
619
- }
620
- t._subjects.values.next({
621
- name: n,
622
- values: { ...t._formValues }
623
- }), t._names.focus && pt(t._fields, (w, A) => {
624
- if (t._names.focus && A.startsWith(t._names.focus) && w.focus)
625
- return w.focus(), 1;
626
- }), t._names.focus = "", t._updateValid(), d.current = !1;
627
- }, [i, n, t]), j.useEffect(() => (!O(t._formValues, n) && t._updateFieldArray(n), () => {
628
- (t._options.shouldUnregister || s) && t.unregister(n);
629
- }), [n, t, o, s]), {
630
- swap: j.useCallback(b, [g, n, t]),
631
- move: j.useCallback(v, [g, n, t]),
632
- prepend: j.useCallback(y, [g, n, t]),
633
- append: j.useCallback(x, [g, n, t]),
634
- remove: j.useCallback(p, [g, n, t]),
635
- insert: j.useCallback(S, [g, n, t]),
636
- update: j.useCallback(C, [g, n, t]),
637
- replace: j.useCallback(R, [g, n, t]),
638
- fields: j.useMemo(() => i.map((w, A) => ({
639
- ...w,
640
- [o]: c.current[A] || We()
641
- })), [i, o])
642
- };
643
- }
644
- var gr = () => {
645
- let e = [];
646
- return {
647
- get observers() {
648
- return e;
649
- },
650
- next: (o) => {
651
- for (const s of e)
652
- s.next && s.next(o);
653
- },
654
- subscribe: (o) => (e.push(o), {
655
- unsubscribe: () => {
656
- e = e.filter((s) => s !== o);
657
- }
658
- }),
659
- unsubscribe: () => {
660
- e = [];
661
- }
662
- };
663
- }, Kt = (e) => de(e) || !Wn(e);
664
- function Qe(e, r) {
665
- if (Kt(e) || Kt(r))
666
- return e === r;
667
- if (ht(e) && ht(r))
668
- return e.getTime() === r.getTime();
669
- const t = Object.keys(e), n = Object.keys(r);
670
- if (t.length !== n.length)
671
- return !1;
672
- for (const o of t) {
673
- const s = e[o];
674
- if (!n.includes(o))
675
- return !1;
676
- if (o !== "ref") {
677
- const i = r[o];
678
- if (ht(s) && ht(i) || ae(s) && ae(i) || Array.isArray(s) && Array.isArray(i) ? !Qe(s, i) : s !== i)
679
- return !1;
680
- }
681
- }
682
- return !0;
683
- }
684
- var Jn = (e) => e.type === "select-multiple", Zs = (e) => Kr(e) || Rt(e), yr = (e) => $t(e) && e.isConnected, eo = (e) => {
685
- for (const r in e)
686
- if (ze(e[r]))
687
- return !0;
688
- return !1;
689
- };
690
- function Yt(e, r = {}) {
691
- const t = Array.isArray(e);
692
- if (ae(e) || t)
693
- for (const n in e)
694
- Array.isArray(e[n]) || ae(e[n]) && !eo(e[n]) ? (r[n] = Array.isArray(e[n]) ? [] : {}, Yt(e[n], r[n])) : de(e[n]) || (r[n] = !0);
695
- return r;
696
- }
697
- function to(e, r, t) {
698
- const n = Array.isArray(e);
699
- if (ae(e) || n)
700
- for (const o in e)
701
- Array.isArray(e[o]) || ae(e[o]) && !eo(e[o]) ? Q(r) || Kt(t[o]) ? t[o] = Array.isArray(e[o]) ? Yt(e[o], []) : { ...Yt(e[o]) } : to(e[o], de(r) ? {} : r[o], t[o]) : t[o] = !Qe(e[o], r[o]);
702
- return t;
703
- }
704
- var Ft = (e, r) => to(e, r, Yt(r)), ro = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => Q(e) ? e : r ? e === "" ? NaN : e && +e : t && Pe(e) ? new Date(e) : n ? n(e) : e;
705
- function wr(e) {
706
- const r = e.ref;
707
- if (!(e.refs ? e.refs.every((t) => t.disabled) : r.disabled))
708
- return zr(r) ? r.files : Kr(r) ? Qn(e.refs).value : Jn(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Rt(r) ? Zn(e.refs).value : ro(Q(r.value) ? e.ref.value : r.value, e);
709
- }
710
- var Qs = (e, r, t, n) => {
711
- const o = {};
712
- for (const s of e) {
713
- const i = O(r, s);
714
- i && G(o, s, i._f);
715
- }
716
- return {
717
- criteriaMode: t,
718
- names: [...e],
719
- fields: o,
720
- shouldUseNativeValidation: n
721
- };
722
- }, St = (e) => Q(e) ? e : zt(e) ? e.source : ae(e) ? zt(e.value) ? e.value.source : e.value : e, Js = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
723
- function pn(e, r, t) {
724
- const n = O(e, t);
725
- if (n || $r(t))
726
- return {
727
- error: n,
728
- name: t
729
- };
730
- const o = t.split(".");
731
- for (; o.length; ) {
732
- const s = o.join("."), i = O(r, s), a = O(e, s);
733
- if (i && !Array.isArray(i) && t !== s)
734
- return { name: t };
735
- if (a && a.type)
736
- return {
737
- name: s,
738
- error: a
739
- };
740
- o.pop();
741
- }
742
- return {
743
- name: t
744
- };
745
- }
746
- var ei = (e, r, t, n, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(r || e) : (t ? n.isOnBlur : o.isOnBlur) ? !e : (t ? n.isOnChange : o.isOnChange) ? e : !0, ti = (e, r) => !Pt(O(e, r)).length && ne(e, r);
747
- const ri = {
748
- mode: xe.onSubmit,
749
- reValidateMode: xe.onChange,
750
- shouldFocusError: !0
751
- };
752
- function ni(e = {}) {
753
- let r = {
754
- ...ri,
755
- ...e
756
- }, t = {
757
- submitCount: 0,
758
- isDirty: !1,
759
- isLoading: ze(r.defaultValues),
760
- isValidating: !1,
761
- isSubmitted: !1,
762
- isSubmitting: !1,
763
- isSubmitSuccessful: !1,
764
- isValid: !1,
765
- touchedFields: {},
766
- dirtyFields: {},
767
- validatingFields: {},
768
- errors: r.errors || {},
769
- disabled: r.disabled || !1
770
- }, n = {}, o = ae(r.defaultValues) || ae(r.values) ? ie(r.defaultValues || r.values) || {} : {}, s = r.shouldUnregister ? {} : ie(o), i = {
771
- action: !1,
772
- mount: !1,
773
- watch: !1
774
- }, a = {
775
- mount: /* @__PURE__ */ new Set(),
776
- unMount: /* @__PURE__ */ new Set(),
777
- array: /* @__PURE__ */ new Set(),
778
- watch: /* @__PURE__ */ new Set()
779
- }, c, u = 0;
780
- const f = {
781
- isDirty: !1,
782
- dirtyFields: !1,
783
- validatingFields: !1,
784
- touchedFields: !1,
785
- isValidating: !1,
786
- isValid: !1,
787
- errors: !1
788
- }, d = {
789
- values: gr(),
790
- array: gr(),
791
- state: gr()
792
- }, g = Ct(r.mode), x = Ct(r.reValidateMode), y = r.criteriaMode === xe.all, p = (l) => (m) => {
793
- clearTimeout(u), u = setTimeout(l, m);
794
- }, S = async (l) => {
795
- if (f.isValid || l) {
796
- const m = r.resolver ? he((await M()).errors) : await U(n, !0);
797
- m !== t.isValid && d.state.next({
798
- isValid: m
799
- });
800
- }
801
- }, b = (l, m) => {
802
- (f.isValidating || f.validatingFields) && ((l || Array.from(a.mount)).forEach((E) => {
803
- E && (m ? G(t.validatingFields, E, m) : ne(t.validatingFields, E));
804
- }), d.state.next({
805
- validatingFields: t.validatingFields,
806
- isValidating: !he(t.validatingFields)
807
- }));
808
- }, v = (l, m = [], E, N, F = !0, T = !0) => {
809
- if (N && E) {
810
- if (i.action = !0, T && Array.isArray(O(n, l))) {
811
- const k = E(O(n, l), N.argA, N.argB);
812
- F && G(n, l, k);
813
- }
814
- if (T && Array.isArray(O(t.errors, l))) {
815
- const k = E(O(t.errors, l), N.argA, N.argB);
816
- F && G(t.errors, l, k), ti(t.errors, l);
817
- }
818
- if (f.touchedFields && T && Array.isArray(O(t.touchedFields, l))) {
819
- const k = E(O(t.touchedFields, l), N.argA, N.argB);
820
- F && G(t.touchedFields, l, k);
821
- }
822
- f.dirtyFields && (t.dirtyFields = Ft(o, s)), d.state.next({
823
- name: l,
824
- isDirty: D(l, m),
825
- dirtyFields: t.dirtyFields,
826
- errors: t.errors,
827
- isValid: t.isValid
828
- });
829
- } else
830
- G(s, l, m);
831
- }, C = (l, m) => {
832
- G(t.errors, l, m), d.state.next({
833
- errors: t.errors
834
- });
835
- }, R = (l) => {
836
- t.errors = l, d.state.next({
837
- errors: t.errors,
838
- isValid: !1
839
- });
840
- }, w = (l, m, E, N) => {
841
- const F = O(n, l);
842
- if (F) {
843
- const T = O(s, l, Q(E) ? O(o, l) : E);
844
- Q(T) || N && N.defaultChecked || m ? G(s, l, m ? T : wr(F._f)) : V(l, T), i.mount && S();
845
- }
846
- }, A = (l, m, E, N, F) => {
847
- let T = !1, k = !1;
848
- const Y = {
849
- name: l
850
- }, re = !!(O(n, l) && O(n, l)._f && O(n, l)._f.disabled);
851
- if (!E || N) {
852
- f.isDirty && (k = t.isDirty, t.isDirty = Y.isDirty = D(), T = k !== Y.isDirty);
853
- const ve = re || Qe(O(o, l), m);
854
- k = !!(!re && O(t.dirtyFields, l)), ve || re ? ne(t.dirtyFields, l) : G(t.dirtyFields, l, !0), Y.dirtyFields = t.dirtyFields, T = T || f.dirtyFields && k !== !ve;
855
- }
856
- if (E) {
857
- const ve = O(t.touchedFields, l);
858
- ve || (G(t.touchedFields, l, E), Y.touchedFields = t.touchedFields, T = T || f.touchedFields && ve !== E);
859
- }
860
- return T && F && d.state.next(Y), T ? Y : {};
861
- }, _ = (l, m, E, N) => {
862
- const F = O(t.errors, l), T = f.isValid && _e(m) && t.isValid !== m;
863
- if (e.delayError && E ? (c = p(() => C(l, E)), c(e.delayError)) : (clearTimeout(u), c = null, E ? G(t.errors, l, E) : ne(t.errors, l)), (E ? !Qe(F, E) : F) || !he(N) || T) {
864
- const k = {
865
- ...N,
866
- ...T && _e(m) ? { isValid: m } : {},
867
- errors: t.errors,
868
- name: l
869
- };
870
- t = {
871
- ...t,
872
- ...k
873
- }, d.state.next(k);
874
- }
875
- }, M = async (l) => {
876
- b(l, !0);
877
- const m = await r.resolver(s, r.context, Qs(l || a.mount, n, r.criteriaMode, r.shouldUseNativeValidation));
878
- return b(l), m;
879
- }, H = async (l) => {
880
- const { errors: m } = await M(l);
881
- if (l)
882
- for (const E of l) {
883
- const N = O(m, E);
884
- N ? G(t.errors, E, N) : ne(t.errors, E);
885
- }
886
- else
887
- t.errors = m;
888
- return m;
889
- }, U = async (l, m, E = {
890
- valid: !0
891
- }) => {
892
- for (const N in l) {
893
- const F = l[N];
894
- if (F) {
895
- const { _f: T, ...k } = F;
896
- if (T) {
897
- const Y = a.array.has(T.name);
898
- b([N], !0);
899
- const re = await Or(F, s, y, r.shouldUseNativeValidation && !m, Y);
900
- if (b([N]), re[T.name] && (E.valid = !1, m))
901
- break;
902
- !m && (O(re, T.name) ? Y ? Gn(t.errors, re, T.name) : G(t.errors, T.name, re[T.name]) : ne(t.errors, T.name));
903
- }
904
- k && await U(k, m, E);
905
- }
906
- }
907
- return E.valid;
908
- }, J = () => {
909
- for (const l of a.unMount) {
910
- const m = O(n, l);
911
- m && (m._f.refs ? m._f.refs.every((E) => !yr(E)) : !yr(m._f.ref)) && Ce(l);
912
- }
913
- a.unMount = /* @__PURE__ */ new Set();
914
- }, D = (l, m) => (l && m && G(s, l, m), !Qe(we(), o)), I = (l, m, E) => Xn(l, a, {
915
- ...i.mount ? s : Q(m) ? o : Pe(l) ? { [l]: m } : m
916
- }, E, m), B = (l) => Pt(O(i.mount ? s : o, l, e.shouldUnregister ? O(o, l, []) : [])), V = (l, m, E = {}) => {
917
- const N = O(n, l);
918
- let F = m;
919
- if (N) {
920
- const T = N._f;
921
- T && (!T.disabled && G(s, l, ro(m, T)), F = $t(T.ref) && de(m) ? "" : m, Jn(T.ref) ? [...T.ref.options].forEach((k) => k.selected = F.includes(k.value)) : T.refs ? Rt(T.ref) ? T.refs.length > 1 ? T.refs.forEach((k) => (!k.defaultChecked || !k.disabled) && (k.checked = Array.isArray(F) ? !!F.find((Y) => Y === k.value) : F === k.value)) : T.refs[0] && (T.refs[0].checked = !!F) : T.refs.forEach((k) => k.checked = k.value === F) : zr(T.ref) ? T.ref.value = "" : (T.ref.value = F, T.ref.type || d.values.next({
922
- name: l,
923
- values: { ...s }
924
- })));
925
- }
926
- (E.shouldDirty || E.shouldTouch) && A(l, F, E.shouldTouch, E.shouldDirty, !0), E.shouldValidate && Se(l);
927
- }, $ = (l, m, E) => {
928
- for (const N in m) {
929
- const F = m[N], T = `${l}.${N}`, k = O(n, T);
930
- (a.array.has(l) || !Kt(F) || k && !k._f) && !ht(F) ? $(T, F, E) : V(T, F, E);
931
- }
932
- }, L = (l, m, E = {}) => {
933
- const N = O(n, l), F = a.array.has(l), T = ie(m);
934
- G(s, l, T), F ? (d.array.next({
935
- name: l,
936
- values: { ...s }
937
- }), (f.isDirty || f.dirtyFields) && E.shouldDirty && d.state.next({
938
- name: l,
939
- dirtyFields: Ft(o, s),
940
- isDirty: D(l, T)
941
- })) : N && !N._f && !de(T) ? $(l, T, E) : V(l, T, E), Tr(l, a) && d.state.next({ ...t }), d.values.next({
942
- name: i.mount ? l : void 0,
943
- values: { ...s }
944
- });
945
- }, Z = async (l) => {
946
- i.mount = !0;
947
- const m = l.target;
948
- let E = m.name, N = !0;
949
- const F = O(n, E), T = () => m.type ? wr(F._f) : Hn(l), k = (Y) => {
950
- N = Number.isNaN(Y) || Y === O(s, E, Y);
951
- };
952
- if (F) {
953
- let Y, re;
954
- const ve = T(), st = l.type === Ut.BLUR || l.type === Ut.FOCUS_OUT, Cs = !Js(F._f) && !r.resolver && !O(t.errors, E) && !F._f.deps || ei(st, O(t.touchedFields, E), t.isSubmitted, x, g), ir = Tr(E, a, st);
955
- G(s, E, ve), st ? (F._f.onBlur && F._f.onBlur(l), c && c(0)) : F._f.onChange && F._f.onChange(l);
956
- const ar = A(E, ve, st, !1), As = !he(ar) || ir;
957
- if (!st && d.values.next({
958
- name: E,
959
- type: l.type,
960
- values: { ...s }
961
- }), Cs)
962
- return f.isValid && S(), As && d.state.next({ name: E, ...ir ? {} : ar });
963
- if (!st && ir && d.state.next({ ...t }), r.resolver) {
964
- const { errors: nn } = await M([E]);
965
- if (k(ve), N) {
966
- const _s = pn(t.errors, n, E), on = pn(nn, n, _s.name || E);
967
- Y = on.error, E = on.name, re = he(nn);
968
- }
969
- } else
970
- b([E], !0), Y = (await Or(F, s, y, r.shouldUseNativeValidation))[E], b([E]), k(ve), N && (Y ? re = !1 : f.isValid && (re = await U(n, !0)));
971
- N && (F._f.deps && Se(F._f.deps), _(E, re, Y, ar));
972
- }
973
- }, ee = (l, m) => {
974
- if (O(t.errors, m) && l.focus)
975
- return l.focus(), 1;
976
- }, Se = async (l, m = {}) => {
977
- let E, N;
978
- const F = pe(l);
979
- if (r.resolver) {
980
- const T = await H(Q(l) ? l : F);
981
- E = he(T), N = l ? !F.some((k) => O(T, k)) : E;
982
- } else l ? (N = (await Promise.all(F.map(async (T) => {
983
- const k = O(n, T);
984
- return await U(k && k._f ? { [T]: k } : k);
985
- }))).every(Boolean), !(!N && !t.isValid) && S()) : N = E = await U(n);
986
- return d.state.next({
987
- ...!Pe(l) || f.isValid && E !== t.isValid ? {} : { name: l },
988
- ...r.resolver || !l ? { isValid: E } : {},
989
- errors: t.errors
990
- }), m.shouldFocus && !N && pt(n, ee, l ? F : a.mount), N;
991
- }, we = (l) => {
992
- const m = {
993
- ...i.mount ? s : o
994
- };
995
- return Q(l) ? m : Pe(l) ? O(m, l) : l.map((E) => O(m, E));
996
- }, je = (l, m) => ({
997
- invalid: !!O((m || t).errors, l),
998
- isDirty: !!O((m || t).dirtyFields, l),
999
- error: O((m || t).errors, l),
1000
- isValidating: !!O(t.validatingFields, l),
1001
- isTouched: !!O((m || t).touchedFields, l)
1002
- }), Ze = (l) => {
1003
- l && pe(l).forEach((m) => ne(t.errors, m)), d.state.next({
1004
- errors: l ? t.errors : {}
1005
- });
1006
- }, Ee = (l, m, E) => {
1007
- const N = (O(n, l, { _f: {} })._f || {}).ref, F = O(t.errors, l) || {}, { ref: T, message: k, type: Y, ...re } = F;
1008
- G(t.errors, l, {
1009
- ...re,
1010
- ...m,
1011
- ref: N
1012
- }), d.state.next({
1013
- name: l,
1014
- errors: t.errors,
1015
- isValid: !1
1016
- }), E && E.shouldFocus && N && N.focus && N.focus();
1017
- }, Be = (l, m) => ze(l) ? d.values.subscribe({
1018
- next: (E) => l(I(void 0, m), E)
1019
- }) : I(l, m, !0), Ce = (l, m = {}) => {
1020
- for (const E of l ? pe(l) : a.mount)
1021
- a.mount.delete(E), a.array.delete(E), m.keepValue || (ne(n, E), ne(s, E)), !m.keepError && ne(t.errors, E), !m.keepDirty && ne(t.dirtyFields, E), !m.keepTouched && ne(t.touchedFields, E), !m.keepIsValidating && ne(t.validatingFields, E), !r.shouldUnregister && !m.keepDefaultValue && ne(o, E);
1022
- d.values.next({
1023
- values: { ...s }
1024
- }), d.state.next({
1025
- ...t,
1026
- ...m.keepDirty ? { isDirty: D() } : {}
1027
- }), !m.keepIsValid && S();
1028
- }, W = ({ disabled: l, name: m, field: E, fields: N, value: F }) => {
1029
- if (_e(l) && i.mount || l) {
1030
- const T = l ? void 0 : Q(F) ? wr(E ? E._f : O(N, m)._f) : F;
1031
- G(s, m, T), A(m, T, !1, !1, !0);
1032
- }
1033
- }, q = (l, m = {}) => {
1034
- let E = O(n, l);
1035
- const N = _e(m.disabled);
1036
- return G(n, l, {
1037
- ...E || {},
1038
- _f: {
1039
- ...E && E._f ? E._f : { ref: { name: l } },
1040
- name: l,
1041
- mount: !0,
1042
- ...m
1043
- }
1044
- }), a.mount.add(l), E ? W({
1045
- field: E,
1046
- disabled: m.disabled,
1047
- name: l,
1048
- value: m.value
1049
- }) : w(l, !0, m.value), {
1050
- ...N ? { disabled: m.disabled } : {},
1051
- ...r.progressive ? {
1052
- required: !!m.required,
1053
- min: St(m.min),
1054
- max: St(m.max),
1055
- minLength: St(m.minLength),
1056
- maxLength: St(m.maxLength),
1057
- pattern: St(m.pattern)
1058
- } : {},
1059
- name: l,
1060
- onChange: Z,
1061
- onBlur: Z,
1062
- ref: (F) => {
1063
- if (F) {
1064
- q(l, m), E = O(n, l);
1065
- const T = Q(F.value) && F.querySelectorAll && F.querySelectorAll("input,select,textarea")[0] || F, k = Zs(T), Y = E._f.refs || [];
1066
- if (k ? Y.find((re) => re === T) : T === E._f.ref)
1067
- return;
1068
- G(n, l, {
1069
- _f: {
1070
- ...E._f,
1071
- ...k ? {
1072
- refs: [
1073
- ...Y.filter(yr),
1074
- T,
1075
- ...Array.isArray(O(o, l)) ? [{}] : []
1076
- ],
1077
- ref: { type: T.type, name: l }
1078
- } : { ref: T }
1079
- }
1080
- }), w(l, !1, void 0, T);
1081
- } else
1082
- E = O(n, l, {}), E._f && (E._f.mount = !1), (r.shouldUnregister || m.shouldUnregister) && !(Un(a.array, l) && i.action) && a.unMount.add(l);
1083
- }
1084
- };
1085
- }, se = () => r.shouldFocusError && pt(n, ee, a.mount), X = (l) => {
1086
- _e(l) && (d.state.next({ disabled: l }), pt(n, (m, E) => {
1087
- const N = O(n, E);
1088
- N && (m.disabled = N._f.disabled || l, Array.isArray(N._f.refs) && N._f.refs.forEach((F) => {
1089
- F.disabled = N._f.disabled || l;
1090
- }));
1091
- }, 0, !1));
1092
- }, z = (l, m) => async (E) => {
1093
- let N;
1094
- E && (E.preventDefault && E.preventDefault(), E.persist && E.persist());
1095
- let F = ie(s);
1096
- if (d.state.next({
1097
- isSubmitting: !0
1098
- }), r.resolver) {
1099
- const { errors: T, values: k } = await M();
1100
- t.errors = T, F = k;
1101
- } else
1102
- await U(n);
1103
- if (ne(t.errors, "root"), he(t.errors)) {
1104
- d.state.next({
1105
- errors: {}
1106
- });
1107
- try {
1108
- await l(F, E);
1109
- } catch (T) {
1110
- N = T;
1111
- }
1112
- } else
1113
- m && await m({ ...t.errors }, E), se(), setTimeout(se);
1114
- if (d.state.next({
1115
- isSubmitted: !0,
1116
- isSubmitting: !1,
1117
- isSubmitSuccessful: he(t.errors) && !N,
1118
- submitCount: t.submitCount + 1,
1119
- errors: t.errors
1120
- }), N)
1121
- throw N;
1122
- }, K = (l, m = {}) => {
1123
- O(n, l) && (Q(m.defaultValue) ? L(l, ie(O(o, l))) : (L(l, m.defaultValue), G(o, l, ie(m.defaultValue))), m.keepTouched || ne(t.touchedFields, l), m.keepDirty || (ne(t.dirtyFields, l), t.isDirty = m.defaultValue ? D(l, ie(O(o, l))) : D()), m.keepError || (ne(t.errors, l), f.isValid && S()), d.state.next({ ...t }));
1124
- }, ue = (l, m = {}) => {
1125
- const E = l ? ie(l) : o, N = ie(E), F = he(l), T = F ? o : N;
1126
- if (m.keepDefaultValues || (o = E), !m.keepValues) {
1127
- if (m.keepDirtyValues)
1128
- for (const k of a.mount)
1129
- O(t.dirtyFields, k) ? G(T, k, O(s, k)) : L(k, O(T, k));
1130
- else {
1131
- if (Ur && Q(l))
1132
- for (const k of a.mount) {
1133
- const Y = O(n, k);
1134
- if (Y && Y._f) {
1135
- const re = Array.isArray(Y._f.refs) ? Y._f.refs[0] : Y._f.ref;
1136
- if ($t(re)) {
1137
- const ve = re.closest("form");
1138
- if (ve) {
1139
- ve.reset();
1140
- break;
1141
- }
1142
- }
1143
- }
1144
- }
1145
- n = {};
1146
- }
1147
- s = e.shouldUnregister ? m.keepDefaultValues ? ie(o) : {} : ie(T), d.array.next({
1148
- values: { ...T }
1149
- }), d.values.next({
1150
- values: { ...T }
1151
- });
1152
- }
1153
- a = {
1154
- mount: m.keepDirtyValues ? a.mount : /* @__PURE__ */ new Set(),
1155
- unMount: /* @__PURE__ */ new Set(),
1156
- array: /* @__PURE__ */ new Set(),
1157
- watch: /* @__PURE__ */ new Set(),
1158
- watchAll: !1,
1159
- focus: ""
1160
- }, i.mount = !f.isValid || !!m.keepIsValid || !!m.keepDirtyValues, i.watch = !!e.shouldUnregister, d.state.next({
1161
- submitCount: m.keepSubmitCount ? t.submitCount : 0,
1162
- isDirty: F ? !1 : m.keepDirty ? t.isDirty : !!(m.keepDefaultValues && !Qe(l, o)),
1163
- isSubmitted: m.keepIsSubmitted ? t.isSubmitted : !1,
1164
- dirtyFields: F ? {} : m.keepDirtyValues ? m.keepDefaultValues && s ? Ft(o, s) : t.dirtyFields : m.keepDefaultValues && l ? Ft(o, l) : m.keepDirty ? t.dirtyFields : {},
1165
- touchedFields: m.keepTouched ? t.touchedFields : {},
1166
- errors: m.keepErrors ? t.errors : {},
1167
- isSubmitSuccessful: m.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
1168
- isSubmitting: !1
1169
- });
1170
- }, me = (l, m) => ue(ze(l) ? l(s) : l, m);
1171
- return {
1172
- control: {
1173
- register: q,
1174
- unregister: Ce,
1175
- getFieldState: je,
1176
- handleSubmit: z,
1177
- setError: Ee,
1178
- _executeSchema: M,
1179
- _getWatch: I,
1180
- _getDirty: D,
1181
- _updateValid: S,
1182
- _removeUnmounted: J,
1183
- _updateFieldArray: v,
1184
- _updateDisabledField: W,
1185
- _getFieldArray: B,
1186
- _reset: ue,
1187
- _resetDefaultValues: () => ze(r.defaultValues) && r.defaultValues().then((l) => {
1188
- me(l, r.resetOptions), d.state.next({
1189
- isLoading: !1
1190
- });
1191
- }),
1192
- _updateFormState: (l) => {
1193
- t = {
1194
- ...t,
1195
- ...l
1196
- };
1197
- },
1198
- _disableForm: X,
1199
- _subjects: d,
1200
- _proxyFormState: f,
1201
- _setErrors: R,
1202
- get _fields() {
1203
- return n;
1204
- },
1205
- get _formValues() {
1206
- return s;
1207
- },
1208
- get _state() {
1209
- return i;
1210
- },
1211
- set _state(l) {
1212
- i = l;
1213
- },
1214
- get _defaultValues() {
1215
- return o;
1216
- },
1217
- get _names() {
1218
- return a;
1219
- },
1220
- set _names(l) {
1221
- a = l;
1222
- },
1223
- get _formState() {
1224
- return t;
1225
- },
1226
- set _formState(l) {
1227
- t = l;
1228
- },
1229
- get _options() {
1230
- return r;
1231
- },
1232
- set _options(l) {
1233
- r = {
1234
- ...r,
1235
- ...l
1236
- };
1237
- }
1238
- },
1239
- trigger: Se,
1240
- register: q,
1241
- handleSubmit: z,
1242
- watch: Be,
1243
- setValue: L,
1244
- getValues: we,
1245
- reset: me,
1246
- resetField: K,
1247
- clearErrors: Ze,
1248
- unregister: Ce,
1249
- setError: Ee,
1250
- setFocus: (l, m = {}) => {
1251
- const E = O(n, l), N = E && E._f;
1252
- if (N) {
1253
- const F = N.refs ? N.refs[0] : N.ref;
1254
- F.focus && (F.focus(), m.shouldSelect && F.select());
1255
- }
1256
- },
1257
- getFieldState: je
1258
- };
1259
- }
1260
- function al(e = {}) {
1261
- const r = j.useRef(), t = j.useRef(), [n, o] = j.useState({
1262
- isDirty: !1,
1263
- isValidating: !1,
1264
- isLoading: ze(e.defaultValues),
1265
- isSubmitted: !1,
1266
- isSubmitting: !1,
1267
- isSubmitSuccessful: !1,
1268
- isValid: !1,
1269
- submitCount: 0,
1270
- dirtyFields: {},
1271
- touchedFields: {},
1272
- validatingFields: {},
1273
- errors: e.errors || {},
1274
- disabled: e.disabled || !1,
1275
- defaultValues: ze(e.defaultValues) ? void 0 : e.defaultValues
1276
- });
1277
- r.current || (r.current = {
1278
- ...ni(e),
1279
- formState: n
1280
- });
1281
- const s = r.current.control;
1282
- return s._options = e, er({
1283
- subject: s._subjects.state,
1284
- next: (i) => {
1285
- Yn(i, s._proxyFormState, s._updateFormState, !0) && o({ ...s._formState });
1286
- }
1287
- }), j.useEffect(() => s._disableForm(e.disabled), [s, e.disabled]), j.useEffect(() => {
1288
- if (s._proxyFormState.isDirty) {
1289
- const i = s._getDirty();
1290
- i !== n.isDirty && s._subjects.state.next({
1291
- isDirty: i
1292
- });
1293
- }
1294
- }, [s, n.isDirty]), j.useEffect(() => {
1295
- e.values && !Qe(e.values, t.current) ? (s._reset(e.values, s._options.resetOptions), t.current = e.values, o((i) => ({ ...i }))) : s._resetDefaultValues();
1296
- }, [e.values, s]), j.useEffect(() => {
1297
- e.errors && s._setErrors(e.errors);
1298
- }, [e.errors, s]), j.useEffect(() => {
1299
- s._state.mount || (s._updateValid(), s._state.mount = !0), s._state.watch && (s._state.watch = !1, s._subjects.state.next({ ...s._formState })), s._removeUnmounted();
1300
- }), j.useEffect(() => {
1301
- e.shouldUnregister && s._subjects.values.next({
1302
- values: s._getWatch()
1303
- });
1304
- }, [e.shouldUnregister, s]), r.current.formState = Kn(n, s), r.current;
1305
- }
1306
- function mn(e, [r, t]) {
1307
- return Math.min(t, Math.max(r, e));
1308
- }
1309
- function oi(e) {
1310
- const r = e + "CollectionProvider", [t, n] = Br(r), [o, s] = t(
1311
- r,
1312
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
1313
- ), i = (x) => {
1314
- const { scope: y, children: p } = x, S = j.useRef(null), b = j.useRef(/* @__PURE__ */ new Map()).current;
1315
- return /* @__PURE__ */ P.jsx(o, { scope: y, itemMap: b, collectionRef: S, children: p });
1316
- };
1317
- i.displayName = r;
1318
- const a = e + "CollectionSlot", c = j.forwardRef(
1319
- (x, y) => {
1320
- const { scope: p, children: S } = x, b = s(a, p), v = le(y, b.collectionRef);
1321
- return /* @__PURE__ */ P.jsx(Ht, { ref: v, children: S });
1322
- }
1323
- );
1324
- c.displayName = a;
1325
- const u = e + "CollectionItemSlot", f = "data-radix-collection-item", d = j.forwardRef(
1326
- (x, y) => {
1327
- const { scope: p, children: S, ...b } = x, v = j.useRef(null), C = le(y, v), R = s(u, p);
1328
- return j.useEffect(() => (R.itemMap.set(v, { ref: v, ...b }), () => void R.itemMap.delete(v))), /* @__PURE__ */ P.jsx(Ht, { [f]: "", ref: C, children: S });
1329
- }
1330
- );
1331
- d.displayName = u;
1332
- function g(x) {
1333
- const y = s(e + "CollectionConsumer", x);
1334
- return j.useCallback(() => {
1335
- const S = y.collectionRef.current;
1336
- if (!S) return [];
1337
- const b = Array.from(S.querySelectorAll(`[${f}]`));
1338
- return Array.from(y.itemMap.values()).sort(
1339
- (R, w) => b.indexOf(R.ref.current) - b.indexOf(w.ref.current)
1340
- );
1341
- }, [y.collectionRef, y.itemMap]);
1342
- }
1343
- return [
1344
- { Provider: i, Slot: c, ItemSlot: d },
1345
- g,
1346
- n
1347
- ];
1348
- }
1349
- var si = h.createContext(void 0);
1350
- function ii(e) {
1351
- const r = h.useContext(si);
1352
- return e || r || "ltr";
1353
- }
1354
- function ai(e, r = globalThis == null ? void 0 : globalThis.document) {
1355
- const t = Je(e);
1356
- h.useEffect(() => {
1357
- const n = (o) => {
1358
- o.key === "Escape" && t(o);
1359
- };
1360
- return r.addEventListener("keydown", n, { capture: !0 }), () => r.removeEventListener("keydown", n, { capture: !0 });
1361
- }, [t, r]);
1362
- }
1363
- var ci = "DismissableLayer", Fr = "dismissableLayer.update", li = "dismissableLayer.pointerDownOutside", ui = "dismissableLayer.focusOutside", vn, no = h.createContext({
1364
- layers: /* @__PURE__ */ new Set(),
1365
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
1366
- branches: /* @__PURE__ */ new Set()
1367
- }), oo = h.forwardRef(
1368
- (e, r) => {
1369
- const {
1370
- disableOutsidePointerEvents: t = !1,
1371
- onEscapeKeyDown: n,
1372
- onPointerDownOutside: o,
1373
- onFocusOutside: s,
1374
- onInteractOutside: i,
1375
- onDismiss: a,
1376
- ...c
1377
- } = e, u = h.useContext(no), [f, d] = h.useState(null), g = (f == null ? void 0 : f.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, x] = h.useState({}), y = le(r, (_) => d(_)), p = Array.from(u.layers), [S] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), b = p.indexOf(S), v = f ? p.indexOf(f) : -1, C = u.layersWithOutsidePointerEventsDisabled.size > 0, R = v >= b, w = hi((_) => {
1378
- const M = _.target, H = [...u.branches].some((U) => U.contains(M));
1379
- !R || H || (o == null || o(_), i == null || i(_), _.defaultPrevented || a == null || a());
1380
- }, g), A = pi((_) => {
1381
- const M = _.target;
1382
- [...u.branches].some((U) => U.contains(M)) || (s == null || s(_), i == null || i(_), _.defaultPrevented || a == null || a());
1383
- }, g);
1384
- return ai((_) => {
1385
- v === u.layers.size - 1 && (n == null || n(_), !_.defaultPrevented && a && (_.preventDefault(), a()));
1386
- }, g), h.useEffect(() => {
1387
- if (f)
1388
- return t && (u.layersWithOutsidePointerEventsDisabled.size === 0 && (vn = g.body.style.pointerEvents, g.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(f)), u.layers.add(f), gn(), () => {
1389
- t && u.layersWithOutsidePointerEventsDisabled.size === 1 && (g.body.style.pointerEvents = vn);
1390
- };
1391
- }, [f, g, t, u]), h.useEffect(() => () => {
1392
- f && (u.layers.delete(f), u.layersWithOutsidePointerEventsDisabled.delete(f), gn());
1393
- }, [f, u]), h.useEffect(() => {
1394
- const _ = () => x({});
1395
- return document.addEventListener(Fr, _), () => document.removeEventListener(Fr, _);
1396
- }, []), /* @__PURE__ */ P.jsx(
1397
- oe.div,
1398
- {
1399
- ...c,
1400
- ref: y,
1401
- style: {
1402
- pointerEvents: C ? R ? "auto" : "none" : void 0,
1403
- ...e.style
1404
- },
1405
- onFocusCapture: ce(e.onFocusCapture, A.onFocusCapture),
1406
- onBlurCapture: ce(e.onBlurCapture, A.onBlurCapture),
1407
- onPointerDownCapture: ce(
1408
- e.onPointerDownCapture,
1409
- w.onPointerDownCapture
1410
- )
1411
- }
1412
- );
1413
- }
1414
- );
1415
- oo.displayName = ci;
1416
- var di = "DismissableLayerBranch", fi = h.forwardRef((e, r) => {
1417
- const t = h.useContext(no), n = h.useRef(null), o = le(r, n);
1418
- return h.useEffect(() => {
1419
- const s = n.current;
1420
- if (s)
1421
- return t.branches.add(s), () => {
1422
- t.branches.delete(s);
1423
- };
1424
- }, [t.branches]), /* @__PURE__ */ P.jsx(oe.div, { ...e, ref: o });
1425
- });
1426
- fi.displayName = di;
1427
- function hi(e, r = globalThis == null ? void 0 : globalThis.document) {
1428
- const t = Je(e), n = h.useRef(!1), o = h.useRef(() => {
1429
- });
1430
- return h.useEffect(() => {
1431
- const s = (a) => {
1432
- if (a.target && !n.current) {
1433
- let c = function() {
1434
- so(
1435
- li,
1436
- t,
1437
- u,
1438
- { discrete: !0 }
1439
- );
1440
- };
1441
- const u = { originalEvent: a };
1442
- a.pointerType === "touch" ? (r.removeEventListener("click", o.current), o.current = c, r.addEventListener("click", o.current, { once: !0 })) : c();
1443
- } else
1444
- r.removeEventListener("click", o.current);
1445
- n.current = !1;
1446
- }, i = window.setTimeout(() => {
1447
- r.addEventListener("pointerdown", s);
1448
- }, 0);
1449
- return () => {
1450
- window.clearTimeout(i), r.removeEventListener("pointerdown", s), r.removeEventListener("click", o.current);
1451
- };
1452
- }, [r, t]), {
1453
- // ensures we check React component tree (not just DOM tree)
1454
- onPointerDownCapture: () => n.current = !0
1455
- };
1456
- }
1457
- function pi(e, r = globalThis == null ? void 0 : globalThis.document) {
1458
- const t = Je(e), n = h.useRef(!1);
1459
- return h.useEffect(() => {
1460
- const o = (s) => {
1461
- s.target && !n.current && so(ui, t, { originalEvent: s }, {
1462
- discrete: !1
1463
- });
1464
- };
1465
- return r.addEventListener("focusin", o), () => r.removeEventListener("focusin", o);
1466
- }, [r, t]), {
1467
- onFocusCapture: () => n.current = !0,
1468
- onBlurCapture: () => n.current = !1
1469
- };
1470
- }
1471
- function gn() {
1472
- const e = new CustomEvent(Fr);
1473
- document.dispatchEvent(e);
1474
- }
1475
- function so(e, r, t, { discrete: n }) {
1476
- const o = t.originalEvent.target, s = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: t });
1477
- r && o.addEventListener(e, r, { once: !0 }), n ? Fs(o, s) : o.dispatchEvent(s);
1478
- }
1479
- var xr = 0;
1480
- function mi() {
1481
- h.useEffect(() => {
1482
- const e = document.querySelectorAll("[data-radix-focus-guard]");
1483
- return document.body.insertAdjacentElement("afterbegin", e[0] ?? yn()), document.body.insertAdjacentElement("beforeend", e[1] ?? yn()), xr++, () => {
1484
- xr === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((r) => r.remove()), xr--;
1485
- };
1486
- }, []);
1487
- }
1488
- function yn() {
1489
- const e = document.createElement("span");
1490
- return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none", e;
1491
- }
1492
- var br = "focusScope.autoFocusOnMount", Sr = "focusScope.autoFocusOnUnmount", wn = { bubbles: !1, cancelable: !0 }, vi = "FocusScope", io = h.forwardRef((e, r) => {
1493
- const {
1494
- loop: t = !1,
1495
- trapped: n = !1,
1496
- onMountAutoFocus: o,
1497
- onUnmountAutoFocus: s,
1498
- ...i
1499
- } = e, [a, c] = h.useState(null), u = Je(o), f = Je(s), d = h.useRef(null), g = le(r, (p) => c(p)), x = h.useRef({
1500
- paused: !1,
1501
- pause() {
1502
- this.paused = !0;
1503
- },
1504
- resume() {
1505
- this.paused = !1;
1506
- }
1507
- }).current;
1508
- h.useEffect(() => {
1509
- if (n) {
1510
- let p = function(C) {
1511
- if (x.paused || !a) return;
1512
- const R = C.target;
1513
- a.contains(R) ? d.current = R : He(d.current, { select: !0 });
1514
- }, S = function(C) {
1515
- if (x.paused || !a) return;
1516
- const R = C.relatedTarget;
1517
- R !== null && (a.contains(R) || He(d.current, { select: !0 }));
1518
- }, b = function(C) {
1519
- if (document.activeElement === document.body)
1520
- for (const w of C)
1521
- w.removedNodes.length > 0 && He(a);
1522
- };
1523
- document.addEventListener("focusin", p), document.addEventListener("focusout", S);
1524
- const v = new MutationObserver(b);
1525
- return a && v.observe(a, { childList: !0, subtree: !0 }), () => {
1526
- document.removeEventListener("focusin", p), document.removeEventListener("focusout", S), v.disconnect();
1527
- };
1528
- }
1529
- }, [n, a, x.paused]), h.useEffect(() => {
1530
- if (a) {
1531
- bn.add(x);
1532
- const p = document.activeElement;
1533
- if (!a.contains(p)) {
1534
- const b = new CustomEvent(br, wn);
1535
- a.addEventListener(br, u), a.dispatchEvent(b), b.defaultPrevented || (gi(Si(ao(a)), { select: !0 }), document.activeElement === p && He(a));
1536
- }
1537
- return () => {
1538
- a.removeEventListener(br, u), setTimeout(() => {
1539
- const b = new CustomEvent(Sr, wn);
1540
- a.addEventListener(Sr, f), a.dispatchEvent(b), b.defaultPrevented || He(p ?? document.body, { select: !0 }), a.removeEventListener(Sr, f), bn.remove(x);
1541
- }, 0);
1542
- };
1543
- }
1544
- }, [a, u, f, x]);
1545
- const y = h.useCallback(
1546
- (p) => {
1547
- if (!t && !n || x.paused) return;
1548
- const S = p.key === "Tab" && !p.altKey && !p.ctrlKey && !p.metaKey, b = document.activeElement;
1549
- if (S && b) {
1550
- const v = p.currentTarget, [C, R] = yi(v);
1551
- C && R ? !p.shiftKey && b === R ? (p.preventDefault(), t && He(C, { select: !0 })) : p.shiftKey && b === C && (p.preventDefault(), t && He(R, { select: !0 })) : b === v && p.preventDefault();
1552
- }
1553
- },
1554
- [t, n, x.paused]
1555
- );
1556
- return /* @__PURE__ */ P.jsx(oe.div, { tabIndex: -1, ...i, ref: g, onKeyDown: y });
1557
- });
1558
- io.displayName = vi;
1559
- function gi(e, { select: r = !1 } = {}) {
1560
- const t = document.activeElement;
1561
- for (const n of e)
1562
- if (He(n, { select: r }), document.activeElement !== t) return;
1563
- }
1564
- function yi(e) {
1565
- const r = ao(e), t = xn(r, e), n = xn(r.reverse(), e);
1566
- return [t, n];
1567
- }
1568
- function ao(e) {
1569
- const r = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
1570
- acceptNode: (n) => {
1571
- const o = n.tagName === "INPUT" && n.type === "hidden";
1572
- return n.disabled || n.hidden || o ? NodeFilter.FILTER_SKIP : n.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
1573
- }
1574
- });
1575
- for (; t.nextNode(); ) r.push(t.currentNode);
1576
- return r;
1577
- }
1578
- function xn(e, r) {
1579
- for (const t of e)
1580
- if (!wi(t, { upTo: r })) return t;
1581
- }
1582
- function wi(e, { upTo: r }) {
1583
- if (getComputedStyle(e).visibility === "hidden") return !0;
1584
- for (; e; ) {
1585
- if (r !== void 0 && e === r) return !1;
1586
- if (getComputedStyle(e).display === "none") return !0;
1587
- e = e.parentElement;
1588
- }
1589
- return !1;
1590
- }
1591
- function xi(e) {
1592
- return e instanceof HTMLInputElement && "select" in e;
1593
- }
1594
- function He(e, { select: r = !1 } = {}) {
1595
- if (e && e.focus) {
1596
- const t = document.activeElement;
1597
- e.focus({ preventScroll: !0 }), e !== t && xi(e) && r && e.select();
1598
- }
1599
- }
1600
- var bn = bi();
1601
- function bi() {
1602
- let e = [];
1603
- return {
1604
- add(r) {
1605
- const t = e[0];
1606
- r !== t && (t == null || t.pause()), e = Sn(e, r), e.unshift(r);
1607
- },
1608
- remove(r) {
1609
- var t;
1610
- e = Sn(e, r), (t = e[0]) == null || t.resume();
1611
- }
1612
- };
1613
- }
1614
- function Sn(e, r) {
1615
- const t = [...e], n = t.indexOf(r);
1616
- return n !== -1 && t.splice(n, 1), t;
1617
- }
1618
- function Si(e) {
1619
- return e.filter((r) => r.tagName !== "A");
1620
- }
1621
- const Ei = ["top", "right", "bottom", "left"], Ke = Math.min, ge = Math.max, qt = Math.round, Nt = Math.floor, Ye = (e) => ({
1622
- x: e,
1623
- y: e
1624
- }), Ci = {
1625
- left: "right",
1626
- right: "left",
1627
- bottom: "top",
1628
- top: "bottom"
1629
- }, Ai = {
1630
- start: "end",
1631
- end: "start"
1632
- };
1633
- function Nr(e, r, t) {
1634
- return ge(e, Ke(r, t));
1635
- }
1636
- function Ie(e, r) {
1637
- return typeof e == "function" ? e(r) : e;
1638
- }
1639
- function Ve(e) {
1640
- return e.split("-")[0];
1641
- }
1642
- function yt(e) {
1643
- return e.split("-")[1];
1644
- }
1645
- function Yr(e) {
1646
- return e === "x" ? "y" : "x";
1647
- }
1648
- function qr(e) {
1649
- return e === "y" ? "height" : "width";
1650
- }
1651
- function wt(e) {
1652
- return ["top", "bottom"].includes(Ve(e)) ? "y" : "x";
1653
- }
1654
- function Xr(e) {
1655
- return Yr(wt(e));
1656
- }
1657
- function _i(e, r, t) {
1658
- t === void 0 && (t = !1);
1659
- const n = yt(e), o = Xr(e), s = qr(o);
1660
- let i = o === "x" ? n === (t ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
1661
- return r.reference[s] > r.floating[s] && (i = Xt(i)), [i, Xt(i)];
1662
- }
1663
- function Ri(e) {
1664
- const r = Xt(e);
1665
- return [Dr(e), r, Dr(r)];
1666
- }
1667
- function Dr(e) {
1668
- return e.replace(/start|end/g, (r) => Ai[r]);
1669
- }
1670
- function Pi(e, r, t) {
1671
- const n = ["left", "right"], o = ["right", "left"], s = ["top", "bottom"], i = ["bottom", "top"];
1672
- switch (e) {
1673
- case "top":
1674
- case "bottom":
1675
- return t ? r ? o : n : r ? n : o;
1676
- case "left":
1677
- case "right":
1678
- return r ? s : i;
1679
- default:
1680
- return [];
1681
- }
1682
- }
1683
- function Ti(e, r, t, n) {
1684
- const o = yt(e);
1685
- let s = Pi(Ve(e), t === "start", n);
1686
- return o && (s = s.map((i) => i + "-" + o), r && (s = s.concat(s.map(Dr)))), s;
1687
- }
1688
- function Xt(e) {
1689
- return e.replace(/left|right|bottom|top/g, (r) => Ci[r]);
1690
- }
1691
- function Oi(e) {
1692
- return {
1693
- top: 0,
1694
- right: 0,
1695
- bottom: 0,
1696
- left: 0,
1697
- ...e
1698
- };
1699
- }
1700
- function co(e) {
1701
- return typeof e != "number" ? Oi(e) : {
1702
- top: e,
1703
- right: e,
1704
- bottom: e,
1705
- left: e
1706
- };
1707
- }
1708
- function Gt(e) {
1709
- const {
1710
- x: r,
1711
- y: t,
1712
- width: n,
1713
- height: o
1714
- } = e;
1715
- return {
1716
- width: n,
1717
- height: o,
1718
- top: t,
1719
- left: r,
1720
- right: r + n,
1721
- bottom: t + o,
1722
- x: r,
1723
- y: t
1724
- };
1725
- }
1726
- function En(e, r, t) {
1727
- let {
1728
- reference: n,
1729
- floating: o
1730
- } = e;
1731
- const s = wt(r), i = Xr(r), a = qr(i), c = Ve(r), u = s === "y", f = n.x + n.width / 2 - o.width / 2, d = n.y + n.height / 2 - o.height / 2, g = n[a] / 2 - o[a] / 2;
1732
- let x;
1733
- switch (c) {
1734
- case "top":
1735
- x = {
1736
- x: f,
1737
- y: n.y - o.height
1738
- };
1739
- break;
1740
- case "bottom":
1741
- x = {
1742
- x: f,
1743
- y: n.y + n.height
1744
- };
1745
- break;
1746
- case "right":
1747
- x = {
1748
- x: n.x + n.width,
1749
- y: d
1750
- };
1751
- break;
1752
- case "left":
1753
- x = {
1754
- x: n.x - o.width,
1755
- y: d
1756
- };
1757
- break;
1758
- default:
1759
- x = {
1760
- x: n.x,
1761
- y: n.y
1762
- };
1763
- }
1764
- switch (yt(r)) {
1765
- case "start":
1766
- x[i] -= g * (t && u ? -1 : 1);
1767
- break;
1768
- case "end":
1769
- x[i] += g * (t && u ? -1 : 1);
1770
- break;
1771
- }
1772
- return x;
1773
- }
1774
- const Fi = async (e, r, t) => {
1775
- const {
1776
- placement: n = "bottom",
1777
- strategy: o = "absolute",
1778
- middleware: s = [],
1779
- platform: i
1780
- } = t, a = s.filter(Boolean), c = await (i.isRTL == null ? void 0 : i.isRTL(r));
1781
- let u = await i.getElementRects({
1782
- reference: e,
1783
- floating: r,
1784
- strategy: o
1785
- }), {
1786
- x: f,
1787
- y: d
1788
- } = En(u, n, c), g = n, x = {}, y = 0;
1789
- for (let p = 0; p < a.length; p++) {
1790
- const {
1791
- name: S,
1792
- fn: b
1793
- } = a[p], {
1794
- x: v,
1795
- y: C,
1796
- data: R,
1797
- reset: w
1798
- } = await b({
1799
- x: f,
1800
- y: d,
1801
- initialPlacement: n,
1802
- placement: g,
1803
- strategy: o,
1804
- middlewareData: x,
1805
- rects: u,
1806
- platform: i,
1807
- elements: {
1808
- reference: e,
1809
- floating: r
1810
- }
1811
- });
1812
- f = v ?? f, d = C ?? d, x = {
1813
- ...x,
1814
- [S]: {
1815
- ...x[S],
1816
- ...R
1817
- }
1818
- }, w && y <= 50 && (y++, typeof w == "object" && (w.placement && (g = w.placement), w.rects && (u = w.rects === !0 ? await i.getElementRects({
1819
- reference: e,
1820
- floating: r,
1821
- strategy: o
1822
- }) : w.rects), {
1823
- x: f,
1824
- y: d
1825
- } = En(u, g, c)), p = -1);
1826
- }
1827
- return {
1828
- x: f,
1829
- y: d,
1830
- placement: g,
1831
- strategy: o,
1832
- middlewareData: x
1833
- };
1834
- };
1835
- async function At(e, r) {
1836
- var t;
1837
- r === void 0 && (r = {});
1838
- const {
1839
- x: n,
1840
- y: o,
1841
- platform: s,
1842
- rects: i,
1843
- elements: a,
1844
- strategy: c
1845
- } = e, {
1846
- boundary: u = "clippingAncestors",
1847
- rootBoundary: f = "viewport",
1848
- elementContext: d = "floating",
1849
- altBoundary: g = !1,
1850
- padding: x = 0
1851
- } = Ie(r, e), y = co(x), S = a[g ? d === "floating" ? "reference" : "floating" : d], b = Gt(await s.getClippingRect({
1852
- element: (t = await (s.isElement == null ? void 0 : s.isElement(S))) == null || t ? S : S.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(a.floating)),
1853
- boundary: u,
1854
- rootBoundary: f,
1855
- strategy: c
1856
- })), v = d === "floating" ? {
1857
- x: n,
1858
- y: o,
1859
- width: i.floating.width,
1860
- height: i.floating.height
1861
- } : i.reference, C = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a.floating)), R = await (s.isElement == null ? void 0 : s.isElement(C)) ? await (s.getScale == null ? void 0 : s.getScale(C)) || {
1862
- x: 1,
1863
- y: 1
1864
- } : {
1865
- x: 1,
1866
- y: 1
1867
- }, w = Gt(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
1868
- elements: a,
1869
- rect: v,
1870
- offsetParent: C,
1871
- strategy: c
1872
- }) : v);
1873
- return {
1874
- top: (b.top - w.top + y.top) / R.y,
1875
- bottom: (w.bottom - b.bottom + y.bottom) / R.y,
1876
- left: (b.left - w.left + y.left) / R.x,
1877
- right: (w.right - b.right + y.right) / R.x
1878
- };
1879
- }
1880
- const Ni = (e) => ({
1881
- name: "arrow",
1882
- options: e,
1883
- async fn(r) {
1884
- const {
1885
- x: t,
1886
- y: n,
1887
- placement: o,
1888
- rects: s,
1889
- platform: i,
1890
- elements: a,
1891
- middlewareData: c
1892
- } = r, {
1893
- element: u,
1894
- padding: f = 0
1895
- } = Ie(e, r) || {};
1896
- if (u == null)
1897
- return {};
1898
- const d = co(f), g = {
1899
- x: t,
1900
- y: n
1901
- }, x = Xr(o), y = qr(x), p = await i.getDimensions(u), S = x === "y", b = S ? "top" : "left", v = S ? "bottom" : "right", C = S ? "clientHeight" : "clientWidth", R = s.reference[y] + s.reference[x] - g[x] - s.floating[y], w = g[x] - s.reference[x], A = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u));
1902
- let _ = A ? A[C] : 0;
1903
- (!_ || !await (i.isElement == null ? void 0 : i.isElement(A))) && (_ = a.floating[C] || s.floating[y]);
1904
- const M = R / 2 - w / 2, H = _ / 2 - p[y] / 2 - 1, U = Ke(d[b], H), J = Ke(d[v], H), D = U, I = _ - p[y] - J, B = _ / 2 - p[y] / 2 + M, V = Nr(D, B, I), $ = !c.arrow && yt(o) != null && B !== V && s.reference[y] / 2 - (B < D ? U : J) - p[y] / 2 < 0, L = $ ? B < D ? B - D : B - I : 0;
1905
- return {
1906
- [x]: g[x] + L,
1907
- data: {
1908
- [x]: V,
1909
- centerOffset: B - V - L,
1910
- ...$ && {
1911
- alignmentOffset: L
1912
- }
1913
- },
1914
- reset: $
1915
- };
1916
- }
1917
- }), Di = function(e) {
1918
- return e === void 0 && (e = {}), {
1919
- name: "flip",
1920
- options: e,
1921
- async fn(r) {
1922
- var t, n;
1923
- const {
1924
- placement: o,
1925
- middlewareData: s,
1926
- rects: i,
1927
- initialPlacement: a,
1928
- platform: c,
1929
- elements: u
1930
- } = r, {
1931
- mainAxis: f = !0,
1932
- crossAxis: d = !0,
1933
- fallbackPlacements: g,
1934
- fallbackStrategy: x = "bestFit",
1935
- fallbackAxisSideDirection: y = "none",
1936
- flipAlignment: p = !0,
1937
- ...S
1938
- } = Ie(e, r);
1939
- if ((t = s.arrow) != null && t.alignmentOffset)
1940
- return {};
1941
- const b = Ve(o), v = Ve(a) === a, C = await (c.isRTL == null ? void 0 : c.isRTL(u.floating)), R = g || (v || !p ? [Xt(a)] : Ri(a));
1942
- !g && y !== "none" && R.push(...Ti(a, p, y, C));
1943
- const w = [a, ...R], A = await At(r, S), _ = [];
1944
- let M = ((n = s.flip) == null ? void 0 : n.overflows) || [];
1945
- if (f && _.push(A[b]), d) {
1946
- const D = _i(o, i, C);
1947
- _.push(A[D[0]], A[D[1]]);
1948
- }
1949
- if (M = [...M, {
1950
- placement: o,
1951
- overflows: _
1952
- }], !_.every((D) => D <= 0)) {
1953
- var H, U;
1954
- const D = (((H = s.flip) == null ? void 0 : H.index) || 0) + 1, I = w[D];
1955
- if (I)
1956
- return {
1957
- data: {
1958
- index: D,
1959
- overflows: M
1960
- },
1961
- reset: {
1962
- placement: I
1963
- }
1964
- };
1965
- let B = (U = M.filter((V) => V.overflows[0] <= 0).sort((V, $) => V.overflows[1] - $.overflows[1])[0]) == null ? void 0 : U.placement;
1966
- if (!B)
1967
- switch (x) {
1968
- case "bestFit": {
1969
- var J;
1970
- const V = (J = M.map(($) => [$.placement, $.overflows.filter((L) => L > 0).reduce((L, Z) => L + Z, 0)]).sort(($, L) => $[1] - L[1])[0]) == null ? void 0 : J[0];
1971
- V && (B = V);
1972
- break;
1973
- }
1974
- case "initialPlacement":
1975
- B = a;
1976
- break;
1977
- }
1978
- if (o !== B)
1979
- return {
1980
- reset: {
1981
- placement: B
1982
- }
1983
- };
1984
- }
1985
- return {};
1986
- }
1987
- };
1988
- };
1989
- function Cn(e, r) {
1990
- return {
1991
- top: e.top - r.height,
1992
- right: e.right - r.width,
1993
- bottom: e.bottom - r.height,
1994
- left: e.left - r.width
1995
- };
1996
- }
1997
- function An(e) {
1998
- return Ei.some((r) => e[r] >= 0);
1999
- }
2000
- const Mi = function(e) {
2001
- return e === void 0 && (e = {}), {
2002
- name: "hide",
2003
- options: e,
2004
- async fn(r) {
2005
- const {
2006
- rects: t
2007
- } = r, {
2008
- strategy: n = "referenceHidden",
2009
- ...o
2010
- } = Ie(e, r);
2011
- switch (n) {
2012
- case "referenceHidden": {
2013
- const s = await At(r, {
2014
- ...o,
2015
- elementContext: "reference"
2016
- }), i = Cn(s, t.reference);
2017
- return {
2018
- data: {
2019
- referenceHiddenOffsets: i,
2020
- referenceHidden: An(i)
2021
- }
2022
- };
2023
- }
2024
- case "escaped": {
2025
- const s = await At(r, {
2026
- ...o,
2027
- altBoundary: !0
2028
- }), i = Cn(s, t.floating);
2029
- return {
2030
- data: {
2031
- escapedOffsets: i,
2032
- escaped: An(i)
2033
- }
2034
- };
2035
- }
2036
- default:
2037
- return {};
2038
- }
2039
- }
2040
- };
2041
- };
2042
- async function ki(e, r) {
2043
- const {
2044
- placement: t,
2045
- platform: n,
2046
- elements: o
2047
- } = e, s = await (n.isRTL == null ? void 0 : n.isRTL(o.floating)), i = Ve(t), a = yt(t), c = wt(t) === "y", u = ["left", "top"].includes(i) ? -1 : 1, f = s && c ? -1 : 1, d = Ie(r, e);
2048
- let {
2049
- mainAxis: g,
2050
- crossAxis: x,
2051
- alignmentAxis: y
2052
- } = typeof d == "number" ? {
2053
- mainAxis: d,
2054
- crossAxis: 0,
2055
- alignmentAxis: null
2056
- } : {
2057
- mainAxis: 0,
2058
- crossAxis: 0,
2059
- alignmentAxis: null,
2060
- ...d
2061
- };
2062
- return a && typeof y == "number" && (x = a === "end" ? y * -1 : y), c ? {
2063
- x: x * f,
2064
- y: g * u
2065
- } : {
2066
- x: g * u,
2067
- y: x * f
2068
- };
2069
- }
2070
- const Ii = function(e) {
2071
- return e === void 0 && (e = 0), {
2072
- name: "offset",
2073
- options: e,
2074
- async fn(r) {
2075
- var t, n;
2076
- const {
2077
- x: o,
2078
- y: s,
2079
- placement: i,
2080
- middlewareData: a
2081
- } = r, c = await ki(r, e);
2082
- return i === ((t = a.offset) == null ? void 0 : t.placement) && (n = a.arrow) != null && n.alignmentOffset ? {} : {
2083
- x: o + c.x,
2084
- y: s + c.y,
2085
- data: {
2086
- ...c,
2087
- placement: i
2088
- }
2089
- };
2090
- }
2091
- };
2092
- }, Vi = function(e) {
2093
- return e === void 0 && (e = {}), {
2094
- name: "shift",
2095
- options: e,
2096
- async fn(r) {
2097
- const {
2098
- x: t,
2099
- y: n,
2100
- placement: o
2101
- } = r, {
2102
- mainAxis: s = !0,
2103
- crossAxis: i = !1,
2104
- limiter: a = {
2105
- fn: (S) => {
2106
- let {
2107
- x: b,
2108
- y: v
2109
- } = S;
2110
- return {
2111
- x: b,
2112
- y: v
2113
- };
2114
- }
2115
- },
2116
- ...c
2117
- } = Ie(e, r), u = {
2118
- x: t,
2119
- y: n
2120
- }, f = await At(r, c), d = wt(Ve(o)), g = Yr(d);
2121
- let x = u[g], y = u[d];
2122
- if (s) {
2123
- const S = g === "y" ? "top" : "left", b = g === "y" ? "bottom" : "right", v = x + f[S], C = x - f[b];
2124
- x = Nr(v, x, C);
2125
- }
2126
- if (i) {
2127
- const S = d === "y" ? "top" : "left", b = d === "y" ? "bottom" : "right", v = y + f[S], C = y - f[b];
2128
- y = Nr(v, y, C);
2129
- }
2130
- const p = a.fn({
2131
- ...r,
2132
- [g]: x,
2133
- [d]: y
2134
- });
2135
- return {
2136
- ...p,
2137
- data: {
2138
- x: p.x - t,
2139
- y: p.y - n
2140
- }
2141
- };
2142
- }
2143
- };
2144
- }, Li = function(e) {
2145
- return e === void 0 && (e = {}), {
2146
- options: e,
2147
- fn(r) {
2148
- const {
2149
- x: t,
2150
- y: n,
2151
- placement: o,
2152
- rects: s,
2153
- middlewareData: i
2154
- } = r, {
2155
- offset: a = 0,
2156
- mainAxis: c = !0,
2157
- crossAxis: u = !0
2158
- } = Ie(e, r), f = {
2159
- x: t,
2160
- y: n
2161
- }, d = wt(o), g = Yr(d);
2162
- let x = f[g], y = f[d];
2163
- const p = Ie(a, r), S = typeof p == "number" ? {
2164
- mainAxis: p,
2165
- crossAxis: 0
2166
- } : {
2167
- mainAxis: 0,
2168
- crossAxis: 0,
2169
- ...p
2170
- };
2171
- if (c) {
2172
- const C = g === "y" ? "height" : "width", R = s.reference[g] - s.floating[C] + S.mainAxis, w = s.reference[g] + s.reference[C] - S.mainAxis;
2173
- x < R ? x = R : x > w && (x = w);
2174
- }
2175
- if (u) {
2176
- var b, v;
2177
- const C = g === "y" ? "width" : "height", R = ["top", "left"].includes(Ve(o)), w = s.reference[d] - s.floating[C] + (R && ((b = i.offset) == null ? void 0 : b[d]) || 0) + (R ? 0 : S.crossAxis), A = s.reference[d] + s.reference[C] + (R ? 0 : ((v = i.offset) == null ? void 0 : v[d]) || 0) - (R ? S.crossAxis : 0);
2178
- y < w ? y = w : y > A && (y = A);
2179
- }
2180
- return {
2181
- [g]: x,
2182
- [d]: y
2183
- };
2184
- }
2185
- };
2186
- }, ji = function(e) {
2187
- return e === void 0 && (e = {}), {
2188
- name: "size",
2189
- options: e,
2190
- async fn(r) {
2191
- const {
2192
- placement: t,
2193
- rects: n,
2194
- platform: o,
2195
- elements: s
2196
- } = r, {
2197
- apply: i = () => {
2198
- },
2199
- ...a
2200
- } = Ie(e, r), c = await At(r, a), u = Ve(t), f = yt(t), d = wt(t) === "y", {
2201
- width: g,
2202
- height: x
2203
- } = n.floating;
2204
- let y, p;
2205
- u === "top" || u === "bottom" ? (y = u, p = f === (await (o.isRTL == null ? void 0 : o.isRTL(s.floating)) ? "start" : "end") ? "left" : "right") : (p = u, y = f === "end" ? "top" : "bottom");
2206
- const S = x - c[y], b = g - c[p], v = !r.middlewareData.shift;
2207
- let C = S, R = b;
2208
- if (d) {
2209
- const A = g - c.left - c.right;
2210
- R = f || v ? Ke(b, A) : A;
2211
- } else {
2212
- const A = x - c.top - c.bottom;
2213
- C = f || v ? Ke(S, A) : A;
2214
- }
2215
- if (v && !f) {
2216
- const A = ge(c.left, 0), _ = ge(c.right, 0), M = ge(c.top, 0), H = ge(c.bottom, 0);
2217
- d ? R = g - 2 * (A !== 0 || _ !== 0 ? A + _ : ge(c.left, c.right)) : C = x - 2 * (M !== 0 || H !== 0 ? M + H : ge(c.top, c.bottom));
2218
- }
2219
- await i({
2220
- ...r,
2221
- availableWidth: R,
2222
- availableHeight: C
2223
- });
2224
- const w = await o.getDimensions(s.floating);
2225
- return g !== w.width || x !== w.height ? {
2226
- reset: {
2227
- rects: !0
2228
- }
2229
- } : {};
2230
- }
2231
- };
2232
- };
2233
- function xt(e) {
2234
- return lo(e) ? (e.nodeName || "").toLowerCase() : "#document";
2235
- }
2236
- function ye(e) {
2237
- var r;
2238
- return (e == null || (r = e.ownerDocument) == null ? void 0 : r.defaultView) || window;
2239
- }
2240
- function Le(e) {
2241
- var r;
2242
- return (r = (lo(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : r.documentElement;
2243
- }
2244
- function lo(e) {
2245
- return e instanceof Node || e instanceof ye(e).Node;
2246
- }
2247
- function Te(e) {
2248
- return e instanceof Element || e instanceof ye(e).Element;
2249
- }
2250
- function Oe(e) {
2251
- return e instanceof HTMLElement || e instanceof ye(e).HTMLElement;
2252
- }
2253
- function _n(e) {
2254
- return typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof ye(e).ShadowRoot;
2255
- }
2256
- function Tt(e) {
2257
- const {
2258
- overflow: r,
2259
- overflowX: t,
2260
- overflowY: n,
2261
- display: o
2262
- } = Ae(e);
2263
- return /auto|scroll|overlay|hidden|clip/.test(r + n + t) && !["inline", "contents"].includes(o);
2264
- }
2265
- function Bi(e) {
2266
- return ["table", "td", "th"].includes(xt(e));
2267
- }
2268
- function Gr(e) {
2269
- const r = Zr(), t = Ae(e);
2270
- return t.transform !== "none" || t.perspective !== "none" || (t.containerType ? t.containerType !== "normal" : !1) || !r && (t.backdropFilter ? t.backdropFilter !== "none" : !1) || !r && (t.filter ? t.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((n) => (t.willChange || "").includes(n)) || ["paint", "layout", "strict", "content"].some((n) => (t.contain || "").includes(n));
2271
- }
2272
- function Wi(e) {
2273
- let r = qe(e);
2274
- for (; Oe(r) && !gt(r); ) {
2275
- if (Gr(r))
2276
- return r;
2277
- r = qe(r);
2278
- }
2279
- return null;
2280
- }
2281
- function Zr() {
2282
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
2283
- }
2284
- function gt(e) {
2285
- return ["html", "body", "#document"].includes(xt(e));
2286
- }
2287
- function Ae(e) {
2288
- return ye(e).getComputedStyle(e);
2289
- }
2290
- function tr(e) {
2291
- return Te(e) ? {
2292
- scrollLeft: e.scrollLeft,
2293
- scrollTop: e.scrollTop
2294
- } : {
2295
- scrollLeft: e.pageXOffset,
2296
- scrollTop: e.pageYOffset
2297
- };
2298
- }
2299
- function qe(e) {
2300
- if (xt(e) === "html")
2301
- return e;
2302
- const r = (
2303
- // Step into the shadow DOM of the parent of a slotted node.
2304
- e.assignedSlot || // DOM Element detected.
2305
- e.parentNode || // ShadowRoot detected.
2306
- _n(e) && e.host || // Fallback.
2307
- Le(e)
2308
- );
2309
- return _n(r) ? r.host : r;
2310
- }
2311
- function uo(e) {
2312
- const r = qe(e);
2313
- return gt(r) ? e.ownerDocument ? e.ownerDocument.body : e.body : Oe(r) && Tt(r) ? r : uo(r);
2314
- }
2315
- function _t(e, r, t) {
2316
- var n;
2317
- r === void 0 && (r = []), t === void 0 && (t = !0);
2318
- const o = uo(e), s = o === ((n = e.ownerDocument) == null ? void 0 : n.body), i = ye(o);
2319
- return s ? r.concat(i, i.visualViewport || [], Tt(o) ? o : [], i.frameElement && t ? _t(i.frameElement) : []) : r.concat(o, _t(o, [], t));
2320
- }
2321
- function fo(e) {
2322
- const r = Ae(e);
2323
- let t = parseFloat(r.width) || 0, n = parseFloat(r.height) || 0;
2324
- const o = Oe(e), s = o ? e.offsetWidth : t, i = o ? e.offsetHeight : n, a = qt(t) !== s || qt(n) !== i;
2325
- return a && (t = s, n = i), {
2326
- width: t,
2327
- height: n,
2328
- $: a
2329
- };
2330
- }
2331
- function Qr(e) {
2332
- return Te(e) ? e : e.contextElement;
2333
- }
2334
- function mt(e) {
2335
- const r = Qr(e);
2336
- if (!Oe(r))
2337
- return Ye(1);
2338
- const t = r.getBoundingClientRect(), {
2339
- width: n,
2340
- height: o,
2341
- $: s
2342
- } = fo(r);
2343
- let i = (s ? qt(t.width) : t.width) / n, a = (s ? qt(t.height) : t.height) / o;
2344
- return (!i || !Number.isFinite(i)) && (i = 1), (!a || !Number.isFinite(a)) && (a = 1), {
2345
- x: i,
2346
- y: a
2347
- };
2348
- }
2349
- const Hi = /* @__PURE__ */ Ye(0);
2350
- function ho(e) {
2351
- const r = ye(e);
2352
- return !Zr() || !r.visualViewport ? Hi : {
2353
- x: r.visualViewport.offsetLeft,
2354
- y: r.visualViewport.offsetTop
2355
- };
2356
- }
2357
- function Ui(e, r, t) {
2358
- return r === void 0 && (r = !1), !t || r && t !== ye(e) ? !1 : r;
2359
- }
2360
- function et(e, r, t, n) {
2361
- r === void 0 && (r = !1), t === void 0 && (t = !1);
2362
- const o = e.getBoundingClientRect(), s = Qr(e);
2363
- let i = Ye(1);
2364
- r && (n ? Te(n) && (i = mt(n)) : i = mt(e));
2365
- const a = Ui(s, t, n) ? ho(s) : Ye(0);
2366
- let c = (o.left + a.x) / i.x, u = (o.top + a.y) / i.y, f = o.width / i.x, d = o.height / i.y;
2367
- if (s) {
2368
- const g = ye(s), x = n && Te(n) ? ye(n) : n;
2369
- let y = g, p = y.frameElement;
2370
- for (; p && n && x !== y; ) {
2371
- const S = mt(p), b = p.getBoundingClientRect(), v = Ae(p), C = b.left + (p.clientLeft + parseFloat(v.paddingLeft)) * S.x, R = b.top + (p.clientTop + parseFloat(v.paddingTop)) * S.y;
2372
- c *= S.x, u *= S.y, f *= S.x, d *= S.y, c += C, u += R, y = ye(p), p = y.frameElement;
2373
- }
2374
- }
2375
- return Gt({
2376
- width: f,
2377
- height: d,
2378
- x: c,
2379
- y: u
2380
- });
2381
- }
2382
- const $i = [":popover-open", ":modal"];
2383
- function Jr(e) {
2384
- return $i.some((r) => {
2385
- try {
2386
- return e.matches(r);
2387
- } catch {
2388
- return !1;
2389
- }
2390
- });
2391
- }
2392
- function zi(e) {
2393
- let {
2394
- elements: r,
2395
- rect: t,
2396
- offsetParent: n,
2397
- strategy: o
2398
- } = e;
2399
- const s = o === "fixed", i = Le(n), a = r ? Jr(r.floating) : !1;
2400
- if (n === i || a && s)
2401
- return t;
2402
- let c = {
2403
- scrollLeft: 0,
2404
- scrollTop: 0
2405
- }, u = Ye(1);
2406
- const f = Ye(0), d = Oe(n);
2407
- if ((d || !d && !s) && ((xt(n) !== "body" || Tt(i)) && (c = tr(n)), Oe(n))) {
2408
- const g = et(n);
2409
- u = mt(n), f.x = g.x + n.clientLeft, f.y = g.y + n.clientTop;
2410
- }
2411
- return {
2412
- width: t.width * u.x,
2413
- height: t.height * u.y,
2414
- x: t.x * u.x - c.scrollLeft * u.x + f.x,
2415
- y: t.y * u.y - c.scrollTop * u.y + f.y
2416
- };
2417
- }
2418
- function Ki(e) {
2419
- return Array.from(e.getClientRects());
2420
- }
2421
- function po(e) {
2422
- return et(Le(e)).left + tr(e).scrollLeft;
2423
- }
2424
- function Yi(e) {
2425
- const r = Le(e), t = tr(e), n = e.ownerDocument.body, o = ge(r.scrollWidth, r.clientWidth, n.scrollWidth, n.clientWidth), s = ge(r.scrollHeight, r.clientHeight, n.scrollHeight, n.clientHeight);
2426
- let i = -t.scrollLeft + po(e);
2427
- const a = -t.scrollTop;
2428
- return Ae(n).direction === "rtl" && (i += ge(r.clientWidth, n.clientWidth) - o), {
2429
- width: o,
2430
- height: s,
2431
- x: i,
2432
- y: a
2433
- };
2434
- }
2435
- function qi(e, r) {
2436
- const t = ye(e), n = Le(e), o = t.visualViewport;
2437
- let s = n.clientWidth, i = n.clientHeight, a = 0, c = 0;
2438
- if (o) {
2439
- s = o.width, i = o.height;
2440
- const u = Zr();
2441
- (!u || u && r === "fixed") && (a = o.offsetLeft, c = o.offsetTop);
2442
- }
2443
- return {
2444
- width: s,
2445
- height: i,
2446
- x: a,
2447
- y: c
2448
- };
2449
- }
2450
- function Xi(e, r) {
2451
- const t = et(e, !0, r === "fixed"), n = t.top + e.clientTop, o = t.left + e.clientLeft, s = Oe(e) ? mt(e) : Ye(1), i = e.clientWidth * s.x, a = e.clientHeight * s.y, c = o * s.x, u = n * s.y;
2452
- return {
2453
- width: i,
2454
- height: a,
2455
- x: c,
2456
- y: u
2457
- };
2458
- }
2459
- function Rn(e, r, t) {
2460
- let n;
2461
- if (r === "viewport")
2462
- n = qi(e, t);
2463
- else if (r === "document")
2464
- n = Yi(Le(e));
2465
- else if (Te(r))
2466
- n = Xi(r, t);
2467
- else {
2468
- const o = ho(e);
2469
- n = {
2470
- ...r,
2471
- x: r.x - o.x,
2472
- y: r.y - o.y
2473
- };
2474
- }
2475
- return Gt(n);
2476
- }
2477
- function mo(e, r) {
2478
- const t = qe(e);
2479
- return t === r || !Te(t) || gt(t) ? !1 : Ae(t).position === "fixed" || mo(t, r);
2480
- }
2481
- function Gi(e, r) {
2482
- const t = r.get(e);
2483
- if (t)
2484
- return t;
2485
- let n = _t(e, [], !1).filter((a) => Te(a) && xt(a) !== "body"), o = null;
2486
- const s = Ae(e).position === "fixed";
2487
- let i = s ? qe(e) : e;
2488
- for (; Te(i) && !gt(i); ) {
2489
- const a = Ae(i), c = Gr(i);
2490
- !c && a.position === "fixed" && (o = null), (s ? !c && !o : !c && a.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || Tt(i) && !c && mo(e, i)) ? n = n.filter((f) => f !== i) : o = a, i = qe(i);
2491
- }
2492
- return r.set(e, n), n;
2493
- }
2494
- function Zi(e) {
2495
- let {
2496
- element: r,
2497
- boundary: t,
2498
- rootBoundary: n,
2499
- strategy: o
2500
- } = e;
2501
- const i = [...t === "clippingAncestors" ? Jr(r) ? [] : Gi(r, this._c) : [].concat(t), n], a = i[0], c = i.reduce((u, f) => {
2502
- const d = Rn(r, f, o);
2503
- return u.top = ge(d.top, u.top), u.right = Ke(d.right, u.right), u.bottom = Ke(d.bottom, u.bottom), u.left = ge(d.left, u.left), u;
2504
- }, Rn(r, a, o));
2505
- return {
2506
- width: c.right - c.left,
2507
- height: c.bottom - c.top,
2508
- x: c.left,
2509
- y: c.top
2510
- };
2511
- }
2512
- function Qi(e) {
2513
- const {
2514
- width: r,
2515
- height: t
2516
- } = fo(e);
2517
- return {
2518
- width: r,
2519
- height: t
2520
- };
2521
- }
2522
- function Ji(e, r, t) {
2523
- const n = Oe(r), o = Le(r), s = t === "fixed", i = et(e, !0, s, r);
2524
- let a = {
2525
- scrollLeft: 0,
2526
- scrollTop: 0
2527
- };
2528
- const c = Ye(0);
2529
- if (n || !n && !s)
2530
- if ((xt(r) !== "body" || Tt(o)) && (a = tr(r)), n) {
2531
- const d = et(r, !0, s, r);
2532
- c.x = d.x + r.clientLeft, c.y = d.y + r.clientTop;
2533
- } else o && (c.x = po(o));
2534
- const u = i.left + a.scrollLeft - c.x, f = i.top + a.scrollTop - c.y;
2535
- return {
2536
- x: u,
2537
- y: f,
2538
- width: i.width,
2539
- height: i.height
2540
- };
2541
- }
2542
- function Er(e) {
2543
- return Ae(e).position === "static";
2544
- }
2545
- function Pn(e, r) {
2546
- return !Oe(e) || Ae(e).position === "fixed" ? null : r ? r(e) : e.offsetParent;
2547
- }
2548
- function vo(e, r) {
2549
- const t = ye(e);
2550
- if (Jr(e))
2551
- return t;
2552
- if (!Oe(e)) {
2553
- let o = qe(e);
2554
- for (; o && !gt(o); ) {
2555
- if (Te(o) && !Er(o))
2556
- return o;
2557
- o = qe(o);
2558
- }
2559
- return t;
2560
- }
2561
- let n = Pn(e, r);
2562
- for (; n && Bi(n) && Er(n); )
2563
- n = Pn(n, r);
2564
- return n && gt(n) && Er(n) && !Gr(n) ? t : n || Wi(e) || t;
2565
- }
2566
- const ea = async function(e) {
2567
- const r = this.getOffsetParent || vo, t = this.getDimensions, n = await t(e.floating);
2568
- return {
2569
- reference: Ji(e.reference, await r(e.floating), e.strategy),
2570
- floating: {
2571
- x: 0,
2572
- y: 0,
2573
- width: n.width,
2574
- height: n.height
2575
- }
2576
- };
2577
- };
2578
- function ta(e) {
2579
- return Ae(e).direction === "rtl";
2580
- }
2581
- const ra = {
2582
- convertOffsetParentRelativeRectToViewportRelativeRect: zi,
2583
- getDocumentElement: Le,
2584
- getClippingRect: Zi,
2585
- getOffsetParent: vo,
2586
- getElementRects: ea,
2587
- getClientRects: Ki,
2588
- getDimensions: Qi,
2589
- getScale: mt,
2590
- isElement: Te,
2591
- isRTL: ta
2592
- };
2593
- function na(e, r) {
2594
- let t = null, n;
2595
- const o = Le(e);
2596
- function s() {
2597
- var a;
2598
- clearTimeout(n), (a = t) == null || a.disconnect(), t = null;
2599
- }
2600
- function i(a, c) {
2601
- a === void 0 && (a = !1), c === void 0 && (c = 1), s();
2602
- const {
2603
- left: u,
2604
- top: f,
2605
- width: d,
2606
- height: g
2607
- } = e.getBoundingClientRect();
2608
- if (a || r(), !d || !g)
2609
- return;
2610
- const x = Nt(f), y = Nt(o.clientWidth - (u + d)), p = Nt(o.clientHeight - (f + g)), S = Nt(u), v = {
2611
- rootMargin: -x + "px " + -y + "px " + -p + "px " + -S + "px",
2612
- threshold: ge(0, Ke(1, c)) || 1
2613
- };
2614
- let C = !0;
2615
- function R(w) {
2616
- const A = w[0].intersectionRatio;
2617
- if (A !== c) {
2618
- if (!C)
2619
- return i();
2620
- A ? i(!1, A) : n = setTimeout(() => {
2621
- i(!1, 1e-7);
2622
- }, 1e3);
2623
- }
2624
- C = !1;
2625
- }
2626
- try {
2627
- t = new IntersectionObserver(R, {
2628
- ...v,
2629
- // Handle <iframe>s
2630
- root: o.ownerDocument
2631
- });
2632
- } catch {
2633
- t = new IntersectionObserver(R, v);
2634
- }
2635
- t.observe(e);
2636
- }
2637
- return i(!0), s;
2638
- }
2639
- function oa(e, r, t, n) {
2640
- n === void 0 && (n = {});
2641
- const {
2642
- ancestorScroll: o = !0,
2643
- ancestorResize: s = !0,
2644
- elementResize: i = typeof ResizeObserver == "function",
2645
- layoutShift: a = typeof IntersectionObserver == "function",
2646
- animationFrame: c = !1
2647
- } = n, u = Qr(e), f = o || s ? [...u ? _t(u) : [], ..._t(r)] : [];
2648
- f.forEach((b) => {
2649
- o && b.addEventListener("scroll", t, {
2650
- passive: !0
2651
- }), s && b.addEventListener("resize", t);
2652
- });
2653
- const d = u && a ? na(u, t) : null;
2654
- let g = -1, x = null;
2655
- i && (x = new ResizeObserver((b) => {
2656
- let [v] = b;
2657
- v && v.target === u && x && (x.unobserve(r), cancelAnimationFrame(g), g = requestAnimationFrame(() => {
2658
- var C;
2659
- (C = x) == null || C.observe(r);
2660
- })), t();
2661
- }), u && !c && x.observe(u), x.observe(r));
2662
- let y, p = c ? et(e) : null;
2663
- c && S();
2664
- function S() {
2665
- const b = et(e);
2666
- p && (b.x !== p.x || b.y !== p.y || b.width !== p.width || b.height !== p.height) && t(), p = b, y = requestAnimationFrame(S);
2667
- }
2668
- return t(), () => {
2669
- var b;
2670
- f.forEach((v) => {
2671
- o && v.removeEventListener("scroll", t), s && v.removeEventListener("resize", t);
2672
- }), d == null || d(), (b = x) == null || b.disconnect(), x = null, c && cancelAnimationFrame(y);
2673
- };
2674
- }
2675
- const sa = Ii, ia = Vi, aa = Di, ca = ji, la = Mi, Tn = Ni, ua = Li, da = (e, r, t) => {
2676
- const n = /* @__PURE__ */ new Map(), o = {
2677
- platform: ra,
2678
- ...t
2679
- }, s = {
2680
- ...o.platform,
2681
- _c: n
2682
- };
2683
- return Fi(e, r, {
2684
- ...o,
2685
- platform: s
2686
- });
2687
- }, fa = (e) => {
2688
- function r(t) {
2689
- return {}.hasOwnProperty.call(t, "current");
2690
- }
2691
- return {
2692
- name: "arrow",
2693
- options: e,
2694
- fn(t) {
2695
- const {
2696
- element: n,
2697
- padding: o
2698
- } = typeof e == "function" ? e(t) : e;
2699
- return n && r(n) ? n.current != null ? Tn({
2700
- element: n.current,
2701
- padding: o
2702
- }).fn(t) : {} : n ? Tn({
2703
- element: n,
2704
- padding: o
2705
- }).fn(t) : {};
2706
- }
2707
- };
2708
- };
2709
- var jt = typeof document < "u" ? Rs : Ps;
2710
- function Zt(e, r) {
2711
- if (e === r)
2712
- return !0;
2713
- if (typeof e != typeof r)
2714
- return !1;
2715
- if (typeof e == "function" && e.toString() === r.toString())
2716
- return !0;
2717
- let t, n, o;
2718
- if (e && r && typeof e == "object") {
2719
- if (Array.isArray(e)) {
2720
- if (t = e.length, t !== r.length) return !1;
2721
- for (n = t; n-- !== 0; )
2722
- if (!Zt(e[n], r[n]))
2723
- return !1;
2724
- return !0;
2725
- }
2726
- if (o = Object.keys(e), t = o.length, t !== Object.keys(r).length)
2727
- return !1;
2728
- for (n = t; n-- !== 0; )
2729
- if (!{}.hasOwnProperty.call(r, o[n]))
2730
- return !1;
2731
- for (n = t; n-- !== 0; ) {
2732
- const s = o[n];
2733
- if (!(s === "_owner" && e.$$typeof) && !Zt(e[s], r[s]))
2734
- return !1;
2735
- }
2736
- return !0;
2737
- }
2738
- return e !== e && r !== r;
2739
- }
2740
- function go(e) {
2741
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
2742
- }
2743
- function On(e, r) {
2744
- const t = go(e);
2745
- return Math.round(r * t) / t;
2746
- }
2747
- function Fn(e) {
2748
- const r = h.useRef(e);
2749
- return jt(() => {
2750
- r.current = e;
2751
- }), r;
2752
- }
2753
- function ha(e) {
2754
- e === void 0 && (e = {});
2755
- const {
2756
- placement: r = "bottom",
2757
- strategy: t = "absolute",
2758
- middleware: n = [],
2759
- platform: o,
2760
- elements: {
2761
- reference: s,
2762
- floating: i
2763
- } = {},
2764
- transform: a = !0,
2765
- whileElementsMounted: c,
2766
- open: u
2767
- } = e, [f, d] = h.useState({
2768
- x: 0,
2769
- y: 0,
2770
- strategy: t,
2771
- placement: r,
2772
- middlewareData: {},
2773
- isPositioned: !1
2774
- }), [g, x] = h.useState(n);
2775
- Zt(g, n) || x(n);
2776
- const [y, p] = h.useState(null), [S, b] = h.useState(null), v = h.useCallback((L) => {
2777
- L !== A.current && (A.current = L, p(L));
2778
- }, []), C = h.useCallback((L) => {
2779
- L !== _.current && (_.current = L, b(L));
2780
- }, []), R = s || y, w = i || S, A = h.useRef(null), _ = h.useRef(null), M = h.useRef(f), H = c != null, U = Fn(c), J = Fn(o), D = h.useCallback(() => {
2781
- if (!A.current || !_.current)
2782
- return;
2783
- const L = {
2784
- placement: r,
2785
- strategy: t,
2786
- middleware: g
2787
- };
2788
- J.current && (L.platform = J.current), da(A.current, _.current, L).then((Z) => {
2789
- const ee = {
2790
- ...Z,
2791
- isPositioned: !0
2792
- };
2793
- I.current && !Zt(M.current, ee) && (M.current = ee, Hr.flushSync(() => {
2794
- d(ee);
2795
- }));
2796
- });
2797
- }, [g, r, t, J]);
2798
- jt(() => {
2799
- u === !1 && M.current.isPositioned && (M.current.isPositioned = !1, d((L) => ({
2800
- ...L,
2801
- isPositioned: !1
2802
- })));
2803
- }, [u]);
2804
- const I = h.useRef(!1);
2805
- jt(() => (I.current = !0, () => {
2806
- I.current = !1;
2807
- }), []), jt(() => {
2808
- if (R && (A.current = R), w && (_.current = w), R && w) {
2809
- if (U.current)
2810
- return U.current(R, w, D);
2811
- D();
2812
- }
2813
- }, [R, w, D, U, H]);
2814
- const B = h.useMemo(() => ({
2815
- reference: A,
2816
- floating: _,
2817
- setReference: v,
2818
- setFloating: C
2819
- }), [v, C]), V = h.useMemo(() => ({
2820
- reference: R,
2821
- floating: w
2822
- }), [R, w]), $ = h.useMemo(() => {
2823
- const L = {
2824
- position: t,
2825
- left: 0,
2826
- top: 0
2827
- };
2828
- if (!V.floating)
2829
- return L;
2830
- const Z = On(V.floating, f.x), ee = On(V.floating, f.y);
2831
- return a ? {
2832
- ...L,
2833
- transform: "translate(" + Z + "px, " + ee + "px)",
2834
- ...go(V.floating) >= 1.5 && {
2835
- willChange: "transform"
2836
- }
2837
- } : {
2838
- position: t,
2839
- left: Z,
2840
- top: ee
2841
- };
2842
- }, [t, a, V.floating, f.x, f.y]);
2843
- return h.useMemo(() => ({
2844
- ...f,
2845
- update: D,
2846
- refs: B,
2847
- elements: V,
2848
- floatingStyles: $
2849
- }), [f, D, B, V, $]);
2850
- }
2851
- var pa = "Arrow", yo = h.forwardRef((e, r) => {
2852
- const { children: t, width: n = 10, height: o = 5, ...s } = e;
2853
- return /* @__PURE__ */ P.jsx(
2854
- oe.svg,
2855
- {
2856
- ...s,
2857
- ref: r,
2858
- width: n,
2859
- height: o,
2860
- viewBox: "0 0 30 10",
2861
- preserveAspectRatio: "none",
2862
- children: e.asChild ? t : /* @__PURE__ */ P.jsx("polygon", { points: "0,0 30,0 15,10" })
2863
- }
2864
- );
2865
- });
2866
- yo.displayName = pa;
2867
- var ma = yo;
2868
- function va(e) {
2869
- const [r, t] = h.useState(void 0);
2870
- return be(() => {
2871
- if (e) {
2872
- t({ width: e.offsetWidth, height: e.offsetHeight });
2873
- const n = new ResizeObserver((o) => {
2874
- if (!Array.isArray(o) || !o.length)
2875
- return;
2876
- const s = o[0];
2877
- let i, a;
2878
- if ("borderBoxSize" in s) {
2879
- const c = s.borderBoxSize, u = Array.isArray(c) ? c[0] : c;
2880
- i = u.inlineSize, a = u.blockSize;
2881
- } else
2882
- i = e.offsetWidth, a = e.offsetHeight;
2883
- t({ width: i, height: a });
2884
- });
2885
- return n.observe(e, { box: "border-box" }), () => n.unobserve(e);
2886
- } else
2887
- t(void 0);
2888
- }, [e]), r;
2889
- }
2890
- var en = "Popper", [wo, xo] = Br(en), [ga, bo] = wo(en), So = (e) => {
2891
- const { __scopePopper: r, children: t } = e, [n, o] = h.useState(null);
2892
- return /* @__PURE__ */ P.jsx(ga, { scope: r, anchor: n, onAnchorChange: o, children: t });
2893
- };
2894
- So.displayName = en;
2895
- var Eo = "PopperAnchor", Co = h.forwardRef(
2896
- (e, r) => {
2897
- const { __scopePopper: t, virtualRef: n, ...o } = e, s = bo(Eo, t), i = h.useRef(null), a = le(r, i);
2898
- return h.useEffect(() => {
2899
- s.onAnchorChange((n == null ? void 0 : n.current) || i.current);
2900
- }), n ? null : /* @__PURE__ */ P.jsx(oe.div, { ...o, ref: a });
2901
- }
2902
- );
2903
- Co.displayName = Eo;
2904
- var tn = "PopperContent", [ya, wa] = wo(tn), Ao = h.forwardRef(
2905
- (e, r) => {
2906
- var W, q, se, X, z, K;
2907
- const {
2908
- __scopePopper: t,
2909
- side: n = "bottom",
2910
- sideOffset: o = 0,
2911
- align: s = "center",
2912
- alignOffset: i = 0,
2913
- arrowPadding: a = 0,
2914
- avoidCollisions: c = !0,
2915
- collisionBoundary: u = [],
2916
- collisionPadding: f = 0,
2917
- sticky: d = "partial",
2918
- hideWhenDetached: g = !1,
2919
- updatePositionStrategy: x = "optimized",
2920
- onPlaced: y,
2921
- ...p
2922
- } = e, S = bo(tn, t), [b, v] = h.useState(null), C = le(r, (ue) => v(ue)), [R, w] = h.useState(null), A = va(R), _ = (A == null ? void 0 : A.width) ?? 0, M = (A == null ? void 0 : A.height) ?? 0, H = n + (s !== "center" ? "-" + s : ""), U = typeof f == "number" ? f : { top: 0, right: 0, bottom: 0, left: 0, ...f }, J = Array.isArray(u) ? u : [u], D = J.length > 0, I = {
2923
- padding: U,
2924
- boundary: J.filter(ba),
2925
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
2926
- altBoundary: D
2927
- }, { refs: B, floatingStyles: V, placement: $, isPositioned: L, middlewareData: Z } = ha({
2928
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
2929
- strategy: "fixed",
2930
- placement: H,
2931
- whileElementsMounted: (...ue) => oa(...ue, {
2932
- animationFrame: x === "always"
2933
- }),
2934
- elements: {
2935
- reference: S.anchor
2936
- },
2937
- middleware: [
2938
- sa({ mainAxis: o + M, alignmentAxis: i }),
2939
- c && ia({
2940
- mainAxis: !0,
2941
- crossAxis: !1,
2942
- limiter: d === "partial" ? ua() : void 0,
2943
- ...I
2944
- }),
2945
- c && aa({ ...I }),
2946
- ca({
2947
- ...I,
2948
- apply: ({ elements: ue, rects: me, availableWidth: rt, availableHeight: nt }) => {
2949
- const { width: ot, height: l } = me.reference, m = ue.floating.style;
2950
- m.setProperty("--radix-popper-available-width", `${rt}px`), m.setProperty("--radix-popper-available-height", `${nt}px`), m.setProperty("--radix-popper-anchor-width", `${ot}px`), m.setProperty("--radix-popper-anchor-height", `${l}px`);
2951
- }
2952
- }),
2953
- R && fa({ element: R, padding: a }),
2954
- Sa({ arrowWidth: _, arrowHeight: M }),
2955
- g && la({ strategy: "referenceHidden", ...I })
2956
- ]
2957
- }), [ee, Se] = Po($), we = Je(y);
2958
- be(() => {
2959
- L && (we == null || we());
2960
- }, [L, we]);
2961
- const je = (W = Z.arrow) == null ? void 0 : W.x, Ze = (q = Z.arrow) == null ? void 0 : q.y, Ee = ((se = Z.arrow) == null ? void 0 : se.centerOffset) !== 0, [Be, Ce] = h.useState();
2962
- return be(() => {
2963
- b && Ce(window.getComputedStyle(b).zIndex);
2964
- }, [b]), /* @__PURE__ */ P.jsx(
2965
- "div",
2966
- {
2967
- ref: B.setFloating,
2968
- "data-radix-popper-content-wrapper": "",
2969
- style: {
2970
- ...V,
2971
- transform: L ? V.transform : "translate(0, -200%)",
2972
- // keep off the page when measuring
2973
- minWidth: "max-content",
2974
- zIndex: Be,
2975
- "--radix-popper-transform-origin": [
2976
- (X = Z.transformOrigin) == null ? void 0 : X.x,
2977
- (z = Z.transformOrigin) == null ? void 0 : z.y
2978
- ].join(" "),
2979
- // hide the content if using the hide middleware and should be hidden
2980
- // set visibility to hidden and disable pointer events so the UI behaves
2981
- // as if the PopperContent isn't there at all
2982
- ...((K = Z.hide) == null ? void 0 : K.referenceHidden) && {
2983
- visibility: "hidden",
2984
- pointerEvents: "none"
2985
- }
2986
- },
2987
- dir: e.dir,
2988
- children: /* @__PURE__ */ P.jsx(
2989
- ya,
2990
- {
2991
- scope: t,
2992
- placedSide: ee,
2993
- onArrowChange: w,
2994
- arrowX: je,
2995
- arrowY: Ze,
2996
- shouldHideArrow: Ee,
2997
- children: /* @__PURE__ */ P.jsx(
2998
- oe.div,
2999
- {
3000
- "data-side": ee,
3001
- "data-align": Se,
3002
- ...p,
3003
- ref: C,
3004
- style: {
3005
- ...p.style,
3006
- // if the PopperContent hasn't been placed yet (not all measurements done)
3007
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
3008
- animation: L ? void 0 : "none"
3009
- }
3010
- }
3011
- )
3012
- }
3013
- )
3014
- }
3015
- );
3016
- }
3017
- );
3018
- Ao.displayName = tn;
3019
- var _o = "PopperArrow", xa = {
3020
- top: "bottom",
3021
- right: "left",
3022
- bottom: "top",
3023
- left: "right"
3024
- }, Ro = h.forwardRef(function(r, t) {
3025
- const { __scopePopper: n, ...o } = r, s = wa(_o, n), i = xa[s.placedSide];
3026
- return (
3027
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
3028
- // doesn't report size as we'd expect on SVG elements.
3029
- // it reports their bounding box which is effectively the largest path inside the SVG.
3030
- /* @__PURE__ */ P.jsx(
3031
- "span",
3032
- {
3033
- ref: s.onArrowChange,
3034
- style: {
3035
- position: "absolute",
3036
- left: s.arrowX,
3037
- top: s.arrowY,
3038
- [i]: 0,
3039
- transformOrigin: {
3040
- top: "",
3041
- right: "0 0",
3042
- bottom: "center 0",
3043
- left: "100% 0"
3044
- }[s.placedSide],
3045
- transform: {
3046
- top: "translateY(100%)",
3047
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
3048
- bottom: "rotate(180deg)",
3049
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
3050
- }[s.placedSide],
3051
- visibility: s.shouldHideArrow ? "hidden" : void 0
3052
- },
3053
- children: /* @__PURE__ */ P.jsx(
3054
- ma,
3055
- {
3056
- ...o,
3057
- ref: t,
3058
- style: {
3059
- ...o.style,
3060
- // ensures the element can be measured correctly (mostly for if SVG)
3061
- display: "block"
3062
- }
3063
- }
3064
- )
3065
- }
3066
- )
3067
- );
3068
- });
3069
- Ro.displayName = _o;
3070
- function ba(e) {
3071
- return e !== null;
3072
- }
3073
- var Sa = (e) => ({
3074
- name: "transformOrigin",
3075
- options: e,
3076
- fn(r) {
3077
- var S, b, v;
3078
- const { placement: t, rects: n, middlewareData: o } = r, i = ((S = o.arrow) == null ? void 0 : S.centerOffset) !== 0, a = i ? 0 : e.arrowWidth, c = i ? 0 : e.arrowHeight, [u, f] = Po(t), d = { start: "0%", center: "50%", end: "100%" }[f], g = (((b = o.arrow) == null ? void 0 : b.x) ?? 0) + a / 2, x = (((v = o.arrow) == null ? void 0 : v.y) ?? 0) + c / 2;
3079
- let y = "", p = "";
3080
- return u === "bottom" ? (y = i ? d : `${g}px`, p = `${-c}px`) : u === "top" ? (y = i ? d : `${g}px`, p = `${n.floating.height + c}px`) : u === "right" ? (y = `${-c}px`, p = i ? d : `${x}px`) : u === "left" && (y = `${n.floating.width + c}px`, p = i ? d : `${x}px`), { data: { x: y, y: p } };
3081
- }
3082
- });
3083
- function Po(e) {
3084
- const [r, t = "center"] = e.split("-");
3085
- return [r, t];
3086
- }
3087
- var Ea = So, Ca = Co, Aa = Ao, _a = Ro, Ra = "Portal", To = h.forwardRef((e, r) => {
3088
- var a;
3089
- const { container: t, ...n } = e, [o, s] = h.useState(!1);
3090
- be(() => s(!0), []);
3091
- const i = t || o && ((a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : a.body);
3092
- return i ? Vs.createPortal(/* @__PURE__ */ P.jsx(oe.div, { ...n, ref: r }), i) : null;
3093
- });
3094
- To.displayName = Ra;
3095
- function Pa(e) {
3096
- const r = h.useRef({ value: e, previous: e });
3097
- return h.useMemo(() => (r.current.value !== e && (r.current.previous = r.current.value, r.current.value = e), r.current.previous), [e]);
3098
- }
3099
- var Ta = "VisuallyHidden", Oo = h.forwardRef(
3100
- (e, r) => /* @__PURE__ */ P.jsx(
3101
- oe.span,
3102
- {
3103
- ...e,
3104
- ref: r,
3105
- style: {
3106
- // See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
3107
- position: "absolute",
3108
- border: 0,
3109
- width: 1,
3110
- height: 1,
3111
- padding: 0,
3112
- margin: -1,
3113
- overflow: "hidden",
3114
- clip: "rect(0, 0, 0, 0)",
3115
- whiteSpace: "nowrap",
3116
- wordWrap: "normal",
3117
- ...e.style
3118
- }
3119
- }
3120
- )
3121
- );
3122
- Oo.displayName = Ta;
3123
- var Oa = function(e) {
3124
- if (typeof document > "u")
3125
- return null;
3126
- var r = Array.isArray(e) ? e[0] : e;
3127
- return r.ownerDocument.body;
3128
- }, ut = /* @__PURE__ */ new WeakMap(), Dt = /* @__PURE__ */ new WeakMap(), Mt = {}, Cr = 0, Fo = function(e) {
3129
- return e && (e.host || Fo(e.parentNode));
3130
- }, Fa = function(e, r) {
3131
- return r.map(function(t) {
3132
- if (e.contains(t))
3133
- return t;
3134
- var n = Fo(t);
3135
- return n && e.contains(n) ? n : (console.error("aria-hidden", t, "in not contained inside", e, ". Doing nothing"), null);
3136
- }).filter(function(t) {
3137
- return !!t;
3138
- });
3139
- }, Na = function(e, r, t, n) {
3140
- var o = Fa(r, Array.isArray(e) ? e : [e]);
3141
- Mt[t] || (Mt[t] = /* @__PURE__ */ new WeakMap());
3142
- var s = Mt[t], i = [], a = /* @__PURE__ */ new Set(), c = new Set(o), u = function(d) {
3143
- !d || a.has(d) || (a.add(d), u(d.parentNode));
3144
- };
3145
- o.forEach(u);
3146
- var f = function(d) {
3147
- !d || c.has(d) || Array.prototype.forEach.call(d.children, function(g) {
3148
- if (a.has(g))
3149
- f(g);
3150
- else
3151
- try {
3152
- var x = g.getAttribute(n), y = x !== null && x !== "false", p = (ut.get(g) || 0) + 1, S = (s.get(g) || 0) + 1;
3153
- ut.set(g, p), s.set(g, S), i.push(g), p === 1 && y && Dt.set(g, !0), S === 1 && g.setAttribute(t, "true"), y || g.setAttribute(n, "true");
3154
- } catch (b) {
3155
- console.error("aria-hidden: cannot operate on ", g, b);
3156
- }
3157
- });
3158
- };
3159
- return f(r), a.clear(), Cr++, function() {
3160
- i.forEach(function(d) {
3161
- var g = ut.get(d) - 1, x = s.get(d) - 1;
3162
- ut.set(d, g), s.set(d, x), g || (Dt.has(d) || d.removeAttribute(n), Dt.delete(d)), x || d.removeAttribute(t);
3163
- }), Cr--, Cr || (ut = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), Dt = /* @__PURE__ */ new WeakMap(), Mt = {});
3164
- };
3165
- }, Da = function(e, r, t) {
3166
- t === void 0 && (t = "data-aria-hidden");
3167
- var n = Array.from(Array.isArray(e) ? e : [e]), o = Oa(e);
3168
- return o ? (n.push.apply(n, Array.from(o.querySelectorAll("[aria-live]"))), Na(n, o, t, "aria-hidden")) : function() {
3169
- return null;
3170
- };
3171
- }, Re = function() {
3172
- return Re = Object.assign || function(r) {
3173
- for (var t, n = 1, o = arguments.length; n < o; n++) {
3174
- t = arguments[n];
3175
- for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && (r[s] = t[s]);
3176
- }
3177
- return r;
3178
- }, Re.apply(this, arguments);
3179
- };
3180
- function No(e, r) {
3181
- var t = {};
3182
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && r.indexOf(n) < 0 && (t[n] = e[n]);
3183
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
3184
- for (var o = 0, n = Object.getOwnPropertySymbols(e); o < n.length; o++)
3185
- r.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[o]) && (t[n[o]] = e[n[o]]);
3186
- return t;
3187
- }
3188
- function Ma(e, r, t) {
3189
- if (t || arguments.length === 2) for (var n = 0, o = r.length, s; n < o; n++)
3190
- (s || !(n in r)) && (s || (s = Array.prototype.slice.call(r, 0, n)), s[n] = r[n]);
3191
- return e.concat(s || Array.prototype.slice.call(r));
3192
- }
3193
- var Bt = "right-scroll-bar-position", Wt = "width-before-scroll-bar", ka = "with-scroll-bars-hidden", Ia = "--removed-body-scroll-bar-size";
3194
- function Ar(e, r) {
3195
- return typeof e == "function" ? e(r) : e && (e.current = r), e;
3196
- }
3197
- function Va(e, r) {
3198
- var t = Ts(function() {
3199
- return {
3200
- // value
3201
- value: e,
3202
- // last callback
3203
- callback: r,
3204
- // "memoized" public interface
3205
- facade: {
3206
- get current() {
3207
- return t.value;
3208
- },
3209
- set current(n) {
3210
- var o = t.value;
3211
- o !== n && (t.value = n, t.callback(n, o));
3212
- }
3213
- }
3214
- };
3215
- })[0];
3216
- return t.callback = r, t.facade;
3217
- }
3218
- var La = typeof window < "u" ? h.useLayoutEffect : h.useEffect, Nn = /* @__PURE__ */ new WeakMap();
3219
- function ja(e, r) {
3220
- var t = Va(null, function(n) {
3221
- return e.forEach(function(o) {
3222
- return Ar(o, n);
3223
- });
3224
- });
3225
- return La(function() {
3226
- var n = Nn.get(t);
3227
- if (n) {
3228
- var o = new Set(n), s = new Set(e), i = t.current;
3229
- o.forEach(function(a) {
3230
- s.has(a) || Ar(a, null);
3231
- }), s.forEach(function(a) {
3232
- o.has(a) || Ar(a, i);
3233
- });
3234
- }
3235
- Nn.set(t, e);
3236
- }, [e]), t;
3237
- }
3238
- function Ba(e) {
3239
- return e;
3240
- }
3241
- function Wa(e, r) {
3242
- r === void 0 && (r = Ba);
3243
- var t = [], n = !1, o = {
3244
- read: function() {
3245
- if (n)
3246
- throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
3247
- return t.length ? t[t.length - 1] : e;
3248
- },
3249
- useMedium: function(s) {
3250
- var i = r(s, n);
3251
- return t.push(i), function() {
3252
- t = t.filter(function(a) {
3253
- return a !== i;
3254
- });
3255
- };
3256
- },
3257
- assignSyncMedium: function(s) {
3258
- for (n = !0; t.length; ) {
3259
- var i = t;
3260
- t = [], i.forEach(s);
3261
- }
3262
- t = {
3263
- push: function(a) {
3264
- return s(a);
3265
- },
3266
- filter: function() {
3267
- return t;
3268
- }
3269
- };
3270
- },
3271
- assignMedium: function(s) {
3272
- n = !0;
3273
- var i = [];
3274
- if (t.length) {
3275
- var a = t;
3276
- t = [], a.forEach(s), i = t;
3277
- }
3278
- var c = function() {
3279
- var f = i;
3280
- i = [], f.forEach(s);
3281
- }, u = function() {
3282
- return Promise.resolve().then(c);
3283
- };
3284
- u(), t = {
3285
- push: function(f) {
3286
- i.push(f), u();
3287
- },
3288
- filter: function(f) {
3289
- return i = i.filter(f), t;
3290
- }
3291
- };
3292
- }
3293
- };
3294
- return o;
3295
- }
3296
- function Ha(e) {
3297
- e === void 0 && (e = {});
3298
- var r = Wa(null);
3299
- return r.options = Re({ async: !0, ssr: !1 }, e), r;
3300
- }
3301
- var Do = function(e) {
3302
- var r = e.sideCar, t = No(e, ["sideCar"]);
3303
- if (!r)
3304
- throw new Error("Sidecar: please provide `sideCar` property to import the right car");
3305
- var n = r.read();
3306
- if (!n)
3307
- throw new Error("Sidecar medium not found");
3308
- return h.createElement(n, Re({}, t));
3309
- };
3310
- Do.isSideCarExport = !0;
3311
- function Ua(e, r) {
3312
- return e.useMedium(r), Do;
3313
- }
3314
- var Mo = Ha(), _r = function() {
3315
- }, rr = h.forwardRef(function(e, r) {
3316
- var t = h.useRef(null), n = h.useState({
3317
- onScrollCapture: _r,
3318
- onWheelCapture: _r,
3319
- onTouchMoveCapture: _r
3320
- }), o = n[0], s = n[1], i = e.forwardProps, a = e.children, c = e.className, u = e.removeScrollBar, f = e.enabled, d = e.shards, g = e.sideCar, x = e.noIsolation, y = e.inert, p = e.allowPinchZoom, S = e.as, b = S === void 0 ? "div" : S, v = e.gapMode, C = No(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), R = g, w = ja([t, r]), A = Re(Re({}, C), o);
3321
- return h.createElement(
3322
- h.Fragment,
3323
- null,
3324
- f && h.createElement(R, { sideCar: Mo, removeScrollBar: u, shards: d, noIsolation: x, inert: y, setCallbacks: s, allowPinchZoom: !!p, lockRef: t, gapMode: v }),
3325
- i ? h.cloneElement(h.Children.only(a), Re(Re({}, A), { ref: w })) : h.createElement(b, Re({}, A, { className: c, ref: w }), a)
3326
- );
3327
- });
3328
- rr.defaultProps = {
3329
- enabled: !0,
3330
- removeScrollBar: !0,
3331
- inert: !1
3332
- };
3333
- rr.classNames = {
3334
- fullWidth: Wt,
3335
- zeroRight: Bt
3336
- };
3337
- var $a = function() {
3338
- if (typeof __webpack_nonce__ < "u")
3339
- return __webpack_nonce__;
3340
- };
3341
- function za() {
3342
- if (!document)
3343
- return null;
3344
- var e = document.createElement("style");
3345
- e.type = "text/css";
3346
- var r = $a();
3347
- return r && e.setAttribute("nonce", r), e;
3348
- }
3349
- function Ka(e, r) {
3350
- e.styleSheet ? e.styleSheet.cssText = r : e.appendChild(document.createTextNode(r));
3351
- }
3352
- function Ya(e) {
3353
- var r = document.head || document.getElementsByTagName("head")[0];
3354
- r.appendChild(e);
3355
- }
3356
- var qa = function() {
3357
- var e = 0, r = null;
3358
- return {
3359
- add: function(t) {
3360
- e == 0 && (r = za()) && (Ka(r, t), Ya(r)), e++;
3361
- },
3362
- remove: function() {
3363
- e--, !e && r && (r.parentNode && r.parentNode.removeChild(r), r = null);
3364
- }
3365
- };
3366
- }, Xa = function() {
3367
- var e = qa();
3368
- return function(r, t) {
3369
- h.useEffect(function() {
3370
- return e.add(r), function() {
3371
- e.remove();
3372
- };
3373
- }, [r && t]);
3374
- };
3375
- }, ko = function() {
3376
- var e = Xa(), r = function(t) {
3377
- var n = t.styles, o = t.dynamic;
3378
- return e(n, o), null;
3379
- };
3380
- return r;
3381
- }, Ga = {
3382
- left: 0,
3383
- top: 0,
3384
- right: 0,
3385
- gap: 0
3386
- }, Rr = function(e) {
3387
- return parseInt(e || "", 10) || 0;
3388
- }, Za = function(e) {
3389
- var r = window.getComputedStyle(document.body), t = r[e === "padding" ? "paddingLeft" : "marginLeft"], n = r[e === "padding" ? "paddingTop" : "marginTop"], o = r[e === "padding" ? "paddingRight" : "marginRight"];
3390
- return [Rr(t), Rr(n), Rr(o)];
3391
- }, Qa = function(e) {
3392
- if (e === void 0 && (e = "margin"), typeof window > "u")
3393
- return Ga;
3394
- var r = Za(e), t = document.documentElement.clientWidth, n = window.innerWidth;
3395
- return {
3396
- left: r[0],
3397
- top: r[1],
3398
- right: r[2],
3399
- gap: Math.max(0, n - t + r[2] - r[0])
3400
- };
3401
- }, Ja = ko(), vt = "data-scroll-locked", ec = function(e, r, t, n) {
3402
- var o = e.left, s = e.top, i = e.right, a = e.gap;
3403
- return t === void 0 && (t = "margin"), `
3404
- .`.concat(ka, ` {
3405
- overflow: hidden `).concat(n, `;
3406
- padding-right: `).concat(a, "px ").concat(n, `;
3407
- }
3408
- body[`).concat(vt, `] {
3409
- overflow: hidden `).concat(n, `;
3410
- overscroll-behavior: contain;
3411
- `).concat([
3412
- r && "position: relative ".concat(n, ";"),
3413
- t === "margin" && `
3414
- padding-left: `.concat(o, `px;
3415
- padding-top: `).concat(s, `px;
3416
- padding-right: `).concat(i, `px;
3417
- margin-left:0;
3418
- margin-top:0;
3419
- margin-right: `).concat(a, "px ").concat(n, `;
3420
- `),
3421
- t === "padding" && "padding-right: ".concat(a, "px ").concat(n, ";")
3422
- ].filter(Boolean).join(""), `
3423
- }
3424
-
3425
- .`).concat(Bt, ` {
3426
- right: `).concat(a, "px ").concat(n, `;
3427
- }
3428
-
3429
- .`).concat(Wt, ` {
3430
- margin-right: `).concat(a, "px ").concat(n, `;
3431
- }
3432
-
3433
- .`).concat(Bt, " .").concat(Bt, ` {
3434
- right: 0 `).concat(n, `;
3435
- }
3436
-
3437
- .`).concat(Wt, " .").concat(Wt, ` {
3438
- margin-right: 0 `).concat(n, `;
3439
- }
3440
-
3441
- body[`).concat(vt, `] {
3442
- `).concat(Ia, ": ").concat(a, `px;
3443
- }
3444
- `);
3445
- }, Dn = function() {
3446
- var e = parseInt(document.body.getAttribute(vt) || "0", 10);
3447
- return isFinite(e) ? e : 0;
3448
- }, tc = function() {
3449
- h.useEffect(function() {
3450
- return document.body.setAttribute(vt, (Dn() + 1).toString()), function() {
3451
- var e = Dn() - 1;
3452
- e <= 0 ? document.body.removeAttribute(vt) : document.body.setAttribute(vt, e.toString());
3453
- };
3454
- }, []);
3455
- }, rc = function(e) {
3456
- var r = e.noRelative, t = e.noImportant, n = e.gapMode, o = n === void 0 ? "margin" : n;
3457
- tc();
3458
- var s = h.useMemo(function() {
3459
- return Qa(o);
3460
- }, [o]);
3461
- return h.createElement(Ja, { styles: ec(s, !r, o, t ? "" : "!important") });
3462
- }, Mr = !1;
3463
- if (typeof window < "u")
3464
- try {
3465
- var kt = Object.defineProperty({}, "passive", {
3466
- get: function() {
3467
- return Mr = !0, !0;
3468
- }
3469
- });
3470
- window.addEventListener("test", kt, kt), window.removeEventListener("test", kt, kt);
3471
- } catch {
3472
- Mr = !1;
3473
- }
3474
- var dt = Mr ? { passive: !1 } : !1, nc = function(e) {
3475
- return e.tagName === "TEXTAREA";
3476
- }, Io = function(e, r) {
3477
- var t = window.getComputedStyle(e);
3478
- return (
3479
- // not-not-scrollable
3480
- t[r] !== "hidden" && // contains scroll inside self
3481
- !(t.overflowY === t.overflowX && !nc(e) && t[r] === "visible")
3482
- );
3483
- }, oc = function(e) {
3484
- return Io(e, "overflowY");
3485
- }, sc = function(e) {
3486
- return Io(e, "overflowX");
3487
- }, Mn = function(e, r) {
3488
- var t = r.ownerDocument, n = r;
3489
- do {
3490
- typeof ShadowRoot < "u" && n instanceof ShadowRoot && (n = n.host);
3491
- var o = Vo(e, n);
3492
- if (o) {
3493
- var s = Lo(e, n), i = s[1], a = s[2];
3494
- if (i > a)
3495
- return !0;
3496
- }
3497
- n = n.parentNode;
3498
- } while (n && n !== t.body);
3499
- return !1;
3500
- }, ic = function(e) {
3501
- var r = e.scrollTop, t = e.scrollHeight, n = e.clientHeight;
3502
- return [
3503
- r,
3504
- t,
3505
- n
3506
- ];
3507
- }, ac = function(e) {
3508
- var r = e.scrollLeft, t = e.scrollWidth, n = e.clientWidth;
3509
- return [
3510
- r,
3511
- t,
3512
- n
3513
- ];
3514
- }, Vo = function(e, r) {
3515
- return e === "v" ? oc(r) : sc(r);
3516
- }, Lo = function(e, r) {
3517
- return e === "v" ? ic(r) : ac(r);
3518
- }, cc = function(e, r) {
3519
- return e === "h" && r === "rtl" ? -1 : 1;
3520
- }, lc = function(e, r, t, n, o) {
3521
- var s = cc(e, window.getComputedStyle(r).direction), i = s * n, a = t.target, c = r.contains(a), u = !1, f = i > 0, d = 0, g = 0;
3522
- do {
3523
- var x = Lo(e, a), y = x[0], p = x[1], S = x[2], b = p - S - s * y;
3524
- (y || b) && Vo(e, a) && (d += b, g += y), a instanceof ShadowRoot ? a = a.host : a = a.parentNode;
3525
- } while (
3526
- // portaled content
3527
- !c && a !== document.body || // self content
3528
- c && (r.contains(a) || r === a)
3529
- );
3530
- return (f && (Math.abs(d) < 1 || !o) || !f && (Math.abs(g) < 1 || !o)) && (u = !0), u;
3531
- }, It = function(e) {
3532
- return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
3533
- }, kn = function(e) {
3534
- return [e.deltaX, e.deltaY];
3535
- }, In = function(e) {
3536
- return e && "current" in e ? e.current : e;
3537
- }, uc = function(e, r) {
3538
- return e[0] === r[0] && e[1] === r[1];
3539
- }, dc = function(e) {
3540
- return `
3541
- .block-interactivity-`.concat(e, ` {pointer-events: none;}
3542
- .allow-interactivity-`).concat(e, ` {pointer-events: all;}
3543
- `);
3544
- }, fc = 0, ft = [];
3545
- function hc(e) {
3546
- var r = h.useRef([]), t = h.useRef([0, 0]), n = h.useRef(), o = h.useState(fc++)[0], s = h.useState(ko)[0], i = h.useRef(e);
3547
- h.useEffect(function() {
3548
- i.current = e;
3549
- }, [e]), h.useEffect(function() {
3550
- if (e.inert) {
3551
- document.body.classList.add("block-interactivity-".concat(o));
3552
- var p = Ma([e.lockRef.current], (e.shards || []).map(In), !0).filter(Boolean);
3553
- return p.forEach(function(S) {
3554
- return S.classList.add("allow-interactivity-".concat(o));
3555
- }), function() {
3556
- document.body.classList.remove("block-interactivity-".concat(o)), p.forEach(function(S) {
3557
- return S.classList.remove("allow-interactivity-".concat(o));
3558
- });
3559
- };
3560
- }
3561
- }, [e.inert, e.lockRef.current, e.shards]);
3562
- var a = h.useCallback(function(p, S) {
3563
- if ("touches" in p && p.touches.length === 2)
3564
- return !i.current.allowPinchZoom;
3565
- var b = It(p), v = t.current, C = "deltaX" in p ? p.deltaX : v[0] - b[0], R = "deltaY" in p ? p.deltaY : v[1] - b[1], w, A = p.target, _ = Math.abs(C) > Math.abs(R) ? "h" : "v";
3566
- if ("touches" in p && _ === "h" && A.type === "range")
3567
- return !1;
3568
- var M = Mn(_, A);
3569
- if (!M)
3570
- return !0;
3571
- if (M ? w = _ : (w = _ === "v" ? "h" : "v", M = Mn(_, A)), !M)
3572
- return !1;
3573
- if (!n.current && "changedTouches" in p && (C || R) && (n.current = w), !w)
3574
- return !0;
3575
- var H = n.current || w;
3576
- return lc(H, S, p, H === "h" ? C : R, !0);
3577
- }, []), c = h.useCallback(function(p) {
3578
- var S = p;
3579
- if (!(!ft.length || ft[ft.length - 1] !== s)) {
3580
- var b = "deltaY" in S ? kn(S) : It(S), v = r.current.filter(function(w) {
3581
- return w.name === S.type && (w.target === S.target || S.target === w.shadowParent) && uc(w.delta, b);
3582
- })[0];
3583
- if (v && v.should) {
3584
- S.cancelable && S.preventDefault();
3585
- return;
3586
- }
3587
- if (!v) {
3588
- var C = (i.current.shards || []).map(In).filter(Boolean).filter(function(w) {
3589
- return w.contains(S.target);
3590
- }), R = C.length > 0 ? a(S, C[0]) : !i.current.noIsolation;
3591
- R && S.cancelable && S.preventDefault();
3592
- }
3593
- }
3594
- }, []), u = h.useCallback(function(p, S, b, v) {
3595
- var C = { name: p, delta: S, target: b, should: v, shadowParent: pc(b) };
3596
- r.current.push(C), setTimeout(function() {
3597
- r.current = r.current.filter(function(R) {
3598
- return R !== C;
3599
- });
3600
- }, 1);
3601
- }, []), f = h.useCallback(function(p) {
3602
- t.current = It(p), n.current = void 0;
3603
- }, []), d = h.useCallback(function(p) {
3604
- u(p.type, kn(p), p.target, a(p, e.lockRef.current));
3605
- }, []), g = h.useCallback(function(p) {
3606
- u(p.type, It(p), p.target, a(p, e.lockRef.current));
3607
- }, []);
3608
- h.useEffect(function() {
3609
- return ft.push(s), e.setCallbacks({
3610
- onScrollCapture: d,
3611
- onWheelCapture: d,
3612
- onTouchMoveCapture: g
3613
- }), document.addEventListener("wheel", c, dt), document.addEventListener("touchmove", c, dt), document.addEventListener("touchstart", f, dt), function() {
3614
- ft = ft.filter(function(p) {
3615
- return p !== s;
3616
- }), document.removeEventListener("wheel", c, dt), document.removeEventListener("touchmove", c, dt), document.removeEventListener("touchstart", f, dt);
3617
- };
3618
- }, []);
3619
- var x = e.removeScrollBar, y = e.inert;
3620
- return h.createElement(
3621
- h.Fragment,
3622
- null,
3623
- y ? h.createElement(s, { styles: dc(o) }) : null,
3624
- x ? h.createElement(rc, { gapMode: e.gapMode }) : null
3625
- );
3626
- }
3627
- function pc(e) {
3628
- for (var r = null; e !== null; )
3629
- e instanceof ShadowRoot && (r = e.host, e = e.host), e = e.parentNode;
3630
- return r;
3631
- }
3632
- const mc = Ua(Mo, hc);
3633
- var jo = h.forwardRef(function(e, r) {
3634
- return h.createElement(rr, Re({}, e, { ref: r, sideCar: mc }));
3635
- });
3636
- jo.classNames = rr.classNames;
3637
- var vc = [" ", "Enter", "ArrowUp", "ArrowDown"], gc = [" ", "Enter"], Ot = "Select", [nr, or, yc] = oi(Ot), [bt, cl] = Br(Ot, [
3638
- yc,
3639
- xo
3640
- ]), sr = xo(), [wc, Xe] = bt(Ot), [xc, bc] = bt(Ot), Bo = (e) => {
3641
- const {
3642
- __scopeSelect: r,
3643
- children: t,
3644
- open: n,
3645
- defaultOpen: o,
3646
- onOpenChange: s,
3647
- value: i,
3648
- defaultValue: a,
3649
- onValueChange: c,
3650
- dir: u,
3651
- name: f,
3652
- autoComplete: d,
3653
- disabled: g,
3654
- required: x
3655
- } = e, y = sr(r), [p, S] = h.useState(null), [b, v] = h.useState(null), [C, R] = h.useState(!1), w = ii(u), [A = !1, _] = an({
3656
- prop: n,
3657
- defaultProp: o,
3658
- onChange: s
3659
- }), [M, H] = an({
3660
- prop: i,
3661
- defaultProp: a,
3662
- onChange: c
3663
- }), U = h.useRef(null), J = p ? !!p.closest("form") : !0, [D, I] = h.useState(/* @__PURE__ */ new Set()), B = Array.from(D).map((V) => V.props.value).join(";");
3664
- return /* @__PURE__ */ P.jsx(Ea, { ...y, children: /* @__PURE__ */ P.jsxs(
3665
- wc,
3666
- {
3667
- required: x,
3668
- scope: r,
3669
- trigger: p,
3670
- onTriggerChange: S,
3671
- valueNode: b,
3672
- onValueNodeChange: v,
3673
- valueNodeHasChildren: C,
3674
- onValueNodeHasChildrenChange: R,
3675
- contentId: Wr(),
3676
- value: M,
3677
- onValueChange: H,
3678
- open: A,
3679
- onOpenChange: _,
3680
- dir: w,
3681
- triggerPointerDownPosRef: U,
3682
- disabled: g,
3683
- children: [
3684
- /* @__PURE__ */ P.jsx(nr.Provider, { scope: r, children: /* @__PURE__ */ P.jsx(
3685
- xc,
3686
- {
3687
- scope: e.__scopeSelect,
3688
- onNativeOptionAdd: h.useCallback((V) => {
3689
- I(($) => new Set($).add(V));
3690
- }, []),
3691
- onNativeOptionRemove: h.useCallback((V) => {
3692
- I(($) => {
3693
- const L = new Set($);
3694
- return L.delete(V), L;
3695
- });
3696
- }, []),
3697
- children: t
3698
- }
3699
- ) }),
3700
- J ? /* @__PURE__ */ P.jsxs(
3701
- fs,
3702
- {
3703
- "aria-hidden": !0,
3704
- required: x,
3705
- tabIndex: -1,
3706
- name: f,
3707
- autoComplete: d,
3708
- value: M,
3709
- onChange: (V) => H(V.target.value),
3710
- disabled: g,
3711
- children: [
3712
- M === void 0 ? /* @__PURE__ */ P.jsx("option", { value: "" }) : null,
3713
- Array.from(D)
3714
- ]
3715
- },
3716
- B
3717
- ) : null
3718
- ]
3719
- }
3720
- ) });
3721
- };
3722
- Bo.displayName = Ot;
3723
- var Wo = "SelectTrigger", Ho = h.forwardRef(
3724
- (e, r) => {
3725
- const { __scopeSelect: t, disabled: n = !1, ...o } = e, s = sr(t), i = Xe(Wo, t), a = i.disabled || n, c = le(r, i.onTriggerChange), u = or(t), [f, d, g] = hs((y) => {
3726
- const p = u().filter((v) => !v.disabled), S = p.find((v) => v.value === i.value), b = ps(p, y, S);
3727
- b !== void 0 && i.onValueChange(b.value);
3728
- }), x = () => {
3729
- a || (i.onOpenChange(!0), g());
3730
- };
3731
- return /* @__PURE__ */ P.jsx(Ca, { asChild: !0, ...s, children: /* @__PURE__ */ P.jsx(
3732
- oe.button,
3733
- {
3734
- type: "button",
3735
- role: "combobox",
3736
- "aria-controls": i.contentId,
3737
- "aria-expanded": i.open,
3738
- "aria-required": i.required,
3739
- "aria-autocomplete": "none",
3740
- dir: i.dir,
3741
- "data-state": i.open ? "open" : "closed",
3742
- disabled: a,
3743
- "data-disabled": a ? "" : void 0,
3744
- "data-placeholder": ds(i.value) ? "" : void 0,
3745
- ...o,
3746
- ref: c,
3747
- onClick: ce(o.onClick, (y) => {
3748
- y.currentTarget.focus();
3749
- }),
3750
- onPointerDown: ce(o.onPointerDown, (y) => {
3751
- const p = y.target;
3752
- p.hasPointerCapture(y.pointerId) && p.releasePointerCapture(y.pointerId), y.button === 0 && y.ctrlKey === !1 && (x(), i.triggerPointerDownPosRef.current = {
3753
- x: Math.round(y.pageX),
3754
- y: Math.round(y.pageY)
3755
- }, y.preventDefault());
3756
- }),
3757
- onKeyDown: ce(o.onKeyDown, (y) => {
3758
- const p = f.current !== "";
3759
- !(y.ctrlKey || y.altKey || y.metaKey) && y.key.length === 1 && d(y.key), !(p && y.key === " ") && vc.includes(y.key) && (x(), y.preventDefault());
3760
- })
3761
- }
3762
- ) });
3763
- }
3764
- );
3765
- Ho.displayName = Wo;
3766
- var Uo = "SelectValue", $o = h.forwardRef(
3767
- (e, r) => {
3768
- const { __scopeSelect: t, className: n, style: o, children: s, placeholder: i = "", ...a } = e, c = Xe(Uo, t), { onValueNodeHasChildrenChange: u } = c, f = s !== void 0, d = le(r, c.onValueNodeChange);
3769
- return be(() => {
3770
- u(f);
3771
- }, [u, f]), /* @__PURE__ */ P.jsx(
3772
- oe.span,
3773
- {
3774
- ...a,
3775
- ref: d,
3776
- style: { pointerEvents: "none" },
3777
- children: ds(c.value) ? /* @__PURE__ */ P.jsx(P.Fragment, { children: i }) : s
3778
- }
3779
- );
3780
- }
3781
- );
3782
- $o.displayName = Uo;
3783
- var Sc = "SelectIcon", zo = h.forwardRef(
3784
- (e, r) => {
3785
- const { __scopeSelect: t, children: n, ...o } = e;
3786
- return /* @__PURE__ */ P.jsx(oe.span, { "aria-hidden": !0, ...o, ref: r, children: n || "▼" });
3787
- }
3788
- );
3789
- zo.displayName = Sc;
3790
- var Ec = "SelectPortal", Ko = (e) => /* @__PURE__ */ P.jsx(To, { asChild: !0, ...e });
3791
- Ko.displayName = Ec;
3792
- var tt = "SelectContent", Yo = h.forwardRef(
3793
- (e, r) => {
3794
- const t = Xe(tt, e.__scopeSelect), [n, o] = h.useState();
3795
- if (be(() => {
3796
- o(new DocumentFragment());
3797
- }, []), !t.open) {
3798
- const s = n;
3799
- return s ? Hr.createPortal(
3800
- /* @__PURE__ */ P.jsx(qo, { scope: e.__scopeSelect, children: /* @__PURE__ */ P.jsx(nr.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ P.jsx("div", { children: e.children }) }) }),
3801
- s
3802
- ) : null;
3803
- }
3804
- return /* @__PURE__ */ P.jsx(Xo, { ...e, ref: r });
3805
- }
3806
- );
3807
- Yo.displayName = tt;
3808
- var Ne = 10, [qo, Ge] = bt(tt), Cc = "SelectContentImpl", Xo = h.forwardRef(
3809
- (e, r) => {
3810
- const {
3811
- __scopeSelect: t,
3812
- position: n = "item-aligned",
3813
- onCloseAutoFocus: o,
3814
- onEscapeKeyDown: s,
3815
- onPointerDownOutside: i,
3816
- //
3817
- // PopperContent props
3818
- side: a,
3819
- sideOffset: c,
3820
- align: u,
3821
- alignOffset: f,
3822
- arrowPadding: d,
3823
- collisionBoundary: g,
3824
- collisionPadding: x,
3825
- sticky: y,
3826
- hideWhenDetached: p,
3827
- avoidCollisions: S,
3828
- //
3829
- ...b
3830
- } = e, v = Xe(tt, t), [C, R] = h.useState(null), [w, A] = h.useState(null), _ = le(r, (W) => R(W)), [M, H] = h.useState(null), [U, J] = h.useState(
3831
- null
3832
- ), D = or(t), [I, B] = h.useState(!1), V = h.useRef(!1);
3833
- h.useEffect(() => {
3834
- if (C) return Da(C);
3835
- }, [C]), mi();
3836
- const $ = h.useCallback(
3837
- (W) => {
3838
- const [q, ...se] = D().map((K) => K.ref.current), [X] = se.slice(-1), z = document.activeElement;
3839
- for (const K of W)
3840
- if (K === z || (K == null || K.scrollIntoView({ block: "nearest" }), K === q && w && (w.scrollTop = 0), K === X && w && (w.scrollTop = w.scrollHeight), K == null || K.focus(), document.activeElement !== z)) return;
3841
- },
3842
- [D, w]
3843
- ), L = h.useCallback(
3844
- () => $([M, C]),
3845
- [$, M, C]
3846
- );
3847
- h.useEffect(() => {
3848
- I && L();
3849
- }, [I, L]);
3850
- const { onOpenChange: Z, triggerPointerDownPosRef: ee } = v;
3851
- h.useEffect(() => {
3852
- if (C) {
3853
- let W = { x: 0, y: 0 };
3854
- const q = (X) => {
3855
- var z, K;
3856
- W = {
3857
- x: Math.abs(Math.round(X.pageX) - (((z = ee.current) == null ? void 0 : z.x) ?? 0)),
3858
- y: Math.abs(Math.round(X.pageY) - (((K = ee.current) == null ? void 0 : K.y) ?? 0))
3859
- };
3860
- }, se = (X) => {
3861
- W.x <= 10 && W.y <= 10 ? X.preventDefault() : C.contains(X.target) || Z(!1), document.removeEventListener("pointermove", q), ee.current = null;
3862
- };
3863
- return ee.current !== null && (document.addEventListener("pointermove", q), document.addEventListener("pointerup", se, { capture: !0, once: !0 })), () => {
3864
- document.removeEventListener("pointermove", q), document.removeEventListener("pointerup", se, { capture: !0 });
3865
- };
3866
- }
3867
- }, [C, Z, ee]), h.useEffect(() => {
3868
- const W = () => Z(!1);
3869
- return window.addEventListener("blur", W), window.addEventListener("resize", W), () => {
3870
- window.removeEventListener("blur", W), window.removeEventListener("resize", W);
3871
- };
3872
- }, [Z]);
3873
- const [Se, we] = hs((W) => {
3874
- const q = D().filter((z) => !z.disabled), se = q.find((z) => z.ref.current === document.activeElement), X = ps(q, W, se);
3875
- X && setTimeout(() => X.ref.current.focus());
3876
- }), je = h.useCallback(
3877
- (W, q, se) => {
3878
- const X = !V.current && !se;
3879
- (v.value !== void 0 && v.value === q || X) && (H(W), X && (V.current = !0));
3880
- },
3881
- [v.value]
3882
- ), Ze = h.useCallback(() => C == null ? void 0 : C.focus(), [C]), Ee = h.useCallback(
3883
- (W, q, se) => {
3884
- const X = !V.current && !se;
3885
- (v.value !== void 0 && v.value === q || X) && J(W);
3886
- },
3887
- [v.value]
3888
- ), Be = n === "popper" ? kr : Go, Ce = Be === kr ? {
3889
- side: a,
3890
- sideOffset: c,
3891
- align: u,
3892
- alignOffset: f,
3893
- arrowPadding: d,
3894
- collisionBoundary: g,
3895
- collisionPadding: x,
3896
- sticky: y,
3897
- hideWhenDetached: p,
3898
- avoidCollisions: S
3899
- } : {};
3900
- return /* @__PURE__ */ P.jsx(
3901
- qo,
3902
- {
3903
- scope: t,
3904
- content: C,
3905
- viewport: w,
3906
- onViewportChange: A,
3907
- itemRefCallback: je,
3908
- selectedItem: M,
3909
- onItemLeave: Ze,
3910
- itemTextRefCallback: Ee,
3911
- focusSelectedItem: L,
3912
- selectedItemText: U,
3913
- position: n,
3914
- isPositioned: I,
3915
- searchRef: Se,
3916
- children: /* @__PURE__ */ P.jsx(jo, { as: Ht, allowPinchZoom: !0, children: /* @__PURE__ */ P.jsx(
3917
- io,
3918
- {
3919
- asChild: !0,
3920
- trapped: v.open,
3921
- onMountAutoFocus: (W) => {
3922
- W.preventDefault();
3923
- },
3924
- onUnmountAutoFocus: ce(o, (W) => {
3925
- var q;
3926
- (q = v.trigger) == null || q.focus({ preventScroll: !0 }), W.preventDefault();
3927
- }),
3928
- children: /* @__PURE__ */ P.jsx(
3929
- oo,
3930
- {
3931
- asChild: !0,
3932
- disableOutsidePointerEvents: !0,
3933
- onEscapeKeyDown: s,
3934
- onPointerDownOutside: i,
3935
- onFocusOutside: (W) => W.preventDefault(),
3936
- onDismiss: () => v.onOpenChange(!1),
3937
- children: /* @__PURE__ */ P.jsx(
3938
- Be,
3939
- {
3940
- role: "listbox",
3941
- id: v.contentId,
3942
- "data-state": v.open ? "open" : "closed",
3943
- dir: v.dir,
3944
- onContextMenu: (W) => W.preventDefault(),
3945
- ...b,
3946
- ...Ce,
3947
- onPlaced: () => B(!0),
3948
- ref: _,
3949
- style: {
3950
- // flex layout so we can place the scroll buttons properly
3951
- display: "flex",
3952
- flexDirection: "column",
3953
- // reset the outline by default as the content MAY get focused
3954
- outline: "none",
3955
- ...b.style
3956
- },
3957
- onKeyDown: ce(b.onKeyDown, (W) => {
3958
- const q = W.ctrlKey || W.altKey || W.metaKey;
3959
- if (W.key === "Tab" && W.preventDefault(), !q && W.key.length === 1 && we(W.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(W.key)) {
3960
- let X = D().filter((z) => !z.disabled).map((z) => z.ref.current);
3961
- if (["ArrowUp", "End"].includes(W.key) && (X = X.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(W.key)) {
3962
- const z = W.target, K = X.indexOf(z);
3963
- X = X.slice(K + 1);
3964
- }
3965
- setTimeout(() => $(X)), W.preventDefault();
3966
- }
3967
- })
3968
- }
3969
- )
3970
- }
3971
- )
3972
- }
3973
- ) })
3974
- }
3975
- );
3976
- }
3977
- );
3978
- Xo.displayName = Cc;
3979
- var Ac = "SelectItemAlignedPosition", Go = h.forwardRef((e, r) => {
3980
- const { __scopeSelect: t, onPlaced: n, ...o } = e, s = Xe(tt, t), i = Ge(tt, t), [a, c] = h.useState(null), [u, f] = h.useState(null), d = le(r, (_) => f(_)), g = or(t), x = h.useRef(!1), y = h.useRef(!0), { viewport: p, selectedItem: S, selectedItemText: b, focusSelectedItem: v } = i, C = h.useCallback(() => {
3981
- if (s.trigger && s.valueNode && a && u && p && S && b) {
3982
- const _ = s.trigger.getBoundingClientRect(), M = u.getBoundingClientRect(), H = s.valueNode.getBoundingClientRect(), U = b.getBoundingClientRect();
3983
- if (s.dir !== "rtl") {
3984
- const z = U.left - M.left, K = H.left - z, ue = _.left - K, me = _.width + ue, rt = Math.max(me, M.width), nt = window.innerWidth - Ne, ot = mn(K, [Ne, nt - rt]);
3985
- a.style.minWidth = me + "px", a.style.left = ot + "px";
3986
- } else {
3987
- const z = M.right - U.right, K = window.innerWidth - H.right - z, ue = window.innerWidth - _.right - K, me = _.width + ue, rt = Math.max(me, M.width), nt = window.innerWidth - Ne, ot = mn(K, [Ne, nt - rt]);
3988
- a.style.minWidth = me + "px", a.style.right = ot + "px";
3989
- }
3990
- const J = g(), D = window.innerHeight - Ne * 2, I = p.scrollHeight, B = window.getComputedStyle(u), V = parseInt(B.borderTopWidth, 10), $ = parseInt(B.paddingTop, 10), L = parseInt(B.borderBottomWidth, 10), Z = parseInt(B.paddingBottom, 10), ee = V + $ + I + Z + L, Se = Math.min(S.offsetHeight * 5, ee), we = window.getComputedStyle(p), je = parseInt(we.paddingTop, 10), Ze = parseInt(we.paddingBottom, 10), Ee = _.top + _.height / 2 - Ne, Be = D - Ee, Ce = S.offsetHeight / 2, W = S.offsetTop + Ce, q = V + $ + W, se = ee - q;
3991
- if (q <= Ee) {
3992
- const z = S === J[J.length - 1].ref.current;
3993
- a.style.bottom = "0px";
3994
- const K = u.clientHeight - p.offsetTop - p.offsetHeight, ue = Math.max(
3995
- Be,
3996
- Ce + // viewport might have padding bottom, include it to avoid a scrollable viewport
3997
- (z ? Ze : 0) + K + L
3998
- ), me = q + ue;
3999
- a.style.height = me + "px";
4000
- } else {
4001
- const z = S === J[0].ref.current;
4002
- a.style.top = "0px";
4003
- const ue = Math.max(
4004
- Ee,
4005
- V + p.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
4006
- (z ? je : 0) + Ce
4007
- ) + se;
4008
- a.style.height = ue + "px", p.scrollTop = q - Ee + p.offsetTop;
4009
- }
4010
- a.style.margin = `${Ne}px 0`, a.style.minHeight = Se + "px", a.style.maxHeight = D + "px", n == null || n(), requestAnimationFrame(() => x.current = !0);
4011
- }
4012
- }, [
4013
- g,
4014
- s.trigger,
4015
- s.valueNode,
4016
- a,
4017
- u,
4018
- p,
4019
- S,
4020
- b,
4021
- s.dir,
4022
- n
4023
- ]);
4024
- be(() => C(), [C]);
4025
- const [R, w] = h.useState();
4026
- be(() => {
4027
- u && w(window.getComputedStyle(u).zIndex);
4028
- }, [u]);
4029
- const A = h.useCallback(
4030
- (_) => {
4031
- _ && y.current === !0 && (C(), v == null || v(), y.current = !1);
4032
- },
4033
- [C, v]
4034
- );
4035
- return /* @__PURE__ */ P.jsx(
4036
- Rc,
4037
- {
4038
- scope: t,
4039
- contentWrapper: a,
4040
- shouldExpandOnScrollRef: x,
4041
- onScrollButtonChange: A,
4042
- children: /* @__PURE__ */ P.jsx(
4043
- "div",
4044
- {
4045
- ref: c,
4046
- style: {
4047
- display: "flex",
4048
- flexDirection: "column",
4049
- position: "fixed",
4050
- zIndex: R
4051
- },
4052
- children: /* @__PURE__ */ P.jsx(
4053
- oe.div,
4054
- {
4055
- ...o,
4056
- ref: d,
4057
- style: {
4058
- // When we get the height of the content, it includes borders. If we were to set
4059
- // the height without having `boxSizing: 'border-box'` it would be too big.
4060
- boxSizing: "border-box",
4061
- // We need to ensure the content doesn't get taller than the wrapper
4062
- maxHeight: "100%",
4063
- ...o.style
4064
- }
4065
- }
4066
- )
4067
- }
4068
- )
4069
- }
4070
- );
4071
- });
4072
- Go.displayName = Ac;
4073
- var _c = "SelectPopperPosition", kr = h.forwardRef((e, r) => {
4074
- const {
4075
- __scopeSelect: t,
4076
- align: n = "start",
4077
- collisionPadding: o = Ne,
4078
- ...s
4079
- } = e, i = sr(t);
4080
- return /* @__PURE__ */ P.jsx(
4081
- Aa,
4082
- {
4083
- ...i,
4084
- ...s,
4085
- ref: r,
4086
- align: n,
4087
- collisionPadding: o,
4088
- style: {
4089
- // Ensure border-box for floating-ui calculations
4090
- boxSizing: "border-box",
4091
- ...s.style,
4092
- "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
4093
- "--radix-select-content-available-width": "var(--radix-popper-available-width)",
4094
- "--radix-select-content-available-height": "var(--radix-popper-available-height)",
4095
- "--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
4096
- "--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
4097
- }
4098
- }
4099
- );
4100
- });
4101
- kr.displayName = _c;
4102
- var [Rc, rn] = bt(tt, {}), Ir = "SelectViewport", Zo = h.forwardRef(
4103
- (e, r) => {
4104
- const { __scopeSelect: t, nonce: n, ...o } = e, s = Ge(Ir, t), i = rn(Ir, t), a = le(r, s.onViewportChange), c = h.useRef(0);
4105
- return /* @__PURE__ */ P.jsxs(P.Fragment, { children: [
4106
- /* @__PURE__ */ P.jsx(
4107
- "style",
4108
- {
4109
- dangerouslySetInnerHTML: {
4110
- __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
4111
- },
4112
- nonce: n
4113
- }
4114
- ),
4115
- /* @__PURE__ */ P.jsx(nr.Slot, { scope: t, children: /* @__PURE__ */ P.jsx(
4116
- oe.div,
4117
- {
4118
- "data-radix-select-viewport": "",
4119
- role: "presentation",
4120
- ...o,
4121
- ref: a,
4122
- style: {
4123
- // we use position: 'relative' here on the `viewport` so that when we call
4124
- // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
4125
- // (independent of the scrollUpButton).
4126
- position: "relative",
4127
- flex: 1,
4128
- overflow: "auto",
4129
- ...o.style
4130
- },
4131
- onScroll: ce(o.onScroll, (u) => {
4132
- const f = u.currentTarget, { contentWrapper: d, shouldExpandOnScrollRef: g } = i;
4133
- if (g != null && g.current && d) {
4134
- const x = Math.abs(c.current - f.scrollTop);
4135
- if (x > 0) {
4136
- const y = window.innerHeight - Ne * 2, p = parseFloat(d.style.minHeight), S = parseFloat(d.style.height), b = Math.max(p, S);
4137
- if (b < y) {
4138
- const v = b + x, C = Math.min(y, v), R = v - C;
4139
- d.style.height = C + "px", d.style.bottom === "0px" && (f.scrollTop = R > 0 ? R : 0, d.style.justifyContent = "flex-end");
4140
- }
4141
- }
4142
- }
4143
- c.current = f.scrollTop;
4144
- })
4145
- }
4146
- ) })
4147
- ] });
4148
- }
4149
- );
4150
- Zo.displayName = Ir;
4151
- var Qo = "SelectGroup", [Pc, Tc] = bt(Qo), Jo = h.forwardRef(
4152
- (e, r) => {
4153
- const { __scopeSelect: t, ...n } = e, o = Wr();
4154
- return /* @__PURE__ */ P.jsx(Pc, { scope: t, id: o, children: /* @__PURE__ */ P.jsx(oe.div, { role: "group", "aria-labelledby": o, ...n, ref: r }) });
4155
- }
4156
- );
4157
- Jo.displayName = Qo;
4158
- var es = "SelectLabel", ts = h.forwardRef(
4159
- (e, r) => {
4160
- const { __scopeSelect: t, ...n } = e, o = Tc(es, t);
4161
- return /* @__PURE__ */ P.jsx(oe.div, { id: o.id, ...n, ref: r });
4162
- }
4163
- );
4164
- ts.displayName = es;
4165
- var Qt = "SelectItem", [Oc, rs] = bt(Qt), ns = h.forwardRef(
4166
- (e, r) => {
4167
- const {
4168
- __scopeSelect: t,
4169
- value: n,
4170
- disabled: o = !1,
4171
- textValue: s,
4172
- ...i
4173
- } = e, a = Xe(Qt, t), c = Ge(Qt, t), u = a.value === n, [f, d] = h.useState(s ?? ""), [g, x] = h.useState(!1), y = le(
4174
- r,
4175
- (b) => {
4176
- var v;
4177
- return (v = c.itemRefCallback) == null ? void 0 : v.call(c, b, n, o);
4178
- }
4179
- ), p = Wr(), S = () => {
4180
- o || (a.onValueChange(n), a.onOpenChange(!1));
4181
- };
4182
- if (n === "")
4183
- throw new Error(
4184
- "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."
4185
- );
4186
- return /* @__PURE__ */ P.jsx(
4187
- Oc,
4188
- {
4189
- scope: t,
4190
- value: n,
4191
- disabled: o,
4192
- textId: p,
4193
- isSelected: u,
4194
- onItemTextChange: h.useCallback((b) => {
4195
- d((v) => v || ((b == null ? void 0 : b.textContent) ?? "").trim());
4196
- }, []),
4197
- children: /* @__PURE__ */ P.jsx(
4198
- nr.ItemSlot,
4199
- {
4200
- scope: t,
4201
- value: n,
4202
- disabled: o,
4203
- textValue: f,
4204
- children: /* @__PURE__ */ P.jsx(
4205
- oe.div,
4206
- {
4207
- role: "option",
4208
- "aria-labelledby": p,
4209
- "data-highlighted": g ? "" : void 0,
4210
- "aria-selected": u && g,
4211
- "data-state": u ? "checked" : "unchecked",
4212
- "aria-disabled": o || void 0,
4213
- "data-disabled": o ? "" : void 0,
4214
- tabIndex: o ? void 0 : -1,
4215
- ...i,
4216
- ref: y,
4217
- onFocus: ce(i.onFocus, () => x(!0)),
4218
- onBlur: ce(i.onBlur, () => x(!1)),
4219
- onPointerUp: ce(i.onPointerUp, S),
4220
- onPointerMove: ce(i.onPointerMove, (b) => {
4221
- var v;
4222
- o ? (v = c.onItemLeave) == null || v.call(c) : b.currentTarget.focus({ preventScroll: !0 });
4223
- }),
4224
- onPointerLeave: ce(i.onPointerLeave, (b) => {
4225
- var v;
4226
- b.currentTarget === document.activeElement && ((v = c.onItemLeave) == null || v.call(c));
4227
- }),
4228
- onKeyDown: ce(i.onKeyDown, (b) => {
4229
- var C;
4230
- ((C = c.searchRef) == null ? void 0 : C.current) !== "" && b.key === " " || (gc.includes(b.key) && S(), b.key === " " && b.preventDefault());
4231
- })
4232
- }
4233
- )
4234
- }
4235
- )
4236
- }
4237
- );
4238
- }
4239
- );
4240
- ns.displayName = Qt;
4241
- var Et = "SelectItemText", os = h.forwardRef(
4242
- (e, r) => {
4243
- const { __scopeSelect: t, className: n, style: o, ...s } = e, i = Xe(Et, t), a = Ge(Et, t), c = rs(Et, t), u = bc(Et, t), [f, d] = h.useState(null), g = le(
4244
- r,
4245
- (b) => d(b),
4246
- c.onItemTextChange,
4247
- (b) => {
4248
- var v;
4249
- return (v = a.itemTextRefCallback) == null ? void 0 : v.call(a, b, c.value, c.disabled);
4250
- }
4251
- ), x = f == null ? void 0 : f.textContent, y = h.useMemo(
4252
- () => /* @__PURE__ */ P.jsx("option", { value: c.value, disabled: c.disabled, children: x }, c.value),
4253
- [c.disabled, c.value, x]
4254
- ), { onNativeOptionAdd: p, onNativeOptionRemove: S } = u;
4255
- return be(() => (p(y), () => S(y)), [p, S, y]), /* @__PURE__ */ P.jsxs(P.Fragment, { children: [
4256
- /* @__PURE__ */ P.jsx(oe.span, { id: c.textId, ...s, ref: g }),
4257
- c.isSelected && i.valueNode && !i.valueNodeHasChildren ? Hr.createPortal(s.children, i.valueNode) : null
4258
- ] });
4259
- }
4260
- );
4261
- os.displayName = Et;
4262
- var ss = "SelectItemIndicator", is = h.forwardRef(
4263
- (e, r) => {
4264
- const { __scopeSelect: t, ...n } = e;
4265
- return rs(ss, t).isSelected ? /* @__PURE__ */ P.jsx(oe.span, { "aria-hidden": !0, ...n, ref: r }) : null;
4266
- }
4267
- );
4268
- is.displayName = ss;
4269
- var Vr = "SelectScrollUpButton", as = h.forwardRef((e, r) => {
4270
- const t = Ge(Vr, e.__scopeSelect), n = rn(Vr, e.__scopeSelect), [o, s] = h.useState(!1), i = le(r, n.onScrollButtonChange);
4271
- return be(() => {
4272
- if (t.viewport && t.isPositioned) {
4273
- let a = function() {
4274
- const u = c.scrollTop > 0;
4275
- s(u);
4276
- };
4277
- const c = t.viewport;
4278
- return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
4279
- }
4280
- }, [t.viewport, t.isPositioned]), o ? /* @__PURE__ */ P.jsx(
4281
- ls,
4282
- {
4283
- ...e,
4284
- ref: i,
4285
- onAutoScroll: () => {
4286
- const { viewport: a, selectedItem: c } = t;
4287
- a && c && (a.scrollTop = a.scrollTop - c.offsetHeight);
4288
- }
4289
- }
4290
- ) : null;
4291
- });
4292
- as.displayName = Vr;
4293
- var Lr = "SelectScrollDownButton", cs = h.forwardRef((e, r) => {
4294
- const t = Ge(Lr, e.__scopeSelect), n = rn(Lr, e.__scopeSelect), [o, s] = h.useState(!1), i = le(r, n.onScrollButtonChange);
4295
- return be(() => {
4296
- if (t.viewport && t.isPositioned) {
4297
- let a = function() {
4298
- const u = c.scrollHeight - c.clientHeight, f = Math.ceil(c.scrollTop) < u;
4299
- s(f);
4300
- };
4301
- const c = t.viewport;
4302
- return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
4303
- }
4304
- }, [t.viewport, t.isPositioned]), o ? /* @__PURE__ */ P.jsx(
4305
- ls,
4306
- {
4307
- ...e,
4308
- ref: i,
4309
- onAutoScroll: () => {
4310
- const { viewport: a, selectedItem: c } = t;
4311
- a && c && (a.scrollTop = a.scrollTop + c.offsetHeight);
4312
- }
4313
- }
4314
- ) : null;
4315
- });
4316
- cs.displayName = Lr;
4317
- var ls = h.forwardRef((e, r) => {
4318
- const { __scopeSelect: t, onAutoScroll: n, ...o } = e, s = Ge("SelectScrollButton", t), i = h.useRef(null), a = or(t), c = h.useCallback(() => {
4319
- i.current !== null && (window.clearInterval(i.current), i.current = null);
4320
- }, []);
4321
- return h.useEffect(() => () => c(), [c]), be(() => {
4322
- var f;
4323
- const u = a().find((d) => d.ref.current === document.activeElement);
4324
- (f = u == null ? void 0 : u.ref.current) == null || f.scrollIntoView({ block: "nearest" });
4325
- }, [a]), /* @__PURE__ */ P.jsx(
4326
- oe.div,
4327
- {
4328
- "aria-hidden": !0,
4329
- ...o,
4330
- ref: r,
4331
- style: { flexShrink: 0, ...o.style },
4332
- onPointerDown: ce(o.onPointerDown, () => {
4333
- i.current === null && (i.current = window.setInterval(n, 50));
4334
- }),
4335
- onPointerMove: ce(o.onPointerMove, () => {
4336
- var u;
4337
- (u = s.onItemLeave) == null || u.call(s), i.current === null && (i.current = window.setInterval(n, 50));
4338
- }),
4339
- onPointerLeave: ce(o.onPointerLeave, () => {
4340
- c();
4341
- })
4342
- }
4343
- );
4344
- }), Fc = "SelectSeparator", us = h.forwardRef(
4345
- (e, r) => {
4346
- const { __scopeSelect: t, ...n } = e;
4347
- return /* @__PURE__ */ P.jsx(oe.div, { "aria-hidden": !0, ...n, ref: r });
4348
- }
4349
- );
4350
- us.displayName = Fc;
4351
- var jr = "SelectArrow", Nc = h.forwardRef(
4352
- (e, r) => {
4353
- const { __scopeSelect: t, ...n } = e, o = sr(t), s = Xe(jr, t), i = Ge(jr, t);
4354
- return s.open && i.position === "popper" ? /* @__PURE__ */ P.jsx(_a, { ...o, ...n, ref: r }) : null;
4355
- }
4356
- );
4357
- Nc.displayName = jr;
4358
- function ds(e) {
4359
- return e === "" || e === void 0;
4360
- }
4361
- var fs = h.forwardRef(
4362
- (e, r) => {
4363
- const { value: t, ...n } = e, o = h.useRef(null), s = le(r, o), i = Pa(t);
4364
- return h.useEffect(() => {
4365
- const a = o.current, c = window.HTMLSelectElement.prototype, f = Object.getOwnPropertyDescriptor(
4366
- c,
4367
- "value"
4368
- ).set;
4369
- if (i !== t && f) {
4370
- const d = new Event("change", { bubbles: !0 });
4371
- f.call(a, t), a.dispatchEvent(d);
4372
- }
4373
- }, [i, t]), /* @__PURE__ */ P.jsx(Oo, { asChild: !0, children: /* @__PURE__ */ P.jsx("select", { ...n, ref: s, defaultValue: t }) });
4374
- }
4375
- );
4376
- fs.displayName = "BubbleSelect";
4377
- function hs(e) {
4378
- const r = Je(e), t = h.useRef(""), n = h.useRef(0), o = h.useCallback(
4379
- (i) => {
4380
- const a = t.current + i;
4381
- r(a), function c(u) {
4382
- t.current = u, window.clearTimeout(n.current), u !== "" && (n.current = window.setTimeout(() => c(""), 1e3));
4383
- }(a);
4384
- },
4385
- [r]
4386
- ), s = h.useCallback(() => {
4387
- t.current = "", window.clearTimeout(n.current);
4388
- }, []);
4389
- return h.useEffect(() => () => window.clearTimeout(n.current), []), [t, o, s];
4390
- }
4391
- function ps(e, r, t) {
4392
- const o = r.length > 1 && Array.from(r).every((u) => u === r[0]) ? r[0] : r, s = t ? e.indexOf(t) : -1;
4393
- let i = Dc(e, Math.max(s, 0));
4394
- o.length === 1 && (i = i.filter((u) => u !== t));
4395
- const c = i.find(
4396
- (u) => u.textValue.toLowerCase().startsWith(o.toLowerCase())
4397
- );
4398
- return c !== t ? c : void 0;
4399
- }
4400
- function Dc(e, r) {
4401
- return e.map((t, n) => e[(r + n) % e.length]);
4402
- }
4403
- var Mc = Bo, ms = Ho, kc = $o, Ic = zo, Vc = Ko, vs = Yo, Lc = Zo, jc = Jo, gs = ts, ys = ns, Bc = os, Wc = is, ws = as, xs = cs, bs = us;
4404
- const ll = Mc, ul = jc, dl = kc, Hc = h.forwardRef(({ className: e, children: r, ...t }, n) => /* @__PURE__ */ P.jsxs(
4405
- ms,
4406
- {
4407
- ref: n,
4408
- className: ke(
4409
- "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",
4410
- e
4411
- ),
4412
- ...t,
4413
- children: [
4414
- /* @__PURE__ */ P.jsx("span", { className: "truncate", children: r }),
4415
- /* @__PURE__ */ P.jsx(Ic, { asChild: !0, children: /* @__PURE__ */ P.jsx(Bn, { className: "flex-shrink-0 h-4 w-4 opacity-50" }) })
4416
- ]
4417
- }
4418
- ));
4419
- Hc.displayName = ms.displayName;
4420
- const Ss = h.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ P.jsx(
4421
- ws,
4422
- {
4423
- ref: t,
4424
- className: ke(
4425
- "flex cursor-default items-center justify-center py-1",
4426
- e
4427
- ),
4428
- ...r,
4429
- children: /* @__PURE__ */ P.jsx(Bs, { className: "h-4 w-4" })
4430
- }
4431
- ));
4432
- Ss.displayName = ws.displayName;
4433
- const Es = h.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ P.jsx(
4434
- xs,
4435
- {
4436
- ref: t,
4437
- className: ke(
4438
- "flex cursor-default items-center justify-center py-1",
4439
- e
4440
- ),
4441
- ...r,
4442
- children: /* @__PURE__ */ P.jsx(Bn, { className: "h-4 w-4" })
4443
- }
4444
- ));
4445
- Es.displayName = xs.displayName;
4446
- const Uc = h.forwardRef(({ className: e, children: r, position: t = "popper", ...n }, o) => /* @__PURE__ */ P.jsx(Vc, { children: /* @__PURE__ */ P.jsxs(
4447
- vs,
4448
- {
4449
- ref: o,
4450
- className: ke(
4451
- "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",
4452
- 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",
4453
- e
4454
- ),
4455
- position: t,
4456
- ...n,
4457
- children: [
4458
- /* @__PURE__ */ P.jsx(Ss, {}),
4459
- /* @__PURE__ */ P.jsx(
4460
- Lc,
4461
- {
4462
- className: ke(
4463
- "p-1",
4464
- t === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
4465
- ),
4466
- children: r
4467
- }
4468
- ),
4469
- /* @__PURE__ */ P.jsx(Es, {})
4470
- ]
4471
- }
4472
- ) }));
4473
- Uc.displayName = vs.displayName;
4474
- const $c = h.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ P.jsx(
4475
- gs,
4476
- {
4477
- ref: t,
4478
- className: ke("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
4479
- ...r
4480
- }
4481
- ));
4482
- $c.displayName = gs.displayName;
4483
- const zc = h.forwardRef(({ className: e, children: r, ...t }, n) => /* @__PURE__ */ P.jsxs(
4484
- ys,
4485
- {
4486
- ref: n,
4487
- className: ke(
4488
- "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",
4489
- e
4490
- ),
4491
- ...t,
4492
- children: [
4493
- /* @__PURE__ */ P.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ P.jsx(Wc, { children: /* @__PURE__ */ P.jsx(Ls, { className: "h-4 w-4" }) }) }),
4494
- /* @__PURE__ */ P.jsx(Bc, { children: r })
4495
- ]
4496
- }
4497
- ));
4498
- zc.displayName = ys.displayName;
4499
- const Kc = h.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ P.jsx(
4500
- bs,
4501
- {
4502
- ref: t,
4503
- className: ke("-mx-1 my-1 h-px bg-muted", e),
4504
- ...r
4505
- }
4506
- ));
4507
- Kc.displayName = bs.displayName;
4508
- const Yc = js(
4509
- "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
4510
- {
4511
- variants: {
4512
- variant: {
4513
- default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
4514
- destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
4515
- outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
4516
- secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
4517
- ghost: "hover:bg-accent hover:text-accent-foreground",
4518
- link: "text-primary underline-offset-4 hover:underline"
4519
- },
4520
- size: {
4521
- default: "h-9 px-4 py-2",
4522
- sm: "h-8 rounded-md px-3 text-xs",
4523
- lg: "h-10 rounded-md px-8",
4524
- icon: "h-9 w-9"
4525
- }
4526
- },
4527
- defaultVariants: {
4528
- variant: "default",
4529
- size: "default"
4530
- }
4531
- }
4532
- ), qc = h.forwardRef(
4533
- ({ className: e, variant: r, size: t, asChild: n = !1, ...o }, s) => {
4534
- const i = n ? Ht : "button";
4535
- return /* @__PURE__ */ P.jsx(
4536
- i,
4537
- {
4538
- className: ke(Yc({ variant: r, size: t, className: e })),
4539
- ref: s,
4540
- ...o
4541
- }
4542
- );
4543
- }
4544
- );
4545
- qc.displayName = "Button";
4546
- export {
4547
- qc as B,
4548
- sl as C,
4549
- oo as D,
4550
- io as F,
4551
- To as P,
4552
- jo as R,
4553
- ll as S,
4554
- Oo as V,
4555
- nl as a,
4556
- Hc as b,
4557
- dl as c,
4558
- Uc as d,
4559
- ul as e,
4560
- zc as f,
4561
- oi as g,
4562
- ii as h,
4563
- Da as i,
4564
- mi as j,
4565
- il as k,
4566
- zs as l,
4567
- Jt as m,
4568
- ol as n,
4569
- al as u
4570
- };
4571
- //# sourceMappingURL=Button-DpHMZvVs.js.map