zudoku 0.3.0-dev.54 → 0.3.0-dev.55

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 (121) hide show
  1. package/lib/AnchorLink-BaXHjhF-.js +989 -0
  2. package/lib/{AnchorLink-BCN_a_Uz.js.map → AnchorLink-BaXHjhF-.js.map} +1 -1
  3. package/lib/Combination-BfufJFkX.js +1365 -0
  4. package/lib/{Combination-B0Iu6mhJ.js.map → Combination-BfufJFkX.js.map} +1 -1
  5. package/lib/DevPortalProvider-GjdO0Xr-.js +1610 -0
  6. package/lib/{DevPortalProvider-Do9oJqme.js.map → DevPortalProvider-GjdO0Xr-.js.map} +1 -1
  7. package/lib/Markdown-B8nPVql1.js +19708 -0
  8. package/lib/Markdown-B8nPVql1.js.map +1 -0
  9. package/lib/MdxPage-Dlujuj-J.js +223 -0
  10. package/lib/{MdxPage-Bsc79cD-.js.map → MdxPage-Dlujuj-J.js.map} +1 -1
  11. package/lib/OperationList-krPgt6sE.js +8041 -0
  12. package/lib/{OperationList-K-JWBxau.js.map → OperationList-krPgt6sE.js.map} +1 -1
  13. package/lib/Playground-DOHxca0P.js +539 -0
  14. package/lib/{Playground-Czy7ha9z.js.map → Playground-DOHxca0P.js.map} +1 -1
  15. package/lib/Route-CR6TEwVC.js +13 -0
  16. package/lib/{Route-D-egsGHx.js.map → Route-CR6TEwVC.js.map} +1 -1
  17. package/lib/Select-Boi_pe3L.js +5298 -0
  18. package/lib/{Select-CcBbwJ2R.js.map → Select-Boi_pe3L.js.map} +1 -1
  19. package/lib/Spinner-oU0QJmi_.js +16 -0
  20. package/lib/{Spinner-C9_Opdev.js.map → Spinner-oU0QJmi_.js.map} +1 -1
  21. package/lib/_commonjsHelpers-BxmBWJD2.js +34 -0
  22. package/lib/_commonjsHelpers-BxmBWJD2.js.map +1 -0
  23. package/lib/assets/index-CpIig0AX.js +6341 -0
  24. package/lib/{index-pI9JkN46.js.map → assets/index-CpIig0AX.js.map} +1 -1
  25. package/lib/assets/worker-B5k2aBV9.js +18921 -0
  26. package/lib/assets/{worker-BjPv-hjP.js.map → worker-B5k2aBV9.js.map} +1 -1
  27. package/lib/context-BoN_3uxi.js +17 -0
  28. package/lib/{context-_fYfJFgk.js.map → context-BoN_3uxi.js.map} +1 -1
  29. package/lib/hook-CIuFuyBT.js +90 -0
  30. package/lib/{hook-CKqQERWo.js.map → hook-CIuFuyBT.js.map} +1 -1
  31. package/lib/index-BL1P4Gqq.js +280 -0
  32. package/lib/{index-ByHya67R.js.map → index-BL1P4Gqq.js.map} +1 -1
  33. package/lib/index-Bn03IPZt.js +6341 -0
  34. package/lib/{assets/index-BPdJm2ty.js.map → index-Bn03IPZt.js.map} +1 -1
  35. package/lib/{index-jsFBaizC.js → index-Dih8IAqw.js} +103 -83
  36. package/lib/{index-jsFBaizC.js.map → index-Dih8IAqw.js.map} +1 -1
  37. package/lib/index-FprhHF51.js +253 -0
  38. package/lib/{index-DseBZFJ-.js.map → index-FprhHF51.js.map} +1 -1
  39. package/lib/jsx-runtime-DvZ6OKMM.js +2110 -0
  40. package/lib/{jsx-runtime-CJZJivg2.js.map → jsx-runtime-DvZ6OKMM.js.map} +1 -1
  41. package/lib/mutation-DWY9x2Uc.js +250 -0
  42. package/lib/{mutation-DjbQSHzT.js.map → mutation-DWY9x2Uc.js.map} +1 -1
  43. package/lib/prism-bash.min-BtBk0onv.js +7 -0
  44. package/lib/{prism-bash.min-DadFsM4Z.js.map → prism-bash.min-BtBk0onv.js.map} +1 -1
  45. package/lib/prism-csharp.min-Cv7D49bv.js +30 -0
  46. package/lib/{prism-csharp.min-Yizuc34Y.js.map → prism-csharp.min-Cv7D49bv.js.map} +1 -1
  47. package/lib/prism-java.min-tNK-JX6x.js +7 -0
  48. package/lib/{prism-java.min-d5iT_mOd.js.map → prism-java.min-tNK-JX6x.js.map} +1 -1
  49. package/lib/prism-json.min-Cdtv-CME.js +2 -0
  50. package/lib/{prism-json.min-B1GJqK1k.js.map → prism-json.min-Cdtv-CME.js.map} +1 -1
  51. package/lib/prism-markup-templating-iotg2sCU.js +94 -0
  52. package/lib/{prism-markup-templating-DZrrEs0A.js.map → prism-markup-templating-iotg2sCU.js.map} +1 -1
  53. package/lib/prism-objectivec.min-CY4WGixz.js +2 -0
  54. package/lib/{prism-objectivec.min-BXSWqpJJ.js.map → prism-objectivec.min-CY4WGixz.js.map} +1 -1
  55. package/lib/prism-php.min-T6sIVgED.js +11 -0
  56. package/lib/{prism-php.min-o7FpoMP_.js.map → prism-php.min-T6sIVgED.js.map} +1 -1
  57. package/lib/prism-ruby.min-B-2KAa4y.js +8 -0
  58. package/lib/{prism-ruby.min-C7LwcKyz.js.map → prism-ruby.min-B-2KAa4y.js.map} +1 -1
  59. package/lib/router-ButO1QyY.js +4062 -0
  60. package/lib/{router-CBw2vqJE.js.map → router-ButO1QyY.js.map} +1 -1
  61. package/lib/slugify-CmS97Vy8.js +50 -0
  62. package/lib/{slugify-CiPVjteN.js.map → slugify-CmS97Vy8.js.map} +1 -1
  63. package/lib/state-CmGfNKhR.js +436 -0
  64. package/lib/{state-DKdaQzvh.js.map → state-CmGfNKhR.js.map} +1 -1
  65. package/lib/urql-DtVKPBx_.js +2567 -0
  66. package/lib/{urql-DEKdguFl.js.map → urql-DtVKPBx_.js.map} +1 -1
  67. package/lib/util-B5KX4h4M.js +55 -0
  68. package/lib/{util-_jwUlTBU.js.map → util-B5KX4h4M.js.map} +1 -1
  69. package/lib/zudoku.auth-auth0.js +24 -18
  70. package/lib/zudoku.auth-auth0.js.map +1 -1
  71. package/lib/zudoku.auth-clerk.js +43 -34
  72. package/lib/zudoku.auth-clerk.js.map +1 -1
  73. package/lib/zudoku.auth-openid.js +1121 -734
  74. package/lib/zudoku.auth-openid.js.map +1 -1
  75. package/lib/zudoku.components.js +1076 -823
  76. package/lib/zudoku.components.js.map +1 -1
  77. package/lib/zudoku.openapi-worker.js +13776 -9681
  78. package/lib/zudoku.openapi-worker.js.map +1 -1
  79. package/lib/zudoku.plugin-api-keys.js +206 -165
  80. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  81. package/lib/zudoku.plugin-markdown.js +41 -33
  82. package/lib/zudoku.plugin-markdown.js.map +1 -1
  83. package/lib/zudoku.plugin-openapi.js +6 -6
  84. package/lib/zudoku.plugin-redirect.js +10 -8
  85. package/lib/zudoku.plugin-redirect.js.map +1 -1
  86. package/package.json +1 -1
  87. package/lib/AnchorLink-BCN_a_Uz.js +0 -705
  88. package/lib/Combination-B0Iu6mhJ.js +0 -915
  89. package/lib/DevPortalProvider-Do9oJqme.js +0 -1081
  90. package/lib/Markdown-aE_XoLNs.js +0 -15030
  91. package/lib/Markdown-aE_XoLNs.js.map +0 -1
  92. package/lib/MdxPage-Bsc79cD-.js +0 -190
  93. package/lib/OperationList-K-JWBxau.js +0 -5091
  94. package/lib/Playground-Czy7ha9z.js +0 -502
  95. package/lib/Route-D-egsGHx.js +0 -13
  96. package/lib/Select-CcBbwJ2R.js +0 -3667
  97. package/lib/Spinner-C9_Opdev.js +0 -15
  98. package/lib/_commonjsHelpers-BVfed4GL.js +0 -29
  99. package/lib/_commonjsHelpers-BVfed4GL.js.map +0 -1
  100. package/lib/assets/index-BPdJm2ty.js +0 -4765
  101. package/lib/assets/worker-BjPv-hjP.js +0 -14897
  102. package/lib/context-_fYfJFgk.js +0 -14
  103. package/lib/hook-CKqQERWo.js +0 -77
  104. package/lib/index-ByHya67R.js +0 -207
  105. package/lib/index-DseBZFJ-.js +0 -170
  106. package/lib/index-pI9JkN46.js +0 -4765
  107. package/lib/jsx-runtime-CJZJivg2.js +0 -1526
  108. package/lib/mutation-DjbQSHzT.js +0 -208
  109. package/lib/prism-bash.min-DadFsM4Z.js +0 -7
  110. package/lib/prism-csharp.min-Yizuc34Y.js +0 -35
  111. package/lib/prism-java.min-d5iT_mOd.js +0 -7
  112. package/lib/prism-json.min-B1GJqK1k.js +0 -2
  113. package/lib/prism-markup-templating-DZrrEs0A.js +0 -62
  114. package/lib/prism-objectivec.min-BXSWqpJJ.js +0 -2
  115. package/lib/prism-php.min-o7FpoMP_.js +0 -11
  116. package/lib/prism-ruby.min-C7LwcKyz.js +0 -10
  117. package/lib/router-CBw2vqJE.js +0 -2973
  118. package/lib/slugify-CiPVjteN.js +0 -28
  119. package/lib/state-DKdaQzvh.js +0 -288
  120. package/lib/urql-DEKdguFl.js +0 -1592
  121. package/lib/util-_jwUlTBU.js +0 -41
@@ -1,3667 +0,0 @@
1
- var Nr = (e) => {
2
- throw TypeError(e);
3
- };
4
- var qt = (e, r, t) => r.has(e) || Nr("Cannot " + t);
5
- var te = (e, r, t) => (qt(e, r, "read from private field"), t ? t.call(e) : r.get(e)), nt = (e, r, t) => r.has(e) ? Nr("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(e) : r.set(e, t), st = (e, r, t, n) => (qt(e, r, "write to private field"), n ? n.call(e, t) : r.set(e, t), t), ot = (e, r, t) => (qt(e, r, "access private method"), t);
6
- import * as v from "react";
7
- import H, { useLayoutEffect as Os, useEffect as Fs } from "react";
8
- import { g as Ts } from "./mutation-DjbQSHzT.js";
9
- import { S as Vs, w as Ds, i as Ir, n as en, q as Ns, x as Is, y as ks } from "./DevPortalProvider-Do9oJqme.js";
10
- import { j as P } from "./jsx-runtime-CJZJivg2.js";
11
- import * as gr from "react-dom";
12
- import { P as ue, g as _e, c as tn, u as we, b as rn, d as ce, S as Ms, e as yr, a as kr } from "./index-ByHya67R.js";
13
- import { c as Ls, h as js, a as Bs, R as Hs, F as Ws, D as Us, V as $s, P as zs, u as Ks } from "./Combination-B0Iu6mhJ.js";
14
- import { c as nn, e as Ue, k as qs } from "./Markdown-aE_XoLNs.js";
15
- /**
16
- * @license lucide-react v0.378.0 - ISC
17
- *
18
- * This source code is licensed under the ISC license.
19
- * See the LICENSE file in the root directory of this source tree.
20
- */
21
- const sn = nn("ChevronDown", [
22
- ["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
23
- ]);
24
- /**
25
- * @license lucide-react v0.378.0 - ISC
26
- *
27
- * This source code is licensed under the ISC license.
28
- * See the LICENSE file in the root directory of this source tree.
29
- */
30
- const Ys = nn("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
31
- var Be, He, fe, Ve, De, Et, ir, Jr, Gs = (Jr = class extends Vs {
32
- constructor(r, t) {
33
- super();
34
- nt(this, De);
35
- nt(this, Be);
36
- nt(this, He);
37
- nt(this, fe);
38
- nt(this, Ve);
39
- st(this, Be, r), this.setOptions(t), this.bindMethods(), ot(this, De, Et).call(this);
40
- }
41
- bindMethods() {
42
- this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
43
- }
44
- setOptions(r) {
45
- var n;
46
- const t = this.options;
47
- this.options = te(this, Be).defaultMutationOptions(r), Ds(this.options, t) || te(this, Be).getMutationCache().notify({
48
- type: "observerOptionsUpdated",
49
- mutation: te(this, fe),
50
- observer: this
51
- }), t != null && t.mutationKey && this.options.mutationKey && Ir(t.mutationKey) !== Ir(this.options.mutationKey) ? this.reset() : ((n = te(this, fe)) == null ? void 0 : n.state.status) === "pending" && te(this, fe).setOptions(this.options);
52
- }
53
- onUnsubscribe() {
54
- var r;
55
- this.hasListeners() || (r = te(this, fe)) == null || r.removeObserver(this);
56
- }
57
- onMutationUpdate(r) {
58
- ot(this, De, Et).call(this), ot(this, De, ir).call(this, r);
59
- }
60
- getCurrentResult() {
61
- return te(this, He);
62
- }
63
- reset() {
64
- var r;
65
- (r = te(this, fe)) == null || r.removeObserver(this), st(this, fe, void 0), ot(this, De, Et).call(this), ot(this, De, ir).call(this);
66
- }
67
- mutate(r, t) {
68
- var n;
69
- return st(this, Ve, t), (n = te(this, fe)) == null || n.removeObserver(this), st(this, fe, te(this, Be).getMutationCache().build(te(this, Be), this.options)), te(this, fe).addObserver(this), te(this, fe).execute(r);
70
- }
71
- }, Be = new WeakMap(), He = new WeakMap(), fe = new WeakMap(), Ve = new WeakMap(), De = new WeakSet(), Et = function() {
72
- var t;
73
- const r = ((t = te(this, fe)) == null ? void 0 : t.state) ?? Ts();
74
- st(this, He, {
75
- ...r,
76
- isPending: r.status === "pending",
77
- isSuccess: r.status === "success",
78
- isError: r.status === "error",
79
- isIdle: r.status === "idle",
80
- mutate: this.mutate,
81
- reset: this.reset
82
- });
83
- }, ir = function(r) {
84
- en.batch(() => {
85
- var t, n, s, o, i, a, c, u;
86
- if (te(this, Ve) && this.hasListeners()) {
87
- const p = te(this, He).variables, d = te(this, He).context;
88
- (r == null ? void 0 : r.type) === "success" ? ((n = (t = te(this, Ve)).onSuccess) == null || n.call(t, r.data, p, d), (o = (s = te(this, Ve)).onSettled) == null || o.call(s, r.data, null, p, d)) : (r == null ? void 0 : r.type) === "error" && ((a = (i = te(this, Ve)).onError) == null || a.call(i, r.error, p, d), (u = (c = te(this, Ve)).onSettled) == null || u.call(
89
- c,
90
- void 0,
91
- r.error,
92
- p,
93
- d
94
- ));
95
- }
96
- this.listeners.forEach((p) => {
97
- p(te(this, He));
98
- });
99
- });
100
- }, Jr);
101
- function na(e, r) {
102
- const t = Ns(), [n] = v.useState(
103
- () => new Gs(
104
- t,
105
- e
106
- )
107
- );
108
- v.useEffect(() => {
109
- n.setOptions(e);
110
- }, [n, e]);
111
- const s = v.useSyncExternalStore(
112
- v.useCallback(
113
- (i) => n.subscribe(en.batchCalls(i)),
114
- [n]
115
- ),
116
- () => n.getCurrentResult(),
117
- () => n.getCurrentResult()
118
- ), o = v.useCallback(
119
- (i, a) => {
120
- n.mutate(i, a).catch(Is);
121
- },
122
- [n]
123
- );
124
- if (s.error && ks(n.options.throwOnError, [s.error]))
125
- throw s.error;
126
- return { ...s, mutate: o, mutateAsync: s.mutate };
127
- }
128
- var wt = (e) => e.type === "checkbox", at = (e) => e instanceof Date, le = (e) => e == null;
129
- const on = (e) => typeof e == "object";
130
- var ie = (e) => !le(e) && !Array.isArray(e) && on(e) && !at(e), an = (e) => ie(e) && e.target ? wt(e.target) ? e.target.checked : e.target.value : e, Xs = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, ln = (e, r) => e.has(Xs(r)), Zs = (e) => {
131
- const r = e.constructor && e.constructor.prototype;
132
- return ie(r) && r.hasOwnProperty("isPrototypeOf");
133
- }, vr = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
134
- function oe(e) {
135
- let r;
136
- const t = Array.isArray(e);
137
- if (e instanceof Date)
138
- r = new Date(e);
139
- else if (e instanceof Set)
140
- r = new Set(e);
141
- else if (!(vr && (e instanceof Blob || e instanceof FileList)) && (t || ie(e)))
142
- if (r = t ? [] : {}, !t && !Zs(e))
143
- r = e;
144
- else
145
- for (const n in e)
146
- e.hasOwnProperty(n) && (r[n] = oe(e[n]));
147
- else
148
- return e;
149
- return r;
150
- }
151
- var bt = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Q = (e) => e === void 0, C = (e, r, t) => {
152
- if (!r || !ie(e))
153
- return t;
154
- const n = bt(r.split(/[,[\].]+?/)).reduce((s, o) => le(s) ? s : s[o], e);
155
- return Q(n) || n === e ? Q(e[r]) ? t : e[r] : n;
156
- }, Ee = (e) => typeof e == "boolean", xr = (e) => /^\w*$/.test(e), cn = (e) => bt(e.replace(/["|']|\]/g, "").split(/\.|\[/)), X = (e, r, t) => {
157
- let n = -1;
158
- const s = xr(r) ? [r] : cn(r), o = s.length, i = o - 1;
159
- for (; ++n < o; ) {
160
- const a = s[n];
161
- let c = t;
162
- if (n !== i) {
163
- const u = e[a];
164
- c = ie(u) || Array.isArray(u) ? u : isNaN(+s[n + 1]) ? {} : [];
165
- }
166
- if (a === "__proto__")
167
- return;
168
- e[a] = c, e = e[a];
169
- }
170
- return e;
171
- };
172
- const Ot = {
173
- BLUR: "blur",
174
- FOCUS_OUT: "focusout",
175
- CHANGE: "change"
176
- }, xe = {
177
- onBlur: "onBlur",
178
- onChange: "onChange",
179
- onSubmit: "onSubmit",
180
- onTouched: "onTouched",
181
- all: "all"
182
- }, Fe = {
183
- max: "max",
184
- min: "min",
185
- maxLength: "maxLength",
186
- minLength: "minLength",
187
- pattern: "pattern",
188
- required: "required",
189
- validate: "validate"
190
- }, un = H.createContext(null), jt = () => H.useContext(un), sa = (e) => {
191
- const { children: r, ...t } = e;
192
- return H.createElement(un.Provider, { value: t }, r);
193
- };
194
- var fn = (e, r, t, n = !0) => {
195
- const s = {
196
- defaultValues: r._defaultValues
197
- };
198
- for (const o in e)
199
- Object.defineProperty(s, o, {
200
- get: () => {
201
- const i = o;
202
- return r._proxyFormState[i] !== xe.all && (r._proxyFormState[i] = !n || xe.all), t && (t[i] = !0), e[i];
203
- }
204
- });
205
- return s;
206
- }, de = (e) => ie(e) && !Object.keys(e).length, dn = (e, r, t, n) => {
207
- t(e);
208
- const { name: s, ...o } = e;
209
- return de(o) || Object.keys(o).length >= Object.keys(r).length || Object.keys(o).find((i) => r[i] === (!n || xe.all));
210
- }, pe = (e) => Array.isArray(e) ? e : [e], pn = (e, r, t) => !e || !r || e === r || pe(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n)));
211
- function Bt(e) {
212
- const r = H.useRef(e);
213
- r.current = e, H.useEffect(() => {
214
- const t = !e.disabled && r.current.subject && r.current.subject.subscribe({
215
- next: r.current.next
216
- });
217
- return () => {
218
- t && t.unsubscribe();
219
- };
220
- }, [e.disabled]);
221
- }
222
- function Qs(e) {
223
- const r = jt(), { control: t = r.control, disabled: n, name: s, exact: o } = e || {}, [i, a] = H.useState(t._formState), c = H.useRef(!0), u = H.useRef({
224
- isDirty: !1,
225
- isLoading: !1,
226
- dirtyFields: !1,
227
- touchedFields: !1,
228
- validatingFields: !1,
229
- isValidating: !1,
230
- isValid: !1,
231
- errors: !1
232
- }), p = H.useRef(s);
233
- return p.current = s, Bt({
234
- disabled: n,
235
- next: (d) => c.current && pn(p.current, d.name, o) && dn(d, u.current, t._updateFormState) && a({
236
- ...t._formState,
237
- ...d
238
- }),
239
- subject: t._subjects.state
240
- }), H.useEffect(() => (c.current = !0, u.current.isValid && t._updateValid(!0), () => {
241
- c.current = !1;
242
- }), [t]), fn(i, t, u.current, !1);
243
- }
244
- var Re = (e) => typeof e == "string", hn = (e, r, t, n, s) => Re(e) ? (n && r.watch.add(e), C(t, e, s)) : Array.isArray(e) ? e.map((o) => (n && r.watch.add(o), C(t, o))) : (n && (r.watchAll = !0), t);
245
- function Js(e) {
246
- const r = jt(), { control: t = r.control, name: n, defaultValue: s, disabled: o, exact: i } = e || {}, a = H.useRef(n);
247
- a.current = n, Bt({
248
- disabled: o,
249
- subject: t._subjects.values,
250
- next: (p) => {
251
- pn(a.current, p.name, i) && u(oe(hn(a.current, t._names, p.values || t._formValues, !1, s)));
252
- }
253
- });
254
- const [c, u] = H.useState(t._getWatch(n, s));
255
- return H.useEffect(() => t._removeUnmounted()), c;
256
- }
257
- function eo(e) {
258
- const r = jt(), { name: t, disabled: n, control: s = r.control, shouldUnregister: o } = e, i = ln(s._names.array, t), a = Js({
259
- control: s,
260
- name: t,
261
- defaultValue: C(s._formValues, t, C(s._defaultValues, t, e.defaultValue)),
262
- exact: !0
263
- }), c = Qs({
264
- control: s,
265
- name: t
266
- }), u = H.useRef(s.register(t, {
267
- ...e.rules,
268
- value: a,
269
- ...Ee(e.disabled) ? { disabled: e.disabled } : {}
270
- }));
271
- return H.useEffect(() => {
272
- const p = s._options.shouldUnregister || o, d = (x, w) => {
273
- const g = C(s._fields, x);
274
- g && g._f && (g._f.mount = w);
275
- };
276
- if (d(t, !0), p) {
277
- const x = oe(C(s._options.defaultValues, t));
278
- X(s._defaultValues, t, x), Q(C(s._formValues, t)) && X(s._formValues, t, x);
279
- }
280
- return () => {
281
- (i ? p && !s._state.action : p) ? s.unregister(t) : d(t, !1);
282
- };
283
- }, [t, s, i, o]), H.useEffect(() => {
284
- C(s._fields, t) && s._updateDisabledField({
285
- disabled: n,
286
- fields: s._fields,
287
- name: t,
288
- value: C(s._fields, t)._f.value
289
- });
290
- }, [n, t, s]), {
291
- field: {
292
- name: t,
293
- value: a,
294
- ...Ee(n) || c.disabled ? { disabled: c.disabled || n } : {},
295
- onChange: H.useCallback((p) => u.current.onChange({
296
- target: {
297
- value: an(p),
298
- name: t
299
- },
300
- type: Ot.CHANGE
301
- }), [t]),
302
- onBlur: H.useCallback(() => u.current.onBlur({
303
- target: {
304
- value: C(s._formValues, t),
305
- name: t
306
- },
307
- type: Ot.BLUR
308
- }), [t, s]),
309
- ref: (p) => {
310
- const d = C(s._fields, t);
311
- d && p && (d._f.ref = {
312
- focus: () => p.focus(),
313
- select: () => p.select(),
314
- setCustomValidity: (x) => p.setCustomValidity(x),
315
- reportValidity: () => p.reportValidity()
316
- });
317
- }
318
- },
319
- formState: c,
320
- fieldState: Object.defineProperties({}, {
321
- invalid: {
322
- enumerable: !0,
323
- get: () => !!C(c.errors, t)
324
- },
325
- isDirty: {
326
- enumerable: !0,
327
- get: () => !!C(c.dirtyFields, t)
328
- },
329
- isTouched: {
330
- enumerable: !0,
331
- get: () => !!C(c.touchedFields, t)
332
- },
333
- isValidating: {
334
- enumerable: !0,
335
- get: () => !!C(c.validatingFields, t)
336
- },
337
- error: {
338
- enumerable: !0,
339
- get: () => C(c.errors, t)
340
- }
341
- })
342
- };
343
- }
344
- const oa = (e) => e.render(eo(e));
345
- var to = (e, r, t, n, s) => r ? {
346
- ...t[e],
347
- types: {
348
- ...t[e] && t[e].types ? t[e].types : {},
349
- [n]: s || !0
350
- }
351
- } : {}, je = () => {
352
- const e = typeof performance > "u" ? Date.now() : performance.now() * 1e3;
353
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
354
- const t = (Math.random() * 16 + e) % 16 | 0;
355
- return (r == "x" ? t : t & 3 | 8).toString(16);
356
- });
357
- }, Yt = (e, r, t = {}) => t.shouldFocus || Q(t.shouldFocus) ? t.focusName || `${e}.${Q(t.focusIndex) ? r : t.focusIndex}.` : "", yt = (e) => ({
358
- isOnSubmit: !e || e === xe.onSubmit,
359
- isOnBlur: e === xe.onBlur,
360
- isOnChange: e === xe.onChange,
361
- isOnAll: e === xe.all,
362
- isOnTouch: e === xe.onTouched
363
- }), ar = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
364
- const lt = (e, r, t, n) => {
365
- for (const s of t || Object.keys(e)) {
366
- const o = C(e, s);
367
- if (o) {
368
- const { _f: i, ...a } = o;
369
- if (i) {
370
- if (i.refs && i.refs[0] && r(i.refs[0], s) && !n)
371
- break;
372
- if (i.ref && r(i.ref, i.name) && !n)
373
- break;
374
- lt(a, r);
375
- } else ie(a) && lt(a, r);
376
- }
377
- }
378
- };
379
- var mn = (e, r, t) => {
380
- const n = pe(C(e, t));
381
- return X(n, "root", r[t]), X(e, t, n), e;
382
- }, wr = (e) => e.type === "file", We = (e) => typeof e == "function", Ft = (e) => {
383
- if (!vr)
384
- return !1;
385
- const r = e ? e.ownerDocument : 0;
386
- return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
387
- }, Rt = (e) => Re(e), br = (e) => e.type === "radio", Tt = (e) => e instanceof RegExp;
388
- const Mr = {
389
- value: !1,
390
- isValid: !1
391
- }, Lr = { value: !0, isValid: !0 };
392
- var gn = (e) => {
393
- if (Array.isArray(e)) {
394
- if (e.length > 1) {
395
- const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
396
- return { value: r, isValid: !!r.length };
397
- }
398
- return e[0].checked && !e[0].disabled ? (
399
- // @ts-expect-error expected to work in the browser
400
- e[0].attributes && !Q(e[0].attributes.value) ? Q(e[0].value) || e[0].value === "" ? Lr : { value: e[0].value, isValid: !0 } : Lr
401
- ) : Mr;
402
- }
403
- return Mr;
404
- };
405
- const jr = {
406
- isValid: !1,
407
- value: null
408
- };
409
- var yn = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
410
- isValid: !0,
411
- value: t.value
412
- } : r, jr) : jr;
413
- function Br(e, r, t = "validate") {
414
- if (Rt(e) || Array.isArray(e) && e.every(Rt) || Ee(e) && !e)
415
- return {
416
- type: t,
417
- message: Rt(e) ? e : "",
418
- ref: r
419
- };
420
- }
421
- var it = (e) => ie(e) && !Tt(e) ? e : {
422
- value: e,
423
- message: ""
424
- }, lr = async (e, r, t, n, s) => {
425
- const { ref: o, refs: i, required: a, maxLength: c, minLength: u, min: p, max: d, pattern: x, validate: w, name: g, valueAsNumber: A, mount: E, disabled: b } = e._f, m = C(r, g);
426
- if (!E || b)
427
- return {};
428
- const R = i ? i[0] : o, D = (V) => {
429
- n && R.reportValidity && (R.setCustomValidity(Ee(V) ? "" : V || ""), R.reportValidity());
430
- }, y = {}, S = br(o), F = wt(o), N = S || F, $ = (A || wr(o)) && Q(o.value) && Q(m) || Ft(o) && o.value === "" || m === "" || Array.isArray(m) && !m.length, U = to.bind(null, g, t, y), J = (V, k, j, M = Fe.maxLength, W = Fe.minLength) => {
431
- const L = V ? k : j;
432
- y[g] = {
433
- type: V ? M : W,
434
- message: L,
435
- ref: o,
436
- ...U(V ? M : W, L)
437
- };
438
- };
439
- if (s ? !Array.isArray(m) || !m.length : a && (!N && ($ || le(m)) || Ee(m) && !m || F && !gn(i).isValid || S && !yn(i).isValid)) {
440
- const { value: V, message: k } = Rt(a) ? { value: !!a, message: a } : it(a);
441
- if (V && (y[g] = {
442
- type: Fe.required,
443
- message: k,
444
- ref: R,
445
- ...U(Fe.required, k)
446
- }, !t))
447
- return D(k), y;
448
- }
449
- if (!$ && (!le(p) || !le(d))) {
450
- let V, k;
451
- const j = it(d), M = it(p);
452
- if (!le(m) && !isNaN(m)) {
453
- const W = o.valueAsNumber || m && +m;
454
- le(j.value) || (V = W > j.value), le(M.value) || (k = W < M.value);
455
- } else {
456
- const W = o.valueAsDate || new Date(m), L = (be) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + be), Z = o.type == "time", ee = o.type == "week";
457
- Re(j.value) && m && (V = Z ? L(m) > L(j.value) : ee ? m > j.value : W > new Date(j.value)), Re(M.value) && m && (k = Z ? L(m) < L(M.value) : ee ? m < M.value : W < new Date(M.value));
458
- }
459
- if ((V || k) && (J(!!V, j.message, M.message, Fe.max, Fe.min), !t))
460
- return D(y[g].message), y;
461
- }
462
- if ((c || u) && !$ && (Re(m) || s && Array.isArray(m))) {
463
- const V = it(c), k = it(u), j = !le(V.value) && m.length > +V.value, M = !le(k.value) && m.length < +k.value;
464
- if ((j || M) && (J(j, V.message, k.message), !t))
465
- return D(y[g].message), y;
466
- }
467
- if (x && !$ && Re(m)) {
468
- const { value: V, message: k } = it(x);
469
- if (Tt(V) && !m.match(V) && (y[g] = {
470
- type: Fe.pattern,
471
- message: k,
472
- ref: o,
473
- ...U(Fe.pattern, k)
474
- }, !t))
475
- return D(k), y;
476
- }
477
- if (w) {
478
- if (We(w)) {
479
- const V = await w(m, r), k = Br(V, R);
480
- if (k && (y[g] = {
481
- ...k,
482
- ...U(Fe.validate, k.message)
483
- }, !t))
484
- return D(k.message), y;
485
- } else if (ie(w)) {
486
- let V = {};
487
- for (const k in w) {
488
- if (!de(V) && !t)
489
- break;
490
- const j = Br(await w[k](m, r), R, k);
491
- j && (V = {
492
- ...j,
493
- ...U(k, j.message)
494
- }, D(j.message), t && (y[g] = V));
495
- }
496
- if (!de(V) && (y[g] = {
497
- ref: R,
498
- ...V
499
- }, !t))
500
- return y;
501
- }
502
- }
503
- return D(!0), y;
504
- }, Gt = (e, r) => [
505
- ...e,
506
- ...pe(r)
507
- ], Xt = (e) => Array.isArray(e) ? e.map(() => {
508
- }) : void 0;
509
- function Zt(e, r, t) {
510
- return [
511
- ...e.slice(0, r),
512
- ...pe(t),
513
- ...e.slice(r)
514
- ];
515
- }
516
- var Qt = (e, r, t) => Array.isArray(e) ? (Q(e[t]) && (e[t] = void 0), e.splice(t, 0, e.splice(r, 1)[0]), e) : [], Jt = (e, r) => [
517
- ...pe(r),
518
- ...pe(e)
519
- ];
520
- function ro(e, r) {
521
- let t = 0;
522
- const n = [...e];
523
- for (const s of r)
524
- n.splice(s - t, 1), t++;
525
- return bt(n).length ? n : [];
526
- }
527
- var er = (e, r) => Q(r) ? [] : ro(e, pe(r).sort((t, n) => t - n)), tr = (e, r, t) => {
528
- [e[r], e[t]] = [e[t], e[r]];
529
- };
530
- function no(e, r) {
531
- const t = r.slice(0, -1).length;
532
- let n = 0;
533
- for (; n < t; )
534
- e = Q(e) ? n++ : e[r[n++]];
535
- return e;
536
- }
537
- function so(e) {
538
- for (const r in e)
539
- if (e.hasOwnProperty(r) && !Q(e[r]))
540
- return !1;
541
- return !0;
542
- }
543
- function ne(e, r) {
544
- const t = Array.isArray(r) ? r : xr(r) ? [r] : cn(r), n = t.length === 1 ? e : no(e, t), s = t.length - 1, o = t[s];
545
- return n && delete n[o], s !== 0 && (ie(n) && de(n) || Array.isArray(n) && so(n)) && ne(e, t.slice(0, -1)), e;
546
- }
547
- var Hr = (e, r, t) => (e[r] = t, e);
548
- function ia(e) {
549
- const r = jt(), { control: t = r.control, name: n, keyName: s = "id", shouldUnregister: o } = e, [i, a] = H.useState(t._getFieldArray(n)), c = H.useRef(t._getFieldArray(n).map(je)), u = H.useRef(i), p = H.useRef(n), d = H.useRef(!1);
550
- p.current = n, u.current = i, t._names.array.add(n), e.rules && t.register(n, e.rules), Bt({
551
- next: ({ values: y, name: S }) => {
552
- if (S === p.current || !S) {
553
- const F = C(y, p.current);
554
- Array.isArray(F) && (a(F), c.current = F.map(je));
555
- }
556
- },
557
- subject: t._subjects.array
558
- });
559
- const x = H.useCallback((y) => {
560
- d.current = !0, t._updateFieldArray(n, y);
561
- }, [t, n]), w = (y, S) => {
562
- const F = pe(oe(y)), N = Gt(t._getFieldArray(n), F);
563
- t._names.focus = Yt(n, N.length - 1, S), c.current = Gt(c.current, F.map(je)), x(N), a(N), t._updateFieldArray(n, N, Gt, {
564
- argA: Xt(y)
565
- });
566
- }, g = (y, S) => {
567
- const F = pe(oe(y)), N = Jt(t._getFieldArray(n), F);
568
- t._names.focus = Yt(n, 0, S), c.current = Jt(c.current, F.map(je)), x(N), a(N), t._updateFieldArray(n, N, Jt, {
569
- argA: Xt(y)
570
- });
571
- }, A = (y) => {
572
- const S = er(t._getFieldArray(n), y);
573
- c.current = er(c.current, y), x(S), a(S), t._updateFieldArray(n, S, er, {
574
- argA: y
575
- });
576
- }, E = (y, S, F) => {
577
- const N = pe(oe(S)), $ = Zt(t._getFieldArray(n), y, N);
578
- t._names.focus = Yt(n, y, F), c.current = Zt(c.current, y, N.map(je)), x($), a($), t._updateFieldArray(n, $, Zt, {
579
- argA: y,
580
- argB: Xt(S)
581
- });
582
- }, b = (y, S) => {
583
- const F = t._getFieldArray(n);
584
- tr(F, y, S), tr(c.current, y, S), x(F), a(F), t._updateFieldArray(n, F, tr, {
585
- argA: y,
586
- argB: S
587
- }, !1);
588
- }, m = (y, S) => {
589
- const F = t._getFieldArray(n);
590
- Qt(F, y, S), Qt(c.current, y, S), x(F), a(F), t._updateFieldArray(n, F, Qt, {
591
- argA: y,
592
- argB: S
593
- }, !1);
594
- }, R = (y, S) => {
595
- const F = oe(S), N = Hr(t._getFieldArray(n), y, F);
596
- c.current = [...N].map(($, U) => !$ || U === y ? je() : c.current[U]), x(N), a([...N]), t._updateFieldArray(n, N, Hr, {
597
- argA: y,
598
- argB: F
599
- }, !0, !1);
600
- }, D = (y) => {
601
- const S = pe(oe(y));
602
- c.current = S.map(je), x([...S]), a([...S]), t._updateFieldArray(n, [...S], (F) => F, {}, !0, !1);
603
- };
604
- return H.useEffect(() => {
605
- if (t._state.action = !1, ar(n, t._names) && t._subjects.state.next({
606
- ...t._formState
607
- }), d.current && (!yt(t._options.mode).isOnSubmit || t._formState.isSubmitted))
608
- if (t._options.resolver)
609
- t._executeSchema([n]).then((y) => {
610
- const S = C(y.errors, n), F = C(t._formState.errors, n);
611
- (F ? !S && F.type || S && (F.type !== S.type || F.message !== S.message) : S && S.type) && (S ? X(t._formState.errors, n, S) : ne(t._formState.errors, n), t._subjects.state.next({
612
- errors: t._formState.errors
613
- }));
614
- });
615
- else {
616
- const y = C(t._fields, n);
617
- y && y._f && !(yt(t._options.reValidateMode).isOnSubmit && yt(t._options.mode).isOnSubmit) && lr(y, t._formValues, t._options.criteriaMode === xe.all, t._options.shouldUseNativeValidation, !0).then((S) => !de(S) && t._subjects.state.next({
618
- errors: mn(t._formState.errors, S, n)
619
- }));
620
- }
621
- t._subjects.values.next({
622
- name: n,
623
- values: { ...t._formValues }
624
- }), t._names.focus && lt(t._fields, (y, S) => {
625
- if (t._names.focus && S.startsWith(t._names.focus) && y.focus)
626
- return y.focus(), 1;
627
- }), t._names.focus = "", t._updateValid(), d.current = !1;
628
- }, [i, n, t]), H.useEffect(() => (!C(t._formValues, n) && t._updateFieldArray(n), () => {
629
- (t._options.shouldUnregister || o) && t.unregister(n);
630
- }), [n, t, s, o]), {
631
- swap: H.useCallback(b, [x, n, t]),
632
- move: H.useCallback(m, [x, n, t]),
633
- prepend: H.useCallback(g, [x, n, t]),
634
- append: H.useCallback(w, [x, n, t]),
635
- remove: H.useCallback(A, [x, n, t]),
636
- insert: H.useCallback(E, [x, n, t]),
637
- update: H.useCallback(R, [x, n, t]),
638
- replace: H.useCallback(D, [x, n, t]),
639
- fields: H.useMemo(() => i.map((y, S) => ({
640
- ...y,
641
- [s]: c.current[S] || je()
642
- })), [i, s])
643
- };
644
- }
645
- var rr = () => {
646
- let e = [];
647
- return {
648
- get observers() {
649
- return e;
650
- },
651
- next: (s) => {
652
- for (const o of e)
653
- o.next && o.next(s);
654
- },
655
- subscribe: (s) => (e.push(s), {
656
- unsubscribe: () => {
657
- e = e.filter((o) => o !== s);
658
- }
659
- }),
660
- unsubscribe: () => {
661
- e = [];
662
- }
663
- };
664
- }, Vt = (e) => le(e) || !on(e);
665
- function Xe(e, r) {
666
- if (Vt(e) || Vt(r))
667
- return e === r;
668
- if (at(e) && at(r))
669
- return e.getTime() === r.getTime();
670
- const t = Object.keys(e), n = Object.keys(r);
671
- if (t.length !== n.length)
672
- return !1;
673
- for (const s of t) {
674
- const o = e[s];
675
- if (!n.includes(s))
676
- return !1;
677
- if (s !== "ref") {
678
- const i = r[s];
679
- if (at(o) && at(i) || ie(o) && ie(i) || Array.isArray(o) && Array.isArray(i) ? !Xe(o, i) : o !== i)
680
- return !1;
681
- }
682
- }
683
- return !0;
684
- }
685
- var vn = (e) => e.type === "select-multiple", oo = (e) => br(e) || wt(e), nr = (e) => Ft(e) && e.isConnected, xn = (e) => {
686
- for (const r in e)
687
- if (We(e[r]))
688
- return !0;
689
- return !1;
690
- };
691
- function Dt(e, r = {}) {
692
- const t = Array.isArray(e);
693
- if (ie(e) || t)
694
- for (const n in e)
695
- Array.isArray(e[n]) || ie(e[n]) && !xn(e[n]) ? (r[n] = Array.isArray(e[n]) ? [] : {}, Dt(e[n], r[n])) : le(e[n]) || (r[n] = !0);
696
- return r;
697
- }
698
- function wn(e, r, t) {
699
- const n = Array.isArray(e);
700
- if (ie(e) || n)
701
- for (const s in e)
702
- Array.isArray(e[s]) || ie(e[s]) && !xn(e[s]) ? Q(r) || Vt(t[s]) ? t[s] = Array.isArray(e[s]) ? Dt(e[s], []) : { ...Dt(e[s]) } : wn(e[s], le(r) ? {} : r[s], t[s]) : t[s] = !Xe(e[s], r[s]);
703
- return t;
704
- }
705
- var _t = (e, r) => wn(e, r, Dt(r)), bn = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => Q(e) ? e : r ? e === "" ? NaN : e && +e : t && Re(e) ? new Date(e) : n ? n(e) : e;
706
- function sr(e) {
707
- const r = e.ref;
708
- if (!(e.refs ? e.refs.every((t) => t.disabled) : r.disabled))
709
- return wr(r) ? r.files : br(r) ? yn(e.refs).value : vn(r) ? [...r.selectedOptions].map(({ value: t }) => t) : wt(r) ? gn(e.refs).value : bn(Q(r.value) ? e.ref.value : r.value, e);
710
- }
711
- var io = (e, r, t, n) => {
712
- const s = {};
713
- for (const o of e) {
714
- const i = C(r, o);
715
- i && X(s, o, i._f);
716
- }
717
- return {
718
- criteriaMode: t,
719
- names: [...e],
720
- fields: s,
721
- shouldUseNativeValidation: n
722
- };
723
- }, mt = (e) => Q(e) ? e : Tt(e) ? e.source : ie(e) ? Tt(e.value) ? e.value.source : e.value : e, ao = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
724
- function Wr(e, r, t) {
725
- const n = C(e, t);
726
- if (n || xr(t))
727
- return {
728
- error: n,
729
- name: t
730
- };
731
- const s = t.split(".");
732
- for (; s.length; ) {
733
- const o = s.join("."), i = C(r, o), a = C(e, o);
734
- if (i && !Array.isArray(i) && t !== o)
735
- return { name: t };
736
- if (a && a.type)
737
- return {
738
- name: o,
739
- error: a
740
- };
741
- s.pop();
742
- }
743
- return {
744
- name: t
745
- };
746
- }
747
- var lo = (e, r, t, n, s) => s.isOnAll ? !1 : !t && s.isOnTouch ? !(r || e) : (t ? n.isOnBlur : s.isOnBlur) ? !e : (t ? n.isOnChange : s.isOnChange) ? e : !0, co = (e, r) => !bt(C(e, r)).length && ne(e, r);
748
- const uo = {
749
- mode: xe.onSubmit,
750
- reValidateMode: xe.onChange,
751
- shouldFocusError: !0
752
- };
753
- function fo(e = {}) {
754
- let r = {
755
- ...uo,
756
- ...e
757
- }, t = {
758
- submitCount: 0,
759
- isDirty: !1,
760
- isLoading: We(r.defaultValues),
761
- isValidating: !1,
762
- isSubmitted: !1,
763
- isSubmitting: !1,
764
- isSubmitSuccessful: !1,
765
- isValid: !1,
766
- touchedFields: {},
767
- dirtyFields: {},
768
- validatingFields: {},
769
- errors: r.errors || {},
770
- disabled: r.disabled || !1
771
- }, n = {}, s = ie(r.defaultValues) || ie(r.values) ? oe(r.defaultValues || r.values) || {} : {}, o = r.shouldUnregister ? {} : oe(s), i = {
772
- action: !1,
773
- mount: !1,
774
- watch: !1
775
- }, a = {
776
- mount: /* @__PURE__ */ new Set(),
777
- unMount: /* @__PURE__ */ new Set(),
778
- array: /* @__PURE__ */ new Set(),
779
- watch: /* @__PURE__ */ new Set()
780
- }, c, u = 0;
781
- const p = {
782
- isDirty: !1,
783
- dirtyFields: !1,
784
- validatingFields: !1,
785
- touchedFields: !1,
786
- isValidating: !1,
787
- isValid: !1,
788
- errors: !1
789
- }, d = {
790
- values: rr(),
791
- array: rr(),
792
- state: rr()
793
- }, x = yt(r.mode), w = yt(r.reValidateMode), g = r.criteriaMode === xe.all, A = (l) => (f) => {
794
- clearTimeout(u), u = setTimeout(l, f);
795
- }, E = async (l) => {
796
- if (p.isValid || l) {
797
- const f = r.resolver ? de((await N()).errors) : await U(n, !0);
798
- f !== t.isValid && d.state.next({
799
- isValid: f
800
- });
801
- }
802
- }, b = (l, f) => {
803
- (p.isValidating || p.validatingFields) && ((l || Array.from(a.mount)).forEach((h) => {
804
- h && (f ? X(t.validatingFields, h, f) : ne(t.validatingFields, h));
805
- }), d.state.next({
806
- validatingFields: t.validatingFields,
807
- isValidating: !de(t.validatingFields)
808
- }));
809
- }, m = (l, f = [], h, T, O = !0, _ = !0) => {
810
- if (T && h) {
811
- if (i.action = !0, _ && Array.isArray(C(n, l))) {
812
- const I = h(C(n, l), T.argA, T.argB);
813
- O && X(n, l, I);
814
- }
815
- if (_ && Array.isArray(C(t.errors, l))) {
816
- const I = h(C(t.errors, l), T.argA, T.argB);
817
- O && X(t.errors, l, I), co(t.errors, l);
818
- }
819
- if (p.touchedFields && _ && Array.isArray(C(t.touchedFields, l))) {
820
- const I = h(C(t.touchedFields, l), T.argA, T.argB);
821
- O && X(t.touchedFields, l, I);
822
- }
823
- p.dirtyFields && (t.dirtyFields = _t(s, o)), d.state.next({
824
- name: l,
825
- isDirty: V(l, f),
826
- dirtyFields: t.dirtyFields,
827
- errors: t.errors,
828
- isValid: t.isValid
829
- });
830
- } else
831
- X(o, l, f);
832
- }, R = (l, f) => {
833
- X(t.errors, l, f), d.state.next({
834
- errors: t.errors
835
- });
836
- }, D = (l) => {
837
- t.errors = l, d.state.next({
838
- errors: t.errors,
839
- isValid: !1
840
- });
841
- }, y = (l, f, h, T) => {
842
- const O = C(n, l);
843
- if (O) {
844
- const _ = C(o, l, Q(h) ? C(s, l) : h);
845
- Q(_) || T && T.defaultChecked || f ? X(o, l, f ? _ : sr(O._f)) : M(l, _), i.mount && E();
846
- }
847
- }, S = (l, f, h, T, O) => {
848
- let _ = !1, I = !1;
849
- const q = {
850
- name: l
851
- }, re = !!(C(n, l) && C(n, l)._f && C(n, l)._f.disabled);
852
- if (!h || T) {
853
- p.isDirty && (I = t.isDirty, t.isDirty = q.isDirty = V(), _ = I !== q.isDirty);
854
- const me = re || Xe(C(s, l), f);
855
- I = !!(!re && C(t.dirtyFields, l)), me || re ? ne(t.dirtyFields, l) : X(t.dirtyFields, l, !0), q.dirtyFields = t.dirtyFields, _ = _ || p.dirtyFields && I !== !me;
856
- }
857
- if (h) {
858
- const me = C(t.touchedFields, l);
859
- me || (X(t.touchedFields, l, h), q.touchedFields = t.touchedFields, _ = _ || p.touchedFields && me !== h);
860
- }
861
- return _ && O && d.state.next(q), _ ? q : {};
862
- }, F = (l, f, h, T) => {
863
- const O = C(t.errors, l), _ = p.isValid && Ee(f) && t.isValid !== f;
864
- if (e.delayError && h ? (c = A(() => R(l, h)), c(e.delayError)) : (clearTimeout(u), c = null, h ? X(t.errors, l, h) : ne(t.errors, l)), (h ? !Xe(O, h) : O) || !de(T) || _) {
865
- const I = {
866
- ...T,
867
- ..._ && Ee(f) ? { isValid: f } : {},
868
- errors: t.errors,
869
- name: l
870
- };
871
- t = {
872
- ...t,
873
- ...I
874
- }, d.state.next(I);
875
- }
876
- }, N = async (l) => {
877
- b(l, !0);
878
- const f = await r.resolver(o, r.context, io(l || a.mount, n, r.criteriaMode, r.shouldUseNativeValidation));
879
- return b(l), f;
880
- }, $ = async (l) => {
881
- const { errors: f } = await N(l);
882
- if (l)
883
- for (const h of l) {
884
- const T = C(f, h);
885
- T ? X(t.errors, h, T) : ne(t.errors, h);
886
- }
887
- else
888
- t.errors = f;
889
- return f;
890
- }, U = async (l, f, h = {
891
- valid: !0
892
- }) => {
893
- for (const T in l) {
894
- const O = l[T];
895
- if (O) {
896
- const { _f: _, ...I } = O;
897
- if (_) {
898
- const q = a.array.has(_.name);
899
- b([T], !0);
900
- const re = await lr(O, o, g, r.shouldUseNativeValidation && !f, q);
901
- if (b([T]), re[_.name] && (h.valid = !1, f))
902
- break;
903
- !f && (C(re, _.name) ? q ? mn(t.errors, re, _.name) : X(t.errors, _.name, re[_.name]) : ne(t.errors, _.name));
904
- }
905
- I && await U(I, f, h);
906
- }
907
- }
908
- return h.valid;
909
- }, J = () => {
910
- for (const l of a.unMount) {
911
- const f = C(n, l);
912
- f && (f._f.refs ? f._f.refs.every((h) => !nr(h)) : !nr(f._f.ref)) && Ae(l);
913
- }
914
- a.unMount = /* @__PURE__ */ new Set();
915
- }, V = (l, f) => (l && f && X(o, l, f), !Xe(ve(), s)), k = (l, f, h) => hn(l, a, {
916
- ...i.mount ? o : Q(f) ? s : Re(l) ? { [l]: f } : f
917
- }, h, f), j = (l) => bt(C(i.mount ? o : s, l, e.shouldUnregister ? C(s, l, []) : [])), M = (l, f, h = {}) => {
918
- const T = C(n, l);
919
- let O = f;
920
- if (T) {
921
- const _ = T._f;
922
- _ && (!_.disabled && X(o, l, bn(f, _)), O = Ft(_.ref) && le(f) ? "" : f, vn(_.ref) ? [..._.ref.options].forEach((I) => I.selected = O.includes(I.value)) : _.refs ? wt(_.ref) ? _.refs.length > 1 ? _.refs.forEach((I) => (!I.defaultChecked || !I.disabled) && (I.checked = Array.isArray(O) ? !!O.find((q) => q === I.value) : O === I.value)) : _.refs[0] && (_.refs[0].checked = !!O) : _.refs.forEach((I) => I.checked = I.value === O) : wr(_.ref) ? _.ref.value = "" : (_.ref.value = O, _.ref.type || d.values.next({
923
- name: l,
924
- values: { ...o }
925
- })));
926
- }
927
- (h.shouldDirty || h.shouldTouch) && S(l, O, h.shouldTouch, h.shouldDirty, !0), h.shouldValidate && be(l);
928
- }, W = (l, f, h) => {
929
- for (const T in f) {
930
- const O = f[T], _ = `${l}.${T}`, I = C(n, _);
931
- (a.array.has(l) || !Vt(O) || I && !I._f) && !at(O) ? W(_, O, h) : M(_, O, h);
932
- }
933
- }, L = (l, f, h = {}) => {
934
- const T = C(n, l), O = a.array.has(l), _ = oe(f);
935
- X(o, l, _), O ? (d.array.next({
936
- name: l,
937
- values: { ...o }
938
- }), (p.isDirty || p.dirtyFields) && h.shouldDirty && d.state.next({
939
- name: l,
940
- dirtyFields: _t(s, o),
941
- isDirty: V(l, _)
942
- })) : T && !T._f && !le(_) ? W(l, _, h) : M(l, _, h), ar(l, a) && d.state.next({ ...t }), d.values.next({
943
- name: i.mount ? l : void 0,
944
- values: { ...o }
945
- });
946
- }, Z = async (l) => {
947
- i.mount = !0;
948
- const f = l.target;
949
- let h = f.name, T = !0;
950
- const O = C(n, h), _ = () => f.type ? sr(O._f) : an(l), I = (q) => {
951
- T = Number.isNaN(q) || q === C(o, h, q);
952
- };
953
- if (O) {
954
- let q, re;
955
- const me = _(), rt = l.type === Ot.BLUR || l.type === Ot.FOCUS_OUT, Es = !ao(O._f) && !r.resolver && !C(t.errors, h) && !O._f.deps || lo(rt, C(t.touchedFields, h), t.isSubmitted, w, x), zt = ar(h, a, rt);
956
- X(o, h, me), rt ? (O._f.onBlur && O._f.onBlur(l), c && c(0)) : O._f.onChange && O._f.onChange(l);
957
- const Kt = S(h, me, rt, !1), Rs = !de(Kt) || zt;
958
- if (!rt && d.values.next({
959
- name: h,
960
- type: l.type,
961
- values: { ...o }
962
- }), Es)
963
- return p.isValid && E(), Rs && d.state.next({ name: h, ...zt ? {} : Kt });
964
- if (!rt && zt && d.state.next({ ...t }), r.resolver) {
965
- const { errors: Vr } = await N([h]);
966
- if (I(me), T) {
967
- const Ps = Wr(t.errors, n, h), Dr = Wr(Vr, n, Ps.name || h);
968
- q = Dr.error, h = Dr.name, re = de(Vr);
969
- }
970
- } else
971
- b([h], !0), q = (await lr(O, o, g, r.shouldUseNativeValidation))[h], b([h]), I(me), T && (q ? re = !1 : p.isValid && (re = await U(n, !0)));
972
- T && (O._f.deps && be(O._f.deps), F(h, re, q, Kt));
973
- }
974
- }, ee = (l, f) => {
975
- if (C(t.errors, f) && l.focus)
976
- return l.focus(), 1;
977
- }, be = async (l, f = {}) => {
978
- let h, T;
979
- const O = pe(l);
980
- if (r.resolver) {
981
- const _ = await $(Q(l) ? l : O);
982
- h = de(_), T = l ? !O.some((I) => C(_, I)) : h;
983
- } else l ? (T = (await Promise.all(O.map(async (_) => {
984
- const I = C(n, _);
985
- return await U(I && I._f ? { [_]: I } : I);
986
- }))).every(Boolean), !(!T && !t.isValid) && E()) : T = h = await U(n);
987
- return d.state.next({
988
- ...!Re(l) || p.isValid && h !== t.isValid ? {} : { name: l },
989
- ...r.resolver || !l ? { isValid: h } : {},
990
- errors: t.errors
991
- }), f.shouldFocus && !T && lt(n, ee, l ? O : a.mount), T;
992
- }, ve = (l) => {
993
- const f = {
994
- ...i.mount ? o : s
995
- };
996
- return Q(l) ? f : Re(l) ? C(f, l) : l.map((h) => C(f, h));
997
- }, Me = (l, f) => ({
998
- invalid: !!C((f || t).errors, l),
999
- isDirty: !!C((f || t).dirtyFields, l),
1000
- error: C((f || t).errors, l),
1001
- isValidating: !!C(t.validatingFields, l),
1002
- isTouched: !!C((f || t).touchedFields, l)
1003
- }), Ge = (l) => {
1004
- l && pe(l).forEach((f) => ne(t.errors, f)), d.state.next({
1005
- errors: l ? t.errors : {}
1006
- });
1007
- }, Se = (l, f, h) => {
1008
- const T = (C(n, l, { _f: {} })._f || {}).ref, O = C(t.errors, l) || {}, { ref: _, message: I, type: q, ...re } = O;
1009
- X(t.errors, l, {
1010
- ...re,
1011
- ...f,
1012
- ref: T
1013
- }), d.state.next({
1014
- name: l,
1015
- errors: t.errors,
1016
- isValid: !1
1017
- }), h && h.shouldFocus && T && T.focus && T.focus();
1018
- }, Le = (l, f) => We(l) ? d.values.subscribe({
1019
- next: (h) => l(k(void 0, f), h)
1020
- }) : k(l, f, !0), Ae = (l, f = {}) => {
1021
- for (const h of l ? pe(l) : a.mount)
1022
- a.mount.delete(h), a.array.delete(h), f.keepValue || (ne(n, h), ne(o, h)), !f.keepError && ne(t.errors, h), !f.keepDirty && ne(t.dirtyFields, h), !f.keepTouched && ne(t.touchedFields, h), !f.keepIsValidating && ne(t.validatingFields, h), !r.shouldUnregister && !f.keepDefaultValue && ne(s, h);
1023
- d.values.next({
1024
- values: { ...o }
1025
- }), d.state.next({
1026
- ...t,
1027
- ...f.keepDirty ? { isDirty: V() } : {}
1028
- }), !f.keepIsValid && E();
1029
- }, B = ({ disabled: l, name: f, field: h, fields: T, value: O }) => {
1030
- if (Ee(l) && i.mount || l) {
1031
- const _ = l ? void 0 : Q(O) ? sr(h ? h._f : C(T, f)._f) : O;
1032
- X(o, f, _), S(f, _, !1, !1, !0);
1033
- }
1034
- }, Y = (l, f = {}) => {
1035
- let h = C(n, l);
1036
- const T = Ee(f.disabled);
1037
- return X(n, l, {
1038
- ...h || {},
1039
- _f: {
1040
- ...h && h._f ? h._f : { ref: { name: l } },
1041
- name: l,
1042
- mount: !0,
1043
- ...f
1044
- }
1045
- }), a.mount.add(l), h ? B({
1046
- field: h,
1047
- disabled: f.disabled,
1048
- name: l,
1049
- value: f.value
1050
- }) : y(l, !0, f.value), {
1051
- ...T ? { disabled: f.disabled } : {},
1052
- ...r.progressive ? {
1053
- required: !!f.required,
1054
- min: mt(f.min),
1055
- max: mt(f.max),
1056
- minLength: mt(f.minLength),
1057
- maxLength: mt(f.maxLength),
1058
- pattern: mt(f.pattern)
1059
- } : {},
1060
- name: l,
1061
- onChange: Z,
1062
- onBlur: Z,
1063
- ref: (O) => {
1064
- if (O) {
1065
- Y(l, f), h = C(n, l);
1066
- const _ = Q(O.value) && O.querySelectorAll && O.querySelectorAll("input,select,textarea")[0] || O, I = oo(_), q = h._f.refs || [];
1067
- if (I ? q.find((re) => re === _) : _ === h._f.ref)
1068
- return;
1069
- X(n, l, {
1070
- _f: {
1071
- ...h._f,
1072
- ...I ? {
1073
- refs: [
1074
- ...q.filter(nr),
1075
- _,
1076
- ...Array.isArray(C(s, l)) ? [{}] : []
1077
- ],
1078
- ref: { type: _.type, name: l }
1079
- } : { ref: _ }
1080
- }
1081
- }), y(l, !1, void 0, _);
1082
- } else
1083
- h = C(n, l, {}), h._f && (h._f.mount = !1), (r.shouldUnregister || f.shouldUnregister) && !(ln(a.array, l) && i.action) && a.unMount.add(l);
1084
- }
1085
- };
1086
- }, se = () => r.shouldFocusError && lt(n, ee, a.mount), G = (l) => {
1087
- Ee(l) && (d.state.next({ disabled: l }), lt(n, (f, h) => {
1088
- const T = C(n, h);
1089
- T && (f.disabled = T._f.disabled || l, Array.isArray(T._f.refs) && T._f.refs.forEach((O) => {
1090
- O.disabled = T._f.disabled || l;
1091
- }));
1092
- }, 0, !1));
1093
- }, z = (l, f) => async (h) => {
1094
- let T;
1095
- h && (h.preventDefault && h.preventDefault(), h.persist && h.persist());
1096
- let O = oe(o);
1097
- if (d.state.next({
1098
- isSubmitting: !0
1099
- }), r.resolver) {
1100
- const { errors: _, values: I } = await N();
1101
- t.errors = _, O = I;
1102
- } else
1103
- await U(n);
1104
- if (ne(t.errors, "root"), de(t.errors)) {
1105
- d.state.next({
1106
- errors: {}
1107
- });
1108
- try {
1109
- await l(O, h);
1110
- } catch (_) {
1111
- T = _;
1112
- }
1113
- } else
1114
- f && await f({ ...t.errors }, h), se(), setTimeout(se);
1115
- if (d.state.next({
1116
- isSubmitted: !0,
1117
- isSubmitting: !1,
1118
- isSubmitSuccessful: de(t.errors) && !T,
1119
- submitCount: t.submitCount + 1,
1120
- errors: t.errors
1121
- }), T)
1122
- throw T;
1123
- }, K = (l, f = {}) => {
1124
- C(n, l) && (Q(f.defaultValue) ? L(l, oe(C(s, l))) : (L(l, f.defaultValue), X(s, l, oe(f.defaultValue))), f.keepTouched || ne(t.touchedFields, l), f.keepDirty || (ne(t.dirtyFields, l), t.isDirty = f.defaultValue ? V(l, oe(C(s, l))) : V()), f.keepError || (ne(t.errors, l), p.isValid && E()), d.state.next({ ...t }));
1125
- }, ae = (l, f = {}) => {
1126
- const h = l ? oe(l) : s, T = oe(h), O = de(l), _ = O ? s : T;
1127
- if (f.keepDefaultValues || (s = h), !f.keepValues) {
1128
- if (f.keepDirtyValues)
1129
- for (const I of a.mount)
1130
- C(t.dirtyFields, I) ? X(_, I, C(o, I)) : L(I, C(_, I));
1131
- else {
1132
- if (vr && Q(l))
1133
- for (const I of a.mount) {
1134
- const q = C(n, I);
1135
- if (q && q._f) {
1136
- const re = Array.isArray(q._f.refs) ? q._f.refs[0] : q._f.ref;
1137
- if (Ft(re)) {
1138
- const me = re.closest("form");
1139
- if (me) {
1140
- me.reset();
1141
- break;
1142
- }
1143
- }
1144
- }
1145
- }
1146
- n = {};
1147
- }
1148
- o = e.shouldUnregister ? f.keepDefaultValues ? oe(s) : {} : oe(_), d.array.next({
1149
- values: { ..._ }
1150
- }), d.values.next({
1151
- values: { ..._ }
1152
- });
1153
- }
1154
- a = {
1155
- mount: f.keepDirtyValues ? a.mount : /* @__PURE__ */ new Set(),
1156
- unMount: /* @__PURE__ */ new Set(),
1157
- array: /* @__PURE__ */ new Set(),
1158
- watch: /* @__PURE__ */ new Set(),
1159
- watchAll: !1,
1160
- focus: ""
1161
- }, i.mount = !p.isValid || !!f.keepIsValid || !!f.keepDirtyValues, i.watch = !!e.shouldUnregister, d.state.next({
1162
- submitCount: f.keepSubmitCount ? t.submitCount : 0,
1163
- isDirty: O ? !1 : f.keepDirty ? t.isDirty : !!(f.keepDefaultValues && !Xe(l, s)),
1164
- isSubmitted: f.keepIsSubmitted ? t.isSubmitted : !1,
1165
- dirtyFields: O ? {} : f.keepDirtyValues ? f.keepDefaultValues && o ? _t(s, o) : t.dirtyFields : f.keepDefaultValues && l ? _t(s, l) : f.keepDirty ? t.dirtyFields : {},
1166
- touchedFields: f.keepTouched ? t.touchedFields : {},
1167
- errors: f.keepErrors ? t.errors : {},
1168
- isSubmitSuccessful: f.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
1169
- isSubmitting: !1
1170
- });
1171
- }, he = (l, f) => ae(We(l) ? l(o) : l, f);
1172
- return {
1173
- control: {
1174
- register: Y,
1175
- unregister: Ae,
1176
- getFieldState: Me,
1177
- handleSubmit: z,
1178
- setError: Se,
1179
- _executeSchema: N,
1180
- _getWatch: k,
1181
- _getDirty: V,
1182
- _updateValid: E,
1183
- _removeUnmounted: J,
1184
- _updateFieldArray: m,
1185
- _updateDisabledField: B,
1186
- _getFieldArray: j,
1187
- _reset: ae,
1188
- _resetDefaultValues: () => We(r.defaultValues) && r.defaultValues().then((l) => {
1189
- he(l, r.resetOptions), d.state.next({
1190
- isLoading: !1
1191
- });
1192
- }),
1193
- _updateFormState: (l) => {
1194
- t = {
1195
- ...t,
1196
- ...l
1197
- };
1198
- },
1199
- _disableForm: G,
1200
- _subjects: d,
1201
- _proxyFormState: p,
1202
- _setErrors: D,
1203
- get _fields() {
1204
- return n;
1205
- },
1206
- get _formValues() {
1207
- return o;
1208
- },
1209
- get _state() {
1210
- return i;
1211
- },
1212
- set _state(l) {
1213
- i = l;
1214
- },
1215
- get _defaultValues() {
1216
- return s;
1217
- },
1218
- get _names() {
1219
- return a;
1220
- },
1221
- set _names(l) {
1222
- a = l;
1223
- },
1224
- get _formState() {
1225
- return t;
1226
- },
1227
- set _formState(l) {
1228
- t = l;
1229
- },
1230
- get _options() {
1231
- return r;
1232
- },
1233
- set _options(l) {
1234
- r = {
1235
- ...r,
1236
- ...l
1237
- };
1238
- }
1239
- },
1240
- trigger: be,
1241
- register: Y,
1242
- handleSubmit: z,
1243
- watch: Le,
1244
- setValue: L,
1245
- getValues: ve,
1246
- reset: he,
1247
- resetField: K,
1248
- clearErrors: Ge,
1249
- unregister: Ae,
1250
- setError: Se,
1251
- setFocus: (l, f = {}) => {
1252
- const h = C(n, l), T = h && h._f;
1253
- if (T) {
1254
- const O = T.refs ? T.refs[0] : T.ref;
1255
- O.focus && (O.focus(), f.shouldSelect && O.select());
1256
- }
1257
- },
1258
- getFieldState: Me
1259
- };
1260
- }
1261
- function aa(e = {}) {
1262
- const r = H.useRef(), t = H.useRef(), [n, s] = H.useState({
1263
- isDirty: !1,
1264
- isValidating: !1,
1265
- isLoading: We(e.defaultValues),
1266
- isSubmitted: !1,
1267
- isSubmitting: !1,
1268
- isSubmitSuccessful: !1,
1269
- isValid: !1,
1270
- submitCount: 0,
1271
- dirtyFields: {},
1272
- touchedFields: {},
1273
- validatingFields: {},
1274
- errors: e.errors || {},
1275
- disabled: e.disabled || !1,
1276
- defaultValues: We(e.defaultValues) ? void 0 : e.defaultValues
1277
- });
1278
- r.current || (r.current = {
1279
- ...fo(e),
1280
- formState: n
1281
- });
1282
- const o = r.current.control;
1283
- return o._options = e, Bt({
1284
- subject: o._subjects.state,
1285
- next: (i) => {
1286
- dn(i, o._proxyFormState, o._updateFormState, !0) && s({ ...o._formState });
1287
- }
1288
- }), H.useEffect(() => o._disableForm(e.disabled), [o, e.disabled]), H.useEffect(() => {
1289
- if (o._proxyFormState.isDirty) {
1290
- const i = o._getDirty();
1291
- i !== n.isDirty && o._subjects.state.next({
1292
- isDirty: i
1293
- });
1294
- }
1295
- }, [o, n.isDirty]), H.useEffect(() => {
1296
- e.values && !Xe(e.values, t.current) ? (o._reset(e.values, o._options.resetOptions), t.current = e.values, s((i) => ({ ...i }))) : o._resetDefaultValues();
1297
- }, [e.values, o]), H.useEffect(() => {
1298
- e.errors && o._setErrors(e.errors);
1299
- }, [e.errors, o]), H.useEffect(() => {
1300
- o._state.mount || (o._updateValid(), o._state.mount = !0), o._state.watch && (o._state.watch = !1, o._subjects.state.next({ ...o._formState })), o._removeUnmounted();
1301
- }), H.useEffect(() => {
1302
- e.shouldUnregister && o._subjects.values.next({
1303
- values: o._getWatch()
1304
- });
1305
- }, [e.shouldUnregister, o]), r.current.formState = fn(n, o), r.current;
1306
- }
1307
- function Ur(e, [r, t]) {
1308
- return Math.min(t, Math.max(r, e));
1309
- }
1310
- const po = ["top", "right", "bottom", "left"], $e = Math.min, ge = Math.max, Nt = Math.round, Ct = Math.floor, ze = (e) => ({
1311
- x: e,
1312
- y: e
1313
- }), ho = {
1314
- left: "right",
1315
- right: "left",
1316
- bottom: "top",
1317
- top: "bottom"
1318
- }, mo = {
1319
- start: "end",
1320
- end: "start"
1321
- };
1322
- function cr(e, r, t) {
1323
- return ge(e, $e(r, t));
1324
- }
1325
- function Ne(e, r) {
1326
- return typeof e == "function" ? e(r) : e;
1327
- }
1328
- function Ie(e) {
1329
- return e.split("-")[0];
1330
- }
1331
- function ft(e) {
1332
- return e.split("-")[1];
1333
- }
1334
- function Sr(e) {
1335
- return e === "x" ? "y" : "x";
1336
- }
1337
- function Ar(e) {
1338
- return e === "y" ? "height" : "width";
1339
- }
1340
- function dt(e) {
1341
- return ["top", "bottom"].includes(Ie(e)) ? "y" : "x";
1342
- }
1343
- function _r(e) {
1344
- return Sr(dt(e));
1345
- }
1346
- function go(e, r, t) {
1347
- t === void 0 && (t = !1);
1348
- const n = ft(e), s = _r(e), o = Ar(s);
1349
- let i = s === "x" ? n === (t ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
1350
- return r.reference[o] > r.floating[o] && (i = It(i)), [i, It(i)];
1351
- }
1352
- function yo(e) {
1353
- const r = It(e);
1354
- return [ur(e), r, ur(r)];
1355
- }
1356
- function ur(e) {
1357
- return e.replace(/start|end/g, (r) => mo[r]);
1358
- }
1359
- function vo(e, r, t) {
1360
- const n = ["left", "right"], s = ["right", "left"], o = ["top", "bottom"], i = ["bottom", "top"];
1361
- switch (e) {
1362
- case "top":
1363
- case "bottom":
1364
- return t ? r ? s : n : r ? n : s;
1365
- case "left":
1366
- case "right":
1367
- return r ? o : i;
1368
- default:
1369
- return [];
1370
- }
1371
- }
1372
- function xo(e, r, t, n) {
1373
- const s = ft(e);
1374
- let o = vo(Ie(e), t === "start", n);
1375
- return s && (o = o.map((i) => i + "-" + s), r && (o = o.concat(o.map(ur)))), o;
1376
- }
1377
- function It(e) {
1378
- return e.replace(/left|right|bottom|top/g, (r) => ho[r]);
1379
- }
1380
- function wo(e) {
1381
- return {
1382
- top: 0,
1383
- right: 0,
1384
- bottom: 0,
1385
- left: 0,
1386
- ...e
1387
- };
1388
- }
1389
- function Sn(e) {
1390
- return typeof e != "number" ? wo(e) : {
1391
- top: e,
1392
- right: e,
1393
- bottom: e,
1394
- left: e
1395
- };
1396
- }
1397
- function kt(e) {
1398
- const {
1399
- x: r,
1400
- y: t,
1401
- width: n,
1402
- height: s
1403
- } = e;
1404
- return {
1405
- width: n,
1406
- height: s,
1407
- top: t,
1408
- left: r,
1409
- right: r + n,
1410
- bottom: t + s,
1411
- x: r,
1412
- y: t
1413
- };
1414
- }
1415
- function $r(e, r, t) {
1416
- let {
1417
- reference: n,
1418
- floating: s
1419
- } = e;
1420
- const o = dt(r), i = _r(r), a = Ar(i), c = Ie(r), u = o === "y", p = n.x + n.width / 2 - s.width / 2, d = n.y + n.height / 2 - s.height / 2, x = n[a] / 2 - s[a] / 2;
1421
- let w;
1422
- switch (c) {
1423
- case "top":
1424
- w = {
1425
- x: p,
1426
- y: n.y - s.height
1427
- };
1428
- break;
1429
- case "bottom":
1430
- w = {
1431
- x: p,
1432
- y: n.y + n.height
1433
- };
1434
- break;
1435
- case "right":
1436
- w = {
1437
- x: n.x + n.width,
1438
- y: d
1439
- };
1440
- break;
1441
- case "left":
1442
- w = {
1443
- x: n.x - s.width,
1444
- y: d
1445
- };
1446
- break;
1447
- default:
1448
- w = {
1449
- x: n.x,
1450
- y: n.y
1451
- };
1452
- }
1453
- switch (ft(r)) {
1454
- case "start":
1455
- w[i] -= x * (t && u ? -1 : 1);
1456
- break;
1457
- case "end":
1458
- w[i] += x * (t && u ? -1 : 1);
1459
- break;
1460
- }
1461
- return w;
1462
- }
1463
- const bo = async (e, r, t) => {
1464
- const {
1465
- placement: n = "bottom",
1466
- strategy: s = "absolute",
1467
- middleware: o = [],
1468
- platform: i
1469
- } = t, a = o.filter(Boolean), c = await (i.isRTL == null ? void 0 : i.isRTL(r));
1470
- let u = await i.getElementRects({
1471
- reference: e,
1472
- floating: r,
1473
- strategy: s
1474
- }), {
1475
- x: p,
1476
- y: d
1477
- } = $r(u, n, c), x = n, w = {}, g = 0;
1478
- for (let A = 0; A < a.length; A++) {
1479
- const {
1480
- name: E,
1481
- fn: b
1482
- } = a[A], {
1483
- x: m,
1484
- y: R,
1485
- data: D,
1486
- reset: y
1487
- } = await b({
1488
- x: p,
1489
- y: d,
1490
- initialPlacement: n,
1491
- placement: x,
1492
- strategy: s,
1493
- middlewareData: w,
1494
- rects: u,
1495
- platform: i,
1496
- elements: {
1497
- reference: e,
1498
- floating: r
1499
- }
1500
- });
1501
- p = m ?? p, d = R ?? d, w = {
1502
- ...w,
1503
- [E]: {
1504
- ...w[E],
1505
- ...D
1506
- }
1507
- }, y && g <= 50 && (g++, typeof y == "object" && (y.placement && (x = y.placement), y.rects && (u = y.rects === !0 ? await i.getElementRects({
1508
- reference: e,
1509
- floating: r,
1510
- strategy: s
1511
- }) : y.rects), {
1512
- x: p,
1513
- y: d
1514
- } = $r(u, x, c)), A = -1);
1515
- }
1516
- return {
1517
- x: p,
1518
- y: d,
1519
- placement: x,
1520
- strategy: s,
1521
- middlewareData: w
1522
- };
1523
- };
1524
- async function vt(e, r) {
1525
- var t;
1526
- r === void 0 && (r = {});
1527
- const {
1528
- x: n,
1529
- y: s,
1530
- platform: o,
1531
- rects: i,
1532
- elements: a,
1533
- strategy: c
1534
- } = e, {
1535
- boundary: u = "clippingAncestors",
1536
- rootBoundary: p = "viewport",
1537
- elementContext: d = "floating",
1538
- altBoundary: x = !1,
1539
- padding: w = 0
1540
- } = Ne(r, e), g = Sn(w), E = a[x ? d === "floating" ? "reference" : "floating" : d], b = kt(await o.getClippingRect({
1541
- element: (t = await (o.isElement == null ? void 0 : o.isElement(E))) == null || t ? E : E.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(a.floating)),
1542
- boundary: u,
1543
- rootBoundary: p,
1544
- strategy: c
1545
- })), m = d === "floating" ? {
1546
- x: n,
1547
- y: s,
1548
- width: i.floating.width,
1549
- height: i.floating.height
1550
- } : i.reference, R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(a.floating)), D = await (o.isElement == null ? void 0 : o.isElement(R)) ? await (o.getScale == null ? void 0 : o.getScale(R)) || {
1551
- x: 1,
1552
- y: 1
1553
- } : {
1554
- x: 1,
1555
- y: 1
1556
- }, y = kt(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
1557
- elements: a,
1558
- rect: m,
1559
- offsetParent: R,
1560
- strategy: c
1561
- }) : m);
1562
- return {
1563
- top: (b.top - y.top + g.top) / D.y,
1564
- bottom: (y.bottom - b.bottom + g.bottom) / D.y,
1565
- left: (b.left - y.left + g.left) / D.x,
1566
- right: (y.right - b.right + g.right) / D.x
1567
- };
1568
- }
1569
- const So = (e) => ({
1570
- name: "arrow",
1571
- options: e,
1572
- async fn(r) {
1573
- const {
1574
- x: t,
1575
- y: n,
1576
- placement: s,
1577
- rects: o,
1578
- platform: i,
1579
- elements: a,
1580
- middlewareData: c
1581
- } = r, {
1582
- element: u,
1583
- padding: p = 0
1584
- } = Ne(e, r) || {};
1585
- if (u == null)
1586
- return {};
1587
- const d = Sn(p), x = {
1588
- x: t,
1589
- y: n
1590
- }, w = _r(s), g = Ar(w), A = await i.getDimensions(u), E = w === "y", b = E ? "top" : "left", m = E ? "bottom" : "right", R = E ? "clientHeight" : "clientWidth", D = o.reference[g] + o.reference[w] - x[w] - o.floating[g], y = x[w] - o.reference[w], S = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u));
1591
- let F = S ? S[R] : 0;
1592
- (!F || !await (i.isElement == null ? void 0 : i.isElement(S))) && (F = a.floating[R] || o.floating[g]);
1593
- const N = D / 2 - y / 2, $ = F / 2 - A[g] / 2 - 1, U = $e(d[b], $), J = $e(d[m], $), V = U, k = F - A[g] - J, j = F / 2 - A[g] / 2 + N, M = cr(V, j, k), W = !c.arrow && ft(s) != null && j !== M && o.reference[g] / 2 - (j < V ? U : J) - A[g] / 2 < 0, L = W ? j < V ? j - V : j - k : 0;
1594
- return {
1595
- [w]: x[w] + L,
1596
- data: {
1597
- [w]: M,
1598
- centerOffset: j - M - L,
1599
- ...W && {
1600
- alignmentOffset: L
1601
- }
1602
- },
1603
- reset: W
1604
- };
1605
- }
1606
- }), Ao = function(e) {
1607
- return e === void 0 && (e = {}), {
1608
- name: "flip",
1609
- options: e,
1610
- async fn(r) {
1611
- var t, n;
1612
- const {
1613
- placement: s,
1614
- middlewareData: o,
1615
- rects: i,
1616
- initialPlacement: a,
1617
- platform: c,
1618
- elements: u
1619
- } = r, {
1620
- mainAxis: p = !0,
1621
- crossAxis: d = !0,
1622
- fallbackPlacements: x,
1623
- fallbackStrategy: w = "bestFit",
1624
- fallbackAxisSideDirection: g = "none",
1625
- flipAlignment: A = !0,
1626
- ...E
1627
- } = Ne(e, r);
1628
- if ((t = o.arrow) != null && t.alignmentOffset)
1629
- return {};
1630
- const b = Ie(s), m = Ie(a) === a, R = await (c.isRTL == null ? void 0 : c.isRTL(u.floating)), D = x || (m || !A ? [It(a)] : yo(a));
1631
- !x && g !== "none" && D.push(...xo(a, A, g, R));
1632
- const y = [a, ...D], S = await vt(r, E), F = [];
1633
- let N = ((n = o.flip) == null ? void 0 : n.overflows) || [];
1634
- if (p && F.push(S[b]), d) {
1635
- const V = go(s, i, R);
1636
- F.push(S[V[0]], S[V[1]]);
1637
- }
1638
- if (N = [...N, {
1639
- placement: s,
1640
- overflows: F
1641
- }], !F.every((V) => V <= 0)) {
1642
- var $, U;
1643
- const V = ((($ = o.flip) == null ? void 0 : $.index) || 0) + 1, k = y[V];
1644
- if (k)
1645
- return {
1646
- data: {
1647
- index: V,
1648
- overflows: N
1649
- },
1650
- reset: {
1651
- placement: k
1652
- }
1653
- };
1654
- let j = (U = N.filter((M) => M.overflows[0] <= 0).sort((M, W) => M.overflows[1] - W.overflows[1])[0]) == null ? void 0 : U.placement;
1655
- if (!j)
1656
- switch (w) {
1657
- case "bestFit": {
1658
- var J;
1659
- const M = (J = N.map((W) => [W.placement, W.overflows.filter((L) => L > 0).reduce((L, Z) => L + Z, 0)]).sort((W, L) => W[1] - L[1])[0]) == null ? void 0 : J[0];
1660
- M && (j = M);
1661
- break;
1662
- }
1663
- case "initialPlacement":
1664
- j = a;
1665
- break;
1666
- }
1667
- if (s !== j)
1668
- return {
1669
- reset: {
1670
- placement: j
1671
- }
1672
- };
1673
- }
1674
- return {};
1675
- }
1676
- };
1677
- };
1678
- function zr(e, r) {
1679
- return {
1680
- top: e.top - r.height,
1681
- right: e.right - r.width,
1682
- bottom: e.bottom - r.height,
1683
- left: e.left - r.width
1684
- };
1685
- }
1686
- function Kr(e) {
1687
- return po.some((r) => e[r] >= 0);
1688
- }
1689
- const _o = function(e) {
1690
- return e === void 0 && (e = {}), {
1691
- name: "hide",
1692
- options: e,
1693
- async fn(r) {
1694
- const {
1695
- rects: t
1696
- } = r, {
1697
- strategy: n = "referenceHidden",
1698
- ...s
1699
- } = Ne(e, r);
1700
- switch (n) {
1701
- case "referenceHidden": {
1702
- const o = await vt(r, {
1703
- ...s,
1704
- elementContext: "reference"
1705
- }), i = zr(o, t.reference);
1706
- return {
1707
- data: {
1708
- referenceHiddenOffsets: i,
1709
- referenceHidden: Kr(i)
1710
- }
1711
- };
1712
- }
1713
- case "escaped": {
1714
- const o = await vt(r, {
1715
- ...s,
1716
- altBoundary: !0
1717
- }), i = zr(o, t.floating);
1718
- return {
1719
- data: {
1720
- escapedOffsets: i,
1721
- escaped: Kr(i)
1722
- }
1723
- };
1724
- }
1725
- default:
1726
- return {};
1727
- }
1728
- }
1729
- };
1730
- };
1731
- async function Co(e, r) {
1732
- const {
1733
- placement: t,
1734
- platform: n,
1735
- elements: s
1736
- } = e, o = await (n.isRTL == null ? void 0 : n.isRTL(s.floating)), i = Ie(t), a = ft(t), c = dt(t) === "y", u = ["left", "top"].includes(i) ? -1 : 1, p = o && c ? -1 : 1, d = Ne(r, e);
1737
- let {
1738
- mainAxis: x,
1739
- crossAxis: w,
1740
- alignmentAxis: g
1741
- } = typeof d == "number" ? {
1742
- mainAxis: d,
1743
- crossAxis: 0,
1744
- alignmentAxis: null
1745
- } : {
1746
- mainAxis: 0,
1747
- crossAxis: 0,
1748
- alignmentAxis: null,
1749
- ...d
1750
- };
1751
- return a && typeof g == "number" && (w = a === "end" ? g * -1 : g), c ? {
1752
- x: w * p,
1753
- y: x * u
1754
- } : {
1755
- x: x * u,
1756
- y: w * p
1757
- };
1758
- }
1759
- const Eo = function(e) {
1760
- return e === void 0 && (e = 0), {
1761
- name: "offset",
1762
- options: e,
1763
- async fn(r) {
1764
- var t, n;
1765
- const {
1766
- x: s,
1767
- y: o,
1768
- placement: i,
1769
- middlewareData: a
1770
- } = r, c = await Co(r, e);
1771
- return i === ((t = a.offset) == null ? void 0 : t.placement) && (n = a.arrow) != null && n.alignmentOffset ? {} : {
1772
- x: s + c.x,
1773
- y: o + c.y,
1774
- data: {
1775
- ...c,
1776
- placement: i
1777
- }
1778
- };
1779
- }
1780
- };
1781
- }, Ro = function(e) {
1782
- return e === void 0 && (e = {}), {
1783
- name: "shift",
1784
- options: e,
1785
- async fn(r) {
1786
- const {
1787
- x: t,
1788
- y: n,
1789
- placement: s
1790
- } = r, {
1791
- mainAxis: o = !0,
1792
- crossAxis: i = !1,
1793
- limiter: a = {
1794
- fn: (E) => {
1795
- let {
1796
- x: b,
1797
- y: m
1798
- } = E;
1799
- return {
1800
- x: b,
1801
- y: m
1802
- };
1803
- }
1804
- },
1805
- ...c
1806
- } = Ne(e, r), u = {
1807
- x: t,
1808
- y: n
1809
- }, p = await vt(r, c), d = dt(Ie(s)), x = Sr(d);
1810
- let w = u[x], g = u[d];
1811
- if (o) {
1812
- const E = x === "y" ? "top" : "left", b = x === "y" ? "bottom" : "right", m = w + p[E], R = w - p[b];
1813
- w = cr(m, w, R);
1814
- }
1815
- if (i) {
1816
- const E = d === "y" ? "top" : "left", b = d === "y" ? "bottom" : "right", m = g + p[E], R = g - p[b];
1817
- g = cr(m, g, R);
1818
- }
1819
- const A = a.fn({
1820
- ...r,
1821
- [x]: w,
1822
- [d]: g
1823
- });
1824
- return {
1825
- ...A,
1826
- data: {
1827
- x: A.x - t,
1828
- y: A.y - n
1829
- }
1830
- };
1831
- }
1832
- };
1833
- }, Po = function(e) {
1834
- return e === void 0 && (e = {}), {
1835
- options: e,
1836
- fn(r) {
1837
- const {
1838
- x: t,
1839
- y: n,
1840
- placement: s,
1841
- rects: o,
1842
- middlewareData: i
1843
- } = r, {
1844
- offset: a = 0,
1845
- mainAxis: c = !0,
1846
- crossAxis: u = !0
1847
- } = Ne(e, r), p = {
1848
- x: t,
1849
- y: n
1850
- }, d = dt(s), x = Sr(d);
1851
- let w = p[x], g = p[d];
1852
- const A = Ne(a, r), E = typeof A == "number" ? {
1853
- mainAxis: A,
1854
- crossAxis: 0
1855
- } : {
1856
- mainAxis: 0,
1857
- crossAxis: 0,
1858
- ...A
1859
- };
1860
- if (c) {
1861
- const R = x === "y" ? "height" : "width", D = o.reference[x] - o.floating[R] + E.mainAxis, y = o.reference[x] + o.reference[R] - E.mainAxis;
1862
- w < D ? w = D : w > y && (w = y);
1863
- }
1864
- if (u) {
1865
- var b, m;
1866
- const R = x === "y" ? "width" : "height", D = ["top", "left"].includes(Ie(s)), y = o.reference[d] - o.floating[R] + (D && ((b = i.offset) == null ? void 0 : b[d]) || 0) + (D ? 0 : E.crossAxis), S = o.reference[d] + o.reference[R] + (D ? 0 : ((m = i.offset) == null ? void 0 : m[d]) || 0) - (D ? E.crossAxis : 0);
1867
- g < y ? g = y : g > S && (g = S);
1868
- }
1869
- return {
1870
- [x]: w,
1871
- [d]: g
1872
- };
1873
- }
1874
- };
1875
- }, Oo = function(e) {
1876
- return e === void 0 && (e = {}), {
1877
- name: "size",
1878
- options: e,
1879
- async fn(r) {
1880
- const {
1881
- placement: t,
1882
- rects: n,
1883
- platform: s,
1884
- elements: o
1885
- } = r, {
1886
- apply: i = () => {
1887
- },
1888
- ...a
1889
- } = Ne(e, r), c = await vt(r, a), u = Ie(t), p = ft(t), d = dt(t) === "y", {
1890
- width: x,
1891
- height: w
1892
- } = n.floating;
1893
- let g, A;
1894
- u === "top" || u === "bottom" ? (g = u, A = p === (await (s.isRTL == null ? void 0 : s.isRTL(o.floating)) ? "start" : "end") ? "left" : "right") : (A = u, g = p === "end" ? "top" : "bottom");
1895
- const E = w - c[g], b = x - c[A], m = !r.middlewareData.shift;
1896
- let R = E, D = b;
1897
- if (d) {
1898
- const S = x - c.left - c.right;
1899
- D = p || m ? $e(b, S) : S;
1900
- } else {
1901
- const S = w - c.top - c.bottom;
1902
- R = p || m ? $e(E, S) : S;
1903
- }
1904
- if (m && !p) {
1905
- const S = ge(c.left, 0), F = ge(c.right, 0), N = ge(c.top, 0), $ = ge(c.bottom, 0);
1906
- d ? D = x - 2 * (S !== 0 || F !== 0 ? S + F : ge(c.left, c.right)) : R = w - 2 * (N !== 0 || $ !== 0 ? N + $ : ge(c.top, c.bottom));
1907
- }
1908
- await i({
1909
- ...r,
1910
- availableWidth: D,
1911
- availableHeight: R
1912
- });
1913
- const y = await s.getDimensions(o.floating);
1914
- return x !== y.width || w !== y.height ? {
1915
- reset: {
1916
- rects: !0
1917
- }
1918
- } : {};
1919
- }
1920
- };
1921
- };
1922
- function pt(e) {
1923
- return An(e) ? (e.nodeName || "").toLowerCase() : "#document";
1924
- }
1925
- function ye(e) {
1926
- var r;
1927
- return (e == null || (r = e.ownerDocument) == null ? void 0 : r.defaultView) || window;
1928
- }
1929
- function ke(e) {
1930
- var r;
1931
- return (r = (An(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : r.documentElement;
1932
- }
1933
- function An(e) {
1934
- return e instanceof Node || e instanceof ye(e).Node;
1935
- }
1936
- function Pe(e) {
1937
- return e instanceof Element || e instanceof ye(e).Element;
1938
- }
1939
- function Oe(e) {
1940
- return e instanceof HTMLElement || e instanceof ye(e).HTMLElement;
1941
- }
1942
- function qr(e) {
1943
- return typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof ye(e).ShadowRoot;
1944
- }
1945
- function St(e) {
1946
- const {
1947
- overflow: r,
1948
- overflowX: t,
1949
- overflowY: n,
1950
- display: s
1951
- } = Ce(e);
1952
- return /auto|scroll|overlay|hidden|clip/.test(r + n + t) && !["inline", "contents"].includes(s);
1953
- }
1954
- function Fo(e) {
1955
- return ["table", "td", "th"].includes(pt(e));
1956
- }
1957
- function Cr(e) {
1958
- const r = Er(), t = Ce(e);
1959
- 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));
1960
- }
1961
- function To(e) {
1962
- let r = Ke(e);
1963
- for (; Oe(r) && !ut(r); ) {
1964
- if (Cr(r))
1965
- return r;
1966
- r = Ke(r);
1967
- }
1968
- return null;
1969
- }
1970
- function Er() {
1971
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
1972
- }
1973
- function ut(e) {
1974
- return ["html", "body", "#document"].includes(pt(e));
1975
- }
1976
- function Ce(e) {
1977
- return ye(e).getComputedStyle(e);
1978
- }
1979
- function Ht(e) {
1980
- return Pe(e) ? {
1981
- scrollLeft: e.scrollLeft,
1982
- scrollTop: e.scrollTop
1983
- } : {
1984
- scrollLeft: e.pageXOffset,
1985
- scrollTop: e.pageYOffset
1986
- };
1987
- }
1988
- function Ke(e) {
1989
- if (pt(e) === "html")
1990
- return e;
1991
- const r = (
1992
- // Step into the shadow DOM of the parent of a slotted node.
1993
- e.assignedSlot || // DOM Element detected.
1994
- e.parentNode || // ShadowRoot detected.
1995
- qr(e) && e.host || // Fallback.
1996
- ke(e)
1997
- );
1998
- return qr(r) ? r.host : r;
1999
- }
2000
- function _n(e) {
2001
- const r = Ke(e);
2002
- return ut(r) ? e.ownerDocument ? e.ownerDocument.body : e.body : Oe(r) && St(r) ? r : _n(r);
2003
- }
2004
- function xt(e, r, t) {
2005
- var n;
2006
- r === void 0 && (r = []), t === void 0 && (t = !0);
2007
- const s = _n(e), o = s === ((n = e.ownerDocument) == null ? void 0 : n.body), i = ye(s);
2008
- return o ? r.concat(i, i.visualViewport || [], St(s) ? s : [], i.frameElement && t ? xt(i.frameElement) : []) : r.concat(s, xt(s, [], t));
2009
- }
2010
- function Cn(e) {
2011
- const r = Ce(e);
2012
- let t = parseFloat(r.width) || 0, n = parseFloat(r.height) || 0;
2013
- const s = Oe(e), o = s ? e.offsetWidth : t, i = s ? e.offsetHeight : n, a = Nt(t) !== o || Nt(n) !== i;
2014
- return a && (t = o, n = i), {
2015
- width: t,
2016
- height: n,
2017
- $: a
2018
- };
2019
- }
2020
- function Rr(e) {
2021
- return Pe(e) ? e : e.contextElement;
2022
- }
2023
- function ct(e) {
2024
- const r = Rr(e);
2025
- if (!Oe(r))
2026
- return ze(1);
2027
- const t = r.getBoundingClientRect(), {
2028
- width: n,
2029
- height: s,
2030
- $: o
2031
- } = Cn(r);
2032
- let i = (o ? Nt(t.width) : t.width) / n, a = (o ? Nt(t.height) : t.height) / s;
2033
- return (!i || !Number.isFinite(i)) && (i = 1), (!a || !Number.isFinite(a)) && (a = 1), {
2034
- x: i,
2035
- y: a
2036
- };
2037
- }
2038
- const Vo = /* @__PURE__ */ ze(0);
2039
- function En(e) {
2040
- const r = ye(e);
2041
- return !Er() || !r.visualViewport ? Vo : {
2042
- x: r.visualViewport.offsetLeft,
2043
- y: r.visualViewport.offsetTop
2044
- };
2045
- }
2046
- function Do(e, r, t) {
2047
- return r === void 0 && (r = !1), !t || r && t !== ye(e) ? !1 : r;
2048
- }
2049
- function Ze(e, r, t, n) {
2050
- r === void 0 && (r = !1), t === void 0 && (t = !1);
2051
- const s = e.getBoundingClientRect(), o = Rr(e);
2052
- let i = ze(1);
2053
- r && (n ? Pe(n) && (i = ct(n)) : i = ct(e));
2054
- const a = Do(o, t, n) ? En(o) : ze(0);
2055
- let c = (s.left + a.x) / i.x, u = (s.top + a.y) / i.y, p = s.width / i.x, d = s.height / i.y;
2056
- if (o) {
2057
- const x = ye(o), w = n && Pe(n) ? ye(n) : n;
2058
- let g = x, A = g.frameElement;
2059
- for (; A && n && w !== g; ) {
2060
- const E = ct(A), b = A.getBoundingClientRect(), m = Ce(A), R = b.left + (A.clientLeft + parseFloat(m.paddingLeft)) * E.x, D = b.top + (A.clientTop + parseFloat(m.paddingTop)) * E.y;
2061
- c *= E.x, u *= E.y, p *= E.x, d *= E.y, c += R, u += D, g = ye(A), A = g.frameElement;
2062
- }
2063
- }
2064
- return kt({
2065
- width: p,
2066
- height: d,
2067
- x: c,
2068
- y: u
2069
- });
2070
- }
2071
- const No = [":popover-open", ":modal"];
2072
- function Pr(e) {
2073
- return No.some((r) => {
2074
- try {
2075
- return e.matches(r);
2076
- } catch {
2077
- return !1;
2078
- }
2079
- });
2080
- }
2081
- function Io(e) {
2082
- let {
2083
- elements: r,
2084
- rect: t,
2085
- offsetParent: n,
2086
- strategy: s
2087
- } = e;
2088
- const o = s === "fixed", i = ke(n), a = r ? Pr(r.floating) : !1;
2089
- if (n === i || a && o)
2090
- return t;
2091
- let c = {
2092
- scrollLeft: 0,
2093
- scrollTop: 0
2094
- }, u = ze(1);
2095
- const p = ze(0), d = Oe(n);
2096
- if ((d || !d && !o) && ((pt(n) !== "body" || St(i)) && (c = Ht(n)), Oe(n))) {
2097
- const x = Ze(n);
2098
- u = ct(n), p.x = x.x + n.clientLeft, p.y = x.y + n.clientTop;
2099
- }
2100
- return {
2101
- width: t.width * u.x,
2102
- height: t.height * u.y,
2103
- x: t.x * u.x - c.scrollLeft * u.x + p.x,
2104
- y: t.y * u.y - c.scrollTop * u.y + p.y
2105
- };
2106
- }
2107
- function ko(e) {
2108
- return Array.from(e.getClientRects());
2109
- }
2110
- function Rn(e) {
2111
- return Ze(ke(e)).left + Ht(e).scrollLeft;
2112
- }
2113
- function Mo(e) {
2114
- const r = ke(e), t = Ht(e), n = e.ownerDocument.body, s = ge(r.scrollWidth, r.clientWidth, n.scrollWidth, n.clientWidth), o = ge(r.scrollHeight, r.clientHeight, n.scrollHeight, n.clientHeight);
2115
- let i = -t.scrollLeft + Rn(e);
2116
- const a = -t.scrollTop;
2117
- return Ce(n).direction === "rtl" && (i += ge(r.clientWidth, n.clientWidth) - s), {
2118
- width: s,
2119
- height: o,
2120
- x: i,
2121
- y: a
2122
- };
2123
- }
2124
- function Lo(e, r) {
2125
- const t = ye(e), n = ke(e), s = t.visualViewport;
2126
- let o = n.clientWidth, i = n.clientHeight, a = 0, c = 0;
2127
- if (s) {
2128
- o = s.width, i = s.height;
2129
- const u = Er();
2130
- (!u || u && r === "fixed") && (a = s.offsetLeft, c = s.offsetTop);
2131
- }
2132
- return {
2133
- width: o,
2134
- height: i,
2135
- x: a,
2136
- y: c
2137
- };
2138
- }
2139
- function jo(e, r) {
2140
- const t = Ze(e, !0, r === "fixed"), n = t.top + e.clientTop, s = t.left + e.clientLeft, o = Oe(e) ? ct(e) : ze(1), i = e.clientWidth * o.x, a = e.clientHeight * o.y, c = s * o.x, u = n * o.y;
2141
- return {
2142
- width: i,
2143
- height: a,
2144
- x: c,
2145
- y: u
2146
- };
2147
- }
2148
- function Yr(e, r, t) {
2149
- let n;
2150
- if (r === "viewport")
2151
- n = Lo(e, t);
2152
- else if (r === "document")
2153
- n = Mo(ke(e));
2154
- else if (Pe(r))
2155
- n = jo(r, t);
2156
- else {
2157
- const s = En(e);
2158
- n = {
2159
- ...r,
2160
- x: r.x - s.x,
2161
- y: r.y - s.y
2162
- };
2163
- }
2164
- return kt(n);
2165
- }
2166
- function Pn(e, r) {
2167
- const t = Ke(e);
2168
- return t === r || !Pe(t) || ut(t) ? !1 : Ce(t).position === "fixed" || Pn(t, r);
2169
- }
2170
- function Bo(e, r) {
2171
- const t = r.get(e);
2172
- if (t)
2173
- return t;
2174
- let n = xt(e, [], !1).filter((a) => Pe(a) && pt(a) !== "body"), s = null;
2175
- const o = Ce(e).position === "fixed";
2176
- let i = o ? Ke(e) : e;
2177
- for (; Pe(i) && !ut(i); ) {
2178
- const a = Ce(i), c = Cr(i);
2179
- !c && a.position === "fixed" && (s = null), (o ? !c && !s : !c && a.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || St(i) && !c && Pn(e, i)) ? n = n.filter((p) => p !== i) : s = a, i = Ke(i);
2180
- }
2181
- return r.set(e, n), n;
2182
- }
2183
- function Ho(e) {
2184
- let {
2185
- element: r,
2186
- boundary: t,
2187
- rootBoundary: n,
2188
- strategy: s
2189
- } = e;
2190
- const i = [...t === "clippingAncestors" ? Pr(r) ? [] : Bo(r, this._c) : [].concat(t), n], a = i[0], c = i.reduce((u, p) => {
2191
- const d = Yr(r, p, s);
2192
- return u.top = ge(d.top, u.top), u.right = $e(d.right, u.right), u.bottom = $e(d.bottom, u.bottom), u.left = ge(d.left, u.left), u;
2193
- }, Yr(r, a, s));
2194
- return {
2195
- width: c.right - c.left,
2196
- height: c.bottom - c.top,
2197
- x: c.left,
2198
- y: c.top
2199
- };
2200
- }
2201
- function Wo(e) {
2202
- const {
2203
- width: r,
2204
- height: t
2205
- } = Cn(e);
2206
- return {
2207
- width: r,
2208
- height: t
2209
- };
2210
- }
2211
- function Uo(e, r, t) {
2212
- const n = Oe(r), s = ke(r), o = t === "fixed", i = Ze(e, !0, o, r);
2213
- let a = {
2214
- scrollLeft: 0,
2215
- scrollTop: 0
2216
- };
2217
- const c = ze(0);
2218
- if (n || !n && !o)
2219
- if ((pt(r) !== "body" || St(s)) && (a = Ht(r)), n) {
2220
- const d = Ze(r, !0, o, r);
2221
- c.x = d.x + r.clientLeft, c.y = d.y + r.clientTop;
2222
- } else s && (c.x = Rn(s));
2223
- const u = i.left + a.scrollLeft - c.x, p = i.top + a.scrollTop - c.y;
2224
- return {
2225
- x: u,
2226
- y: p,
2227
- width: i.width,
2228
- height: i.height
2229
- };
2230
- }
2231
- function or(e) {
2232
- return Ce(e).position === "static";
2233
- }
2234
- function Gr(e, r) {
2235
- return !Oe(e) || Ce(e).position === "fixed" ? null : r ? r(e) : e.offsetParent;
2236
- }
2237
- function On(e, r) {
2238
- const t = ye(e);
2239
- if (Pr(e))
2240
- return t;
2241
- if (!Oe(e)) {
2242
- let s = Ke(e);
2243
- for (; s && !ut(s); ) {
2244
- if (Pe(s) && !or(s))
2245
- return s;
2246
- s = Ke(s);
2247
- }
2248
- return t;
2249
- }
2250
- let n = Gr(e, r);
2251
- for (; n && Fo(n) && or(n); )
2252
- n = Gr(n, r);
2253
- return n && ut(n) && or(n) && !Cr(n) ? t : n || To(e) || t;
2254
- }
2255
- const $o = async function(e) {
2256
- const r = this.getOffsetParent || On, t = this.getDimensions, n = await t(e.floating);
2257
- return {
2258
- reference: Uo(e.reference, await r(e.floating), e.strategy),
2259
- floating: {
2260
- x: 0,
2261
- y: 0,
2262
- width: n.width,
2263
- height: n.height
2264
- }
2265
- };
2266
- };
2267
- function zo(e) {
2268
- return Ce(e).direction === "rtl";
2269
- }
2270
- const Ko = {
2271
- convertOffsetParentRelativeRectToViewportRelativeRect: Io,
2272
- getDocumentElement: ke,
2273
- getClippingRect: Ho,
2274
- getOffsetParent: On,
2275
- getElementRects: $o,
2276
- getClientRects: ko,
2277
- getDimensions: Wo,
2278
- getScale: ct,
2279
- isElement: Pe,
2280
- isRTL: zo
2281
- };
2282
- function qo(e, r) {
2283
- let t = null, n;
2284
- const s = ke(e);
2285
- function o() {
2286
- var a;
2287
- clearTimeout(n), (a = t) == null || a.disconnect(), t = null;
2288
- }
2289
- function i(a, c) {
2290
- a === void 0 && (a = !1), c === void 0 && (c = 1), o();
2291
- const {
2292
- left: u,
2293
- top: p,
2294
- width: d,
2295
- height: x
2296
- } = e.getBoundingClientRect();
2297
- if (a || r(), !d || !x)
2298
- return;
2299
- const w = Ct(p), g = Ct(s.clientWidth - (u + d)), A = Ct(s.clientHeight - (p + x)), E = Ct(u), m = {
2300
- rootMargin: -w + "px " + -g + "px " + -A + "px " + -E + "px",
2301
- threshold: ge(0, $e(1, c)) || 1
2302
- };
2303
- let R = !0;
2304
- function D(y) {
2305
- const S = y[0].intersectionRatio;
2306
- if (S !== c) {
2307
- if (!R)
2308
- return i();
2309
- S ? i(!1, S) : n = setTimeout(() => {
2310
- i(!1, 1e-7);
2311
- }, 1e3);
2312
- }
2313
- R = !1;
2314
- }
2315
- try {
2316
- t = new IntersectionObserver(D, {
2317
- ...m,
2318
- // Handle <iframe>s
2319
- root: s.ownerDocument
2320
- });
2321
- } catch {
2322
- t = new IntersectionObserver(D, m);
2323
- }
2324
- t.observe(e);
2325
- }
2326
- return i(!0), o;
2327
- }
2328
- function Yo(e, r, t, n) {
2329
- n === void 0 && (n = {});
2330
- const {
2331
- ancestorScroll: s = !0,
2332
- ancestorResize: o = !0,
2333
- elementResize: i = typeof ResizeObserver == "function",
2334
- layoutShift: a = typeof IntersectionObserver == "function",
2335
- animationFrame: c = !1
2336
- } = n, u = Rr(e), p = s || o ? [...u ? xt(u) : [], ...xt(r)] : [];
2337
- p.forEach((b) => {
2338
- s && b.addEventListener("scroll", t, {
2339
- passive: !0
2340
- }), o && b.addEventListener("resize", t);
2341
- });
2342
- const d = u && a ? qo(u, t) : null;
2343
- let x = -1, w = null;
2344
- i && (w = new ResizeObserver((b) => {
2345
- let [m] = b;
2346
- m && m.target === u && w && (w.unobserve(r), cancelAnimationFrame(x), x = requestAnimationFrame(() => {
2347
- var R;
2348
- (R = w) == null || R.observe(r);
2349
- })), t();
2350
- }), u && !c && w.observe(u), w.observe(r));
2351
- let g, A = c ? Ze(e) : null;
2352
- c && E();
2353
- function E() {
2354
- const b = Ze(e);
2355
- A && (b.x !== A.x || b.y !== A.y || b.width !== A.width || b.height !== A.height) && t(), A = b, g = requestAnimationFrame(E);
2356
- }
2357
- return t(), () => {
2358
- var b;
2359
- p.forEach((m) => {
2360
- s && m.removeEventListener("scroll", t), o && m.removeEventListener("resize", t);
2361
- }), d == null || d(), (b = w) == null || b.disconnect(), w = null, c && cancelAnimationFrame(g);
2362
- };
2363
- }
2364
- const Go = Eo, Xo = Ro, Zo = Ao, Qo = Oo, Jo = _o, Xr = So, ei = Po, ti = (e, r, t) => {
2365
- const n = /* @__PURE__ */ new Map(), s = {
2366
- platform: Ko,
2367
- ...t
2368
- }, o = {
2369
- ...s.platform,
2370
- _c: n
2371
- };
2372
- return bo(e, r, {
2373
- ...s,
2374
- platform: o
2375
- });
2376
- }, ri = (e) => {
2377
- function r(t) {
2378
- return {}.hasOwnProperty.call(t, "current");
2379
- }
2380
- return {
2381
- name: "arrow",
2382
- options: e,
2383
- fn(t) {
2384
- const {
2385
- element: n,
2386
- padding: s
2387
- } = typeof e == "function" ? e(t) : e;
2388
- return n && r(n) ? n.current != null ? Xr({
2389
- element: n.current,
2390
- padding: s
2391
- }).fn(t) : {} : n ? Xr({
2392
- element: n,
2393
- padding: s
2394
- }).fn(t) : {};
2395
- }
2396
- };
2397
- };
2398
- var Pt = typeof document < "u" ? Os : Fs;
2399
- function Mt(e, r) {
2400
- if (e === r)
2401
- return !0;
2402
- if (typeof e != typeof r)
2403
- return !1;
2404
- if (typeof e == "function" && e.toString() === r.toString())
2405
- return !0;
2406
- let t, n, s;
2407
- if (e && r && typeof e == "object") {
2408
- if (Array.isArray(e)) {
2409
- if (t = e.length, t !== r.length) return !1;
2410
- for (n = t; n-- !== 0; )
2411
- if (!Mt(e[n], r[n]))
2412
- return !1;
2413
- return !0;
2414
- }
2415
- if (s = Object.keys(e), t = s.length, t !== Object.keys(r).length)
2416
- return !1;
2417
- for (n = t; n-- !== 0; )
2418
- if (!{}.hasOwnProperty.call(r, s[n]))
2419
- return !1;
2420
- for (n = t; n-- !== 0; ) {
2421
- const o = s[n];
2422
- if (!(o === "_owner" && e.$$typeof) && !Mt(e[o], r[o]))
2423
- return !1;
2424
- }
2425
- return !0;
2426
- }
2427
- return e !== e && r !== r;
2428
- }
2429
- function Fn(e) {
2430
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
2431
- }
2432
- function Zr(e, r) {
2433
- const t = Fn(e);
2434
- return Math.round(r * t) / t;
2435
- }
2436
- function Qr(e) {
2437
- const r = v.useRef(e);
2438
- return Pt(() => {
2439
- r.current = e;
2440
- }), r;
2441
- }
2442
- function ni(e) {
2443
- e === void 0 && (e = {});
2444
- const {
2445
- placement: r = "bottom",
2446
- strategy: t = "absolute",
2447
- middleware: n = [],
2448
- platform: s,
2449
- elements: {
2450
- reference: o,
2451
- floating: i
2452
- } = {},
2453
- transform: a = !0,
2454
- whileElementsMounted: c,
2455
- open: u
2456
- } = e, [p, d] = v.useState({
2457
- x: 0,
2458
- y: 0,
2459
- strategy: t,
2460
- placement: r,
2461
- middlewareData: {},
2462
- isPositioned: !1
2463
- }), [x, w] = v.useState(n);
2464
- Mt(x, n) || w(n);
2465
- const [g, A] = v.useState(null), [E, b] = v.useState(null), m = v.useCallback((L) => {
2466
- L !== S.current && (S.current = L, A(L));
2467
- }, []), R = v.useCallback((L) => {
2468
- L !== F.current && (F.current = L, b(L));
2469
- }, []), D = o || g, y = i || E, S = v.useRef(null), F = v.useRef(null), N = v.useRef(p), $ = c != null, U = Qr(c), J = Qr(s), V = v.useCallback(() => {
2470
- if (!S.current || !F.current)
2471
- return;
2472
- const L = {
2473
- placement: r,
2474
- strategy: t,
2475
- middleware: x
2476
- };
2477
- J.current && (L.platform = J.current), ti(S.current, F.current, L).then((Z) => {
2478
- const ee = {
2479
- ...Z,
2480
- isPositioned: !0
2481
- };
2482
- k.current && !Mt(N.current, ee) && (N.current = ee, gr.flushSync(() => {
2483
- d(ee);
2484
- }));
2485
- });
2486
- }, [x, r, t, J]);
2487
- Pt(() => {
2488
- u === !1 && N.current.isPositioned && (N.current.isPositioned = !1, d((L) => ({
2489
- ...L,
2490
- isPositioned: !1
2491
- })));
2492
- }, [u]);
2493
- const k = v.useRef(!1);
2494
- Pt(() => (k.current = !0, () => {
2495
- k.current = !1;
2496
- }), []), Pt(() => {
2497
- if (D && (S.current = D), y && (F.current = y), D && y) {
2498
- if (U.current)
2499
- return U.current(D, y, V);
2500
- V();
2501
- }
2502
- }, [D, y, V, U, $]);
2503
- const j = v.useMemo(() => ({
2504
- reference: S,
2505
- floating: F,
2506
- setReference: m,
2507
- setFloating: R
2508
- }), [m, R]), M = v.useMemo(() => ({
2509
- reference: D,
2510
- floating: y
2511
- }), [D, y]), W = v.useMemo(() => {
2512
- const L = {
2513
- position: t,
2514
- left: 0,
2515
- top: 0
2516
- };
2517
- if (!M.floating)
2518
- return L;
2519
- const Z = Zr(M.floating, p.x), ee = Zr(M.floating, p.y);
2520
- return a ? {
2521
- ...L,
2522
- transform: "translate(" + Z + "px, " + ee + "px)",
2523
- ...Fn(M.floating) >= 1.5 && {
2524
- willChange: "transform"
2525
- }
2526
- } : {
2527
- position: t,
2528
- left: Z,
2529
- top: ee
2530
- };
2531
- }, [t, a, M.floating, p.x, p.y]);
2532
- return v.useMemo(() => ({
2533
- ...p,
2534
- update: V,
2535
- refs: j,
2536
- elements: M,
2537
- floatingStyles: W
2538
- }), [p, V, j, M, W]);
2539
- }
2540
- var si = "Arrow", Tn = v.forwardRef((e, r) => {
2541
- const { children: t, width: n = 10, height: s = 5, ...o } = e;
2542
- return /* @__PURE__ */ P.jsx(
2543
- ue.svg,
2544
- {
2545
- ...o,
2546
- ref: r,
2547
- width: n,
2548
- height: s,
2549
- viewBox: "0 0 30 10",
2550
- preserveAspectRatio: "none",
2551
- children: e.asChild ? t : /* @__PURE__ */ P.jsx("polygon", { points: "0,0 30,0 15,10" })
2552
- }
2553
- );
2554
- });
2555
- Tn.displayName = si;
2556
- var oi = Tn;
2557
- function ii(e) {
2558
- const [r, t] = v.useState(void 0);
2559
- return _e(() => {
2560
- if (e) {
2561
- t({ width: e.offsetWidth, height: e.offsetHeight });
2562
- const n = new ResizeObserver((s) => {
2563
- if (!Array.isArray(s) || !s.length)
2564
- return;
2565
- const o = s[0];
2566
- let i, a;
2567
- if ("borderBoxSize" in o) {
2568
- const c = o.borderBoxSize, u = Array.isArray(c) ? c[0] : c;
2569
- i = u.inlineSize, a = u.blockSize;
2570
- } else
2571
- i = e.offsetWidth, a = e.offsetHeight;
2572
- t({ width: i, height: a });
2573
- });
2574
- return n.observe(e, { box: "border-box" }), () => n.unobserve(e);
2575
- } else
2576
- t(void 0);
2577
- }, [e]), r;
2578
- }
2579
- var Or = "Popper", [Vn, Dn] = tn(Or), [ai, Nn] = Vn(Or), In = (e) => {
2580
- const { __scopePopper: r, children: t } = e, [n, s] = v.useState(null);
2581
- return /* @__PURE__ */ P.jsx(ai, { scope: r, anchor: n, onAnchorChange: s, children: t });
2582
- };
2583
- In.displayName = Or;
2584
- var kn = "PopperAnchor", Mn = v.forwardRef(
2585
- (e, r) => {
2586
- const { __scopePopper: t, virtualRef: n, ...s } = e, o = Nn(kn, t), i = v.useRef(null), a = we(r, i);
2587
- return v.useEffect(() => {
2588
- o.onAnchorChange((n == null ? void 0 : n.current) || i.current);
2589
- }), n ? null : /* @__PURE__ */ P.jsx(ue.div, { ...s, ref: a });
2590
- }
2591
- );
2592
- Mn.displayName = kn;
2593
- var Fr = "PopperContent", [li, ci] = Vn(Fr), Ln = v.forwardRef(
2594
- (e, r) => {
2595
- var B, Y, se, G, z, K;
2596
- const {
2597
- __scopePopper: t,
2598
- side: n = "bottom",
2599
- sideOffset: s = 0,
2600
- align: o = "center",
2601
- alignOffset: i = 0,
2602
- arrowPadding: a = 0,
2603
- avoidCollisions: c = !0,
2604
- collisionBoundary: u = [],
2605
- collisionPadding: p = 0,
2606
- sticky: d = "partial",
2607
- hideWhenDetached: x = !1,
2608
- updatePositionStrategy: w = "optimized",
2609
- onPlaced: g,
2610
- ...A
2611
- } = e, E = Nn(Fr, t), [b, m] = v.useState(null), R = we(r, (ae) => m(ae)), [D, y] = v.useState(null), S = ii(D), F = (S == null ? void 0 : S.width) ?? 0, N = (S == null ? void 0 : S.height) ?? 0, $ = n + (o !== "center" ? "-" + o : ""), U = typeof p == "number" ? p : { top: 0, right: 0, bottom: 0, left: 0, ...p }, J = Array.isArray(u) ? u : [u], V = J.length > 0, k = {
2612
- padding: U,
2613
- boundary: J.filter(fi),
2614
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
2615
- altBoundary: V
2616
- }, { refs: j, floatingStyles: M, placement: W, isPositioned: L, middlewareData: Z } = ni({
2617
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
2618
- strategy: "fixed",
2619
- placement: $,
2620
- whileElementsMounted: (...ae) => Yo(...ae, {
2621
- animationFrame: w === "always"
2622
- }),
2623
- elements: {
2624
- reference: E.anchor
2625
- },
2626
- middleware: [
2627
- Go({ mainAxis: s + N, alignmentAxis: i }),
2628
- c && Xo({
2629
- mainAxis: !0,
2630
- crossAxis: !1,
2631
- limiter: d === "partial" ? ei() : void 0,
2632
- ...k
2633
- }),
2634
- c && Zo({ ...k }),
2635
- Qo({
2636
- ...k,
2637
- apply: ({ elements: ae, rects: he, availableWidth: Je, availableHeight: et }) => {
2638
- const { width: tt, height: l } = he.reference, f = ae.floating.style;
2639
- f.setProperty("--radix-popper-available-width", `${Je}px`), f.setProperty("--radix-popper-available-height", `${et}px`), f.setProperty("--radix-popper-anchor-width", `${tt}px`), f.setProperty("--radix-popper-anchor-height", `${l}px`);
2640
- }
2641
- }),
2642
- D && ri({ element: D, padding: a }),
2643
- di({ arrowWidth: F, arrowHeight: N }),
2644
- x && Jo({ strategy: "referenceHidden", ...k })
2645
- ]
2646
- }), [ee, be] = Hn(W), ve = rn(g);
2647
- _e(() => {
2648
- L && (ve == null || ve());
2649
- }, [L, ve]);
2650
- const Me = (B = Z.arrow) == null ? void 0 : B.x, Ge = (Y = Z.arrow) == null ? void 0 : Y.y, Se = ((se = Z.arrow) == null ? void 0 : se.centerOffset) !== 0, [Le, Ae] = v.useState();
2651
- return _e(() => {
2652
- b && Ae(window.getComputedStyle(b).zIndex);
2653
- }, [b]), /* @__PURE__ */ P.jsx(
2654
- "div",
2655
- {
2656
- ref: j.setFloating,
2657
- "data-radix-popper-content-wrapper": "",
2658
- style: {
2659
- ...M,
2660
- transform: L ? M.transform : "translate(0, -200%)",
2661
- // keep off the page when measuring
2662
- minWidth: "max-content",
2663
- zIndex: Le,
2664
- "--radix-popper-transform-origin": [
2665
- (G = Z.transformOrigin) == null ? void 0 : G.x,
2666
- (z = Z.transformOrigin) == null ? void 0 : z.y
2667
- ].join(" "),
2668
- // hide the content if using the hide middleware and should be hidden
2669
- // set visibility to hidden and disable pointer events so the UI behaves
2670
- // as if the PopperContent isn't there at all
2671
- ...((K = Z.hide) == null ? void 0 : K.referenceHidden) && {
2672
- visibility: "hidden",
2673
- pointerEvents: "none"
2674
- }
2675
- },
2676
- dir: e.dir,
2677
- children: /* @__PURE__ */ P.jsx(
2678
- li,
2679
- {
2680
- scope: t,
2681
- placedSide: ee,
2682
- onArrowChange: y,
2683
- arrowX: Me,
2684
- arrowY: Ge,
2685
- shouldHideArrow: Se,
2686
- children: /* @__PURE__ */ P.jsx(
2687
- ue.div,
2688
- {
2689
- "data-side": ee,
2690
- "data-align": be,
2691
- ...A,
2692
- ref: R,
2693
- style: {
2694
- ...A.style,
2695
- // if the PopperContent hasn't been placed yet (not all measurements done)
2696
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
2697
- animation: L ? void 0 : "none"
2698
- }
2699
- }
2700
- )
2701
- }
2702
- )
2703
- }
2704
- );
2705
- }
2706
- );
2707
- Ln.displayName = Fr;
2708
- var jn = "PopperArrow", ui = {
2709
- top: "bottom",
2710
- right: "left",
2711
- bottom: "top",
2712
- left: "right"
2713
- }, Bn = v.forwardRef(function(r, t) {
2714
- const { __scopePopper: n, ...s } = r, o = ci(jn, n), i = ui[o.placedSide];
2715
- return (
2716
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
2717
- // doesn't report size as we'd expect on SVG elements.
2718
- // it reports their bounding box which is effectively the largest path inside the SVG.
2719
- /* @__PURE__ */ P.jsx(
2720
- "span",
2721
- {
2722
- ref: o.onArrowChange,
2723
- style: {
2724
- position: "absolute",
2725
- left: o.arrowX,
2726
- top: o.arrowY,
2727
- [i]: 0,
2728
- transformOrigin: {
2729
- top: "",
2730
- right: "0 0",
2731
- bottom: "center 0",
2732
- left: "100% 0"
2733
- }[o.placedSide],
2734
- transform: {
2735
- top: "translateY(100%)",
2736
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
2737
- bottom: "rotate(180deg)",
2738
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
2739
- }[o.placedSide],
2740
- visibility: o.shouldHideArrow ? "hidden" : void 0
2741
- },
2742
- children: /* @__PURE__ */ P.jsx(
2743
- oi,
2744
- {
2745
- ...s,
2746
- ref: t,
2747
- style: {
2748
- ...s.style,
2749
- // ensures the element can be measured correctly (mostly for if SVG)
2750
- display: "block"
2751
- }
2752
- }
2753
- )
2754
- }
2755
- )
2756
- );
2757
- });
2758
- Bn.displayName = jn;
2759
- function fi(e) {
2760
- return e !== null;
2761
- }
2762
- var di = (e) => ({
2763
- name: "transformOrigin",
2764
- options: e,
2765
- fn(r) {
2766
- var E, b, m;
2767
- const { placement: t, rects: n, middlewareData: s } = r, i = ((E = s.arrow) == null ? void 0 : E.centerOffset) !== 0, a = i ? 0 : e.arrowWidth, c = i ? 0 : e.arrowHeight, [u, p] = Hn(t), d = { start: "0%", center: "50%", end: "100%" }[p], x = (((b = s.arrow) == null ? void 0 : b.x) ?? 0) + a / 2, w = (((m = s.arrow) == null ? void 0 : m.y) ?? 0) + c / 2;
2768
- let g = "", A = "";
2769
- return u === "bottom" ? (g = i ? d : `${x}px`, A = `${-c}px`) : u === "top" ? (g = i ? d : `${x}px`, A = `${n.floating.height + c}px`) : u === "right" ? (g = `${-c}px`, A = i ? d : `${w}px`) : u === "left" && (g = `${n.floating.width + c}px`, A = i ? d : `${w}px`), { data: { x: g, y: A } };
2770
- }
2771
- });
2772
- function Hn(e) {
2773
- const [r, t = "center"] = e.split("-");
2774
- return [r, t];
2775
- }
2776
- var pi = In, hi = Mn, mi = Ln, gi = Bn;
2777
- function yi(e) {
2778
- const r = v.useRef({ value: e, previous: e });
2779
- return v.useMemo(() => (r.current.value !== e && (r.current.previous = r.current.value, r.current.value = e), r.current.previous), [e]);
2780
- }
2781
- var vi = [" ", "Enter", "ArrowUp", "ArrowDown"], xi = [" ", "Enter"], At = "Select", [Wt, Ut, wi] = Ls(At), [ht, la] = tn(At, [
2782
- wi,
2783
- Dn
2784
- ]), $t = Dn(), [bi, qe] = ht(At), [Si, Ai] = ht(At), Wn = (e) => {
2785
- const {
2786
- __scopeSelect: r,
2787
- children: t,
2788
- open: n,
2789
- defaultOpen: s,
2790
- onOpenChange: o,
2791
- value: i,
2792
- defaultValue: a,
2793
- onValueChange: c,
2794
- dir: u,
2795
- name: p,
2796
- autoComplete: d,
2797
- disabled: x,
2798
- required: w
2799
- } = e, g = $t(r), [A, E] = v.useState(null), [b, m] = v.useState(null), [R, D] = v.useState(!1), y = Ks(u), [S = !1, F] = kr({
2800
- prop: n,
2801
- defaultProp: s,
2802
- onChange: o
2803
- }), [N, $] = kr({
2804
- prop: i,
2805
- defaultProp: a,
2806
- onChange: c
2807
- }), U = v.useRef(null), J = A ? !!A.closest("form") : !0, [V, k] = v.useState(/* @__PURE__ */ new Set()), j = Array.from(V).map((M) => M.props.value).join(";");
2808
- return /* @__PURE__ */ P.jsx(pi, { ...g, children: /* @__PURE__ */ P.jsxs(
2809
- bi,
2810
- {
2811
- required: w,
2812
- scope: r,
2813
- trigger: A,
2814
- onTriggerChange: E,
2815
- valueNode: b,
2816
- onValueNodeChange: m,
2817
- valueNodeHasChildren: R,
2818
- onValueNodeHasChildrenChange: D,
2819
- contentId: yr(),
2820
- value: N,
2821
- onValueChange: $,
2822
- open: S,
2823
- onOpenChange: F,
2824
- dir: y,
2825
- triggerPointerDownPosRef: U,
2826
- disabled: x,
2827
- children: [
2828
- /* @__PURE__ */ P.jsx(Wt.Provider, { scope: r, children: /* @__PURE__ */ P.jsx(
2829
- Si,
2830
- {
2831
- scope: e.__scopeSelect,
2832
- onNativeOptionAdd: v.useCallback((M) => {
2833
- k((W) => new Set(W).add(M));
2834
- }, []),
2835
- onNativeOptionRemove: v.useCallback((M) => {
2836
- k((W) => {
2837
- const L = new Set(W);
2838
- return L.delete(M), L;
2839
- });
2840
- }, []),
2841
- children: t
2842
- }
2843
- ) }),
2844
- J ? /* @__PURE__ */ P.jsxs(
2845
- hs,
2846
- {
2847
- "aria-hidden": !0,
2848
- required: w,
2849
- tabIndex: -1,
2850
- name: p,
2851
- autoComplete: d,
2852
- value: N,
2853
- onChange: (M) => $(M.target.value),
2854
- disabled: x,
2855
- children: [
2856
- N === void 0 ? /* @__PURE__ */ P.jsx("option", { value: "" }) : null,
2857
- Array.from(V)
2858
- ]
2859
- },
2860
- j
2861
- ) : null
2862
- ]
2863
- }
2864
- ) });
2865
- };
2866
- Wn.displayName = At;
2867
- var Un = "SelectTrigger", $n = v.forwardRef(
2868
- (e, r) => {
2869
- const { __scopeSelect: t, disabled: n = !1, ...s } = e, o = $t(t), i = qe(Un, t), a = i.disabled || n, c = we(r, i.onTriggerChange), u = Ut(t), [p, d, x] = ms((g) => {
2870
- const A = u().filter((m) => !m.disabled), E = A.find((m) => m.value === i.value), b = gs(A, g, E);
2871
- b !== void 0 && i.onValueChange(b.value);
2872
- }), w = () => {
2873
- a || (i.onOpenChange(!0), x());
2874
- };
2875
- return /* @__PURE__ */ P.jsx(hi, { asChild: !0, ...o, children: /* @__PURE__ */ P.jsx(
2876
- ue.button,
2877
- {
2878
- type: "button",
2879
- role: "combobox",
2880
- "aria-controls": i.contentId,
2881
- "aria-expanded": i.open,
2882
- "aria-required": i.required,
2883
- "aria-autocomplete": "none",
2884
- dir: i.dir,
2885
- "data-state": i.open ? "open" : "closed",
2886
- disabled: a,
2887
- "data-disabled": a ? "" : void 0,
2888
- "data-placeholder": ps(i.value) ? "" : void 0,
2889
- ...s,
2890
- ref: c,
2891
- onClick: ce(s.onClick, (g) => {
2892
- g.currentTarget.focus();
2893
- }),
2894
- onPointerDown: ce(s.onPointerDown, (g) => {
2895
- const A = g.target;
2896
- A.hasPointerCapture(g.pointerId) && A.releasePointerCapture(g.pointerId), g.button === 0 && g.ctrlKey === !1 && (w(), i.triggerPointerDownPosRef.current = {
2897
- x: Math.round(g.pageX),
2898
- y: Math.round(g.pageY)
2899
- }, g.preventDefault());
2900
- }),
2901
- onKeyDown: ce(s.onKeyDown, (g) => {
2902
- const A = p.current !== "";
2903
- !(g.ctrlKey || g.altKey || g.metaKey) && g.key.length === 1 && d(g.key), !(A && g.key === " ") && vi.includes(g.key) && (w(), g.preventDefault());
2904
- })
2905
- }
2906
- ) });
2907
- }
2908
- );
2909
- $n.displayName = Un;
2910
- var zn = "SelectValue", Kn = v.forwardRef(
2911
- (e, r) => {
2912
- const { __scopeSelect: t, className: n, style: s, children: o, placeholder: i = "", ...a } = e, c = qe(zn, t), { onValueNodeHasChildrenChange: u } = c, p = o !== void 0, d = we(r, c.onValueNodeChange);
2913
- return _e(() => {
2914
- u(p);
2915
- }, [u, p]), /* @__PURE__ */ P.jsx(
2916
- ue.span,
2917
- {
2918
- ...a,
2919
- ref: d,
2920
- style: { pointerEvents: "none" },
2921
- children: ps(c.value) ? /* @__PURE__ */ P.jsx(P.Fragment, { children: i }) : o
2922
- }
2923
- );
2924
- }
2925
- );
2926
- Kn.displayName = zn;
2927
- var _i = "SelectIcon", qn = v.forwardRef(
2928
- (e, r) => {
2929
- const { __scopeSelect: t, children: n, ...s } = e;
2930
- return /* @__PURE__ */ P.jsx(ue.span, { "aria-hidden": !0, ...s, ref: r, children: n || "▼" });
2931
- }
2932
- );
2933
- qn.displayName = _i;
2934
- var Ci = "SelectPortal", Yn = (e) => /* @__PURE__ */ P.jsx(zs, { asChild: !0, ...e });
2935
- Yn.displayName = Ci;
2936
- var Qe = "SelectContent", Gn = v.forwardRef(
2937
- (e, r) => {
2938
- const t = qe(Qe, e.__scopeSelect), [n, s] = v.useState();
2939
- if (_e(() => {
2940
- s(new DocumentFragment());
2941
- }, []), !t.open) {
2942
- const o = n;
2943
- return o ? gr.createPortal(
2944
- /* @__PURE__ */ P.jsx(Xn, { scope: e.__scopeSelect, children: /* @__PURE__ */ P.jsx(Wt.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ P.jsx("div", { children: e.children }) }) }),
2945
- o
2946
- ) : null;
2947
- }
2948
- return /* @__PURE__ */ P.jsx(Zn, { ...e, ref: r });
2949
- }
2950
- );
2951
- Gn.displayName = Qe;
2952
- var Te = 10, [Xn, Ye] = ht(Qe), Ei = "SelectContentImpl", Zn = v.forwardRef(
2953
- (e, r) => {
2954
- const {
2955
- __scopeSelect: t,
2956
- position: n = "item-aligned",
2957
- onCloseAutoFocus: s,
2958
- onEscapeKeyDown: o,
2959
- onPointerDownOutside: i,
2960
- //
2961
- // PopperContent props
2962
- side: a,
2963
- sideOffset: c,
2964
- align: u,
2965
- alignOffset: p,
2966
- arrowPadding: d,
2967
- collisionBoundary: x,
2968
- collisionPadding: w,
2969
- sticky: g,
2970
- hideWhenDetached: A,
2971
- avoidCollisions: E,
2972
- //
2973
- ...b
2974
- } = e, m = qe(Qe, t), [R, D] = v.useState(null), [y, S] = v.useState(null), F = we(r, (B) => D(B)), [N, $] = v.useState(null), [U, J] = v.useState(
2975
- null
2976
- ), V = Ut(t), [k, j] = v.useState(!1), M = v.useRef(!1);
2977
- v.useEffect(() => {
2978
- if (R) return js(R);
2979
- }, [R]), Bs();
2980
- const W = v.useCallback(
2981
- (B) => {
2982
- const [Y, ...se] = V().map((K) => K.ref.current), [G] = se.slice(-1), z = document.activeElement;
2983
- for (const K of B)
2984
- if (K === z || (K == null || K.scrollIntoView({ block: "nearest" }), K === Y && y && (y.scrollTop = 0), K === G && y && (y.scrollTop = y.scrollHeight), K == null || K.focus(), document.activeElement !== z)) return;
2985
- },
2986
- [V, y]
2987
- ), L = v.useCallback(
2988
- () => W([N, R]),
2989
- [W, N, R]
2990
- );
2991
- v.useEffect(() => {
2992
- k && L();
2993
- }, [k, L]);
2994
- const { onOpenChange: Z, triggerPointerDownPosRef: ee } = m;
2995
- v.useEffect(() => {
2996
- if (R) {
2997
- let B = { x: 0, y: 0 };
2998
- const Y = (G) => {
2999
- var z, K;
3000
- B = {
3001
- x: Math.abs(Math.round(G.pageX) - (((z = ee.current) == null ? void 0 : z.x) ?? 0)),
3002
- y: Math.abs(Math.round(G.pageY) - (((K = ee.current) == null ? void 0 : K.y) ?? 0))
3003
- };
3004
- }, se = (G) => {
3005
- B.x <= 10 && B.y <= 10 ? G.preventDefault() : R.contains(G.target) || Z(!1), document.removeEventListener("pointermove", Y), ee.current = null;
3006
- };
3007
- return ee.current !== null && (document.addEventListener("pointermove", Y), document.addEventListener("pointerup", se, { capture: !0, once: !0 })), () => {
3008
- document.removeEventListener("pointermove", Y), document.removeEventListener("pointerup", se, { capture: !0 });
3009
- };
3010
- }
3011
- }, [R, Z, ee]), v.useEffect(() => {
3012
- const B = () => Z(!1);
3013
- return window.addEventListener("blur", B), window.addEventListener("resize", B), () => {
3014
- window.removeEventListener("blur", B), window.removeEventListener("resize", B);
3015
- };
3016
- }, [Z]);
3017
- const [be, ve] = ms((B) => {
3018
- const Y = V().filter((z) => !z.disabled), se = Y.find((z) => z.ref.current === document.activeElement), G = gs(Y, B, se);
3019
- G && setTimeout(() => G.ref.current.focus());
3020
- }), Me = v.useCallback(
3021
- (B, Y, se) => {
3022
- const G = !M.current && !se;
3023
- (m.value !== void 0 && m.value === Y || G) && ($(B), G && (M.current = !0));
3024
- },
3025
- [m.value]
3026
- ), Ge = v.useCallback(() => R == null ? void 0 : R.focus(), [R]), Se = v.useCallback(
3027
- (B, Y, se) => {
3028
- const G = !M.current && !se;
3029
- (m.value !== void 0 && m.value === Y || G) && J(B);
3030
- },
3031
- [m.value]
3032
- ), Le = n === "popper" ? fr : Qn, Ae = Le === fr ? {
3033
- side: a,
3034
- sideOffset: c,
3035
- align: u,
3036
- alignOffset: p,
3037
- arrowPadding: d,
3038
- collisionBoundary: x,
3039
- collisionPadding: w,
3040
- sticky: g,
3041
- hideWhenDetached: A,
3042
- avoidCollisions: E
3043
- } : {};
3044
- return /* @__PURE__ */ P.jsx(
3045
- Xn,
3046
- {
3047
- scope: t,
3048
- content: R,
3049
- viewport: y,
3050
- onViewportChange: S,
3051
- itemRefCallback: Me,
3052
- selectedItem: N,
3053
- onItemLeave: Ge,
3054
- itemTextRefCallback: Se,
3055
- focusSelectedItem: L,
3056
- selectedItemText: U,
3057
- position: n,
3058
- isPositioned: k,
3059
- searchRef: be,
3060
- children: /* @__PURE__ */ P.jsx(Hs, { as: Ms, allowPinchZoom: !0, children: /* @__PURE__ */ P.jsx(
3061
- Ws,
3062
- {
3063
- asChild: !0,
3064
- trapped: m.open,
3065
- onMountAutoFocus: (B) => {
3066
- B.preventDefault();
3067
- },
3068
- onUnmountAutoFocus: ce(s, (B) => {
3069
- var Y;
3070
- (Y = m.trigger) == null || Y.focus({ preventScroll: !0 }), B.preventDefault();
3071
- }),
3072
- children: /* @__PURE__ */ P.jsx(
3073
- Us,
3074
- {
3075
- asChild: !0,
3076
- disableOutsidePointerEvents: !0,
3077
- onEscapeKeyDown: o,
3078
- onPointerDownOutside: i,
3079
- onFocusOutside: (B) => B.preventDefault(),
3080
- onDismiss: () => m.onOpenChange(!1),
3081
- children: /* @__PURE__ */ P.jsx(
3082
- Le,
3083
- {
3084
- role: "listbox",
3085
- id: m.contentId,
3086
- "data-state": m.open ? "open" : "closed",
3087
- dir: m.dir,
3088
- onContextMenu: (B) => B.preventDefault(),
3089
- ...b,
3090
- ...Ae,
3091
- onPlaced: () => j(!0),
3092
- ref: F,
3093
- style: {
3094
- // flex layout so we can place the scroll buttons properly
3095
- display: "flex",
3096
- flexDirection: "column",
3097
- // reset the outline by default as the content MAY get focused
3098
- outline: "none",
3099
- ...b.style
3100
- },
3101
- onKeyDown: ce(b.onKeyDown, (B) => {
3102
- const Y = B.ctrlKey || B.altKey || B.metaKey;
3103
- if (B.key === "Tab" && B.preventDefault(), !Y && B.key.length === 1 && ve(B.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(B.key)) {
3104
- let G = V().filter((z) => !z.disabled).map((z) => z.ref.current);
3105
- if (["ArrowUp", "End"].includes(B.key) && (G = G.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(B.key)) {
3106
- const z = B.target, K = G.indexOf(z);
3107
- G = G.slice(K + 1);
3108
- }
3109
- setTimeout(() => W(G)), B.preventDefault();
3110
- }
3111
- })
3112
- }
3113
- )
3114
- }
3115
- )
3116
- }
3117
- ) })
3118
- }
3119
- );
3120
- }
3121
- );
3122
- Zn.displayName = Ei;
3123
- var Ri = "SelectItemAlignedPosition", Qn = v.forwardRef((e, r) => {
3124
- const { __scopeSelect: t, onPlaced: n, ...s } = e, o = qe(Qe, t), i = Ye(Qe, t), [a, c] = v.useState(null), [u, p] = v.useState(null), d = we(r, (F) => p(F)), x = Ut(t), w = v.useRef(!1), g = v.useRef(!0), { viewport: A, selectedItem: E, selectedItemText: b, focusSelectedItem: m } = i, R = v.useCallback(() => {
3125
- if (o.trigger && o.valueNode && a && u && A && E && b) {
3126
- const F = o.trigger.getBoundingClientRect(), N = u.getBoundingClientRect(), $ = o.valueNode.getBoundingClientRect(), U = b.getBoundingClientRect();
3127
- if (o.dir !== "rtl") {
3128
- const z = U.left - N.left, K = $.left - z, ae = F.left - K, he = F.width + ae, Je = Math.max(he, N.width), et = window.innerWidth - Te, tt = Ur(K, [Te, et - Je]);
3129
- a.style.minWidth = he + "px", a.style.left = tt + "px";
3130
- } else {
3131
- const z = N.right - U.right, K = window.innerWidth - $.right - z, ae = window.innerWidth - F.right - K, he = F.width + ae, Je = Math.max(he, N.width), et = window.innerWidth - Te, tt = Ur(K, [Te, et - Je]);
3132
- a.style.minWidth = he + "px", a.style.right = tt + "px";
3133
- }
3134
- const J = x(), V = window.innerHeight - Te * 2, k = A.scrollHeight, j = window.getComputedStyle(u), M = parseInt(j.borderTopWidth, 10), W = parseInt(j.paddingTop, 10), L = parseInt(j.borderBottomWidth, 10), Z = parseInt(j.paddingBottom, 10), ee = M + W + k + Z + L, be = Math.min(E.offsetHeight * 5, ee), ve = window.getComputedStyle(A), Me = parseInt(ve.paddingTop, 10), Ge = parseInt(ve.paddingBottom, 10), Se = F.top + F.height / 2 - Te, Le = V - Se, Ae = E.offsetHeight / 2, B = E.offsetTop + Ae, Y = M + W + B, se = ee - Y;
3135
- if (Y <= Se) {
3136
- const z = E === J[J.length - 1].ref.current;
3137
- a.style.bottom = "0px";
3138
- const K = u.clientHeight - A.offsetTop - A.offsetHeight, ae = Math.max(
3139
- Le,
3140
- Ae + // viewport might have padding bottom, include it to avoid a scrollable viewport
3141
- (z ? Ge : 0) + K + L
3142
- ), he = Y + ae;
3143
- a.style.height = he + "px";
3144
- } else {
3145
- const z = E === J[0].ref.current;
3146
- a.style.top = "0px";
3147
- const ae = Math.max(
3148
- Se,
3149
- M + A.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
3150
- (z ? Me : 0) + Ae
3151
- ) + se;
3152
- a.style.height = ae + "px", A.scrollTop = Y - Se + A.offsetTop;
3153
- }
3154
- a.style.margin = `${Te}px 0`, a.style.minHeight = be + "px", a.style.maxHeight = V + "px", n == null || n(), requestAnimationFrame(() => w.current = !0);
3155
- }
3156
- }, [
3157
- x,
3158
- o.trigger,
3159
- o.valueNode,
3160
- a,
3161
- u,
3162
- A,
3163
- E,
3164
- b,
3165
- o.dir,
3166
- n
3167
- ]);
3168
- _e(() => R(), [R]);
3169
- const [D, y] = v.useState();
3170
- _e(() => {
3171
- u && y(window.getComputedStyle(u).zIndex);
3172
- }, [u]);
3173
- const S = v.useCallback(
3174
- (F) => {
3175
- F && g.current === !0 && (R(), m == null || m(), g.current = !1);
3176
- },
3177
- [R, m]
3178
- );
3179
- return /* @__PURE__ */ P.jsx(
3180
- Oi,
3181
- {
3182
- scope: t,
3183
- contentWrapper: a,
3184
- shouldExpandOnScrollRef: w,
3185
- onScrollButtonChange: S,
3186
- children: /* @__PURE__ */ P.jsx(
3187
- "div",
3188
- {
3189
- ref: c,
3190
- style: {
3191
- display: "flex",
3192
- flexDirection: "column",
3193
- position: "fixed",
3194
- zIndex: D
3195
- },
3196
- children: /* @__PURE__ */ P.jsx(
3197
- ue.div,
3198
- {
3199
- ...s,
3200
- ref: d,
3201
- style: {
3202
- // When we get the height of the content, it includes borders. If we were to set
3203
- // the height without having `boxSizing: 'border-box'` it would be too big.
3204
- boxSizing: "border-box",
3205
- // We need to ensure the content doesn't get taller than the wrapper
3206
- maxHeight: "100%",
3207
- ...s.style
3208
- }
3209
- }
3210
- )
3211
- }
3212
- )
3213
- }
3214
- );
3215
- });
3216
- Qn.displayName = Ri;
3217
- var Pi = "SelectPopperPosition", fr = v.forwardRef((e, r) => {
3218
- const {
3219
- __scopeSelect: t,
3220
- align: n = "start",
3221
- collisionPadding: s = Te,
3222
- ...o
3223
- } = e, i = $t(t);
3224
- return /* @__PURE__ */ P.jsx(
3225
- mi,
3226
- {
3227
- ...i,
3228
- ...o,
3229
- ref: r,
3230
- align: n,
3231
- collisionPadding: s,
3232
- style: {
3233
- // Ensure border-box for floating-ui calculations
3234
- boxSizing: "border-box",
3235
- ...o.style,
3236
- "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
3237
- "--radix-select-content-available-width": "var(--radix-popper-available-width)",
3238
- "--radix-select-content-available-height": "var(--radix-popper-available-height)",
3239
- "--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
3240
- "--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
3241
- }
3242
- }
3243
- );
3244
- });
3245
- fr.displayName = Pi;
3246
- var [Oi, Tr] = ht(Qe, {}), dr = "SelectViewport", Jn = v.forwardRef(
3247
- (e, r) => {
3248
- const { __scopeSelect: t, nonce: n, ...s } = e, o = Ye(dr, t), i = Tr(dr, t), a = we(r, o.onViewportChange), c = v.useRef(0);
3249
- return /* @__PURE__ */ P.jsxs(P.Fragment, { children: [
3250
- /* @__PURE__ */ P.jsx(
3251
- "style",
3252
- {
3253
- dangerouslySetInnerHTML: {
3254
- __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
3255
- },
3256
- nonce: n
3257
- }
3258
- ),
3259
- /* @__PURE__ */ P.jsx(Wt.Slot, { scope: t, children: /* @__PURE__ */ P.jsx(
3260
- ue.div,
3261
- {
3262
- "data-radix-select-viewport": "",
3263
- role: "presentation",
3264
- ...s,
3265
- ref: a,
3266
- style: {
3267
- // we use position: 'relative' here on the `viewport` so that when we call
3268
- // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
3269
- // (independent of the scrollUpButton).
3270
- position: "relative",
3271
- flex: 1,
3272
- overflow: "auto",
3273
- ...s.style
3274
- },
3275
- onScroll: ce(s.onScroll, (u) => {
3276
- const p = u.currentTarget, { contentWrapper: d, shouldExpandOnScrollRef: x } = i;
3277
- if (x != null && x.current && d) {
3278
- const w = Math.abs(c.current - p.scrollTop);
3279
- if (w > 0) {
3280
- const g = window.innerHeight - Te * 2, A = parseFloat(d.style.minHeight), E = parseFloat(d.style.height), b = Math.max(A, E);
3281
- if (b < g) {
3282
- const m = b + w, R = Math.min(g, m), D = m - R;
3283
- d.style.height = R + "px", d.style.bottom === "0px" && (p.scrollTop = D > 0 ? D : 0, d.style.justifyContent = "flex-end");
3284
- }
3285
- }
3286
- }
3287
- c.current = p.scrollTop;
3288
- })
3289
- }
3290
- ) })
3291
- ] });
3292
- }
3293
- );
3294
- Jn.displayName = dr;
3295
- var es = "SelectGroup", [Fi, Ti] = ht(es), ts = v.forwardRef(
3296
- (e, r) => {
3297
- const { __scopeSelect: t, ...n } = e, s = yr();
3298
- return /* @__PURE__ */ P.jsx(Fi, { scope: t, id: s, children: /* @__PURE__ */ P.jsx(ue.div, { role: "group", "aria-labelledby": s, ...n, ref: r }) });
3299
- }
3300
- );
3301
- ts.displayName = es;
3302
- var rs = "SelectLabel", ns = v.forwardRef(
3303
- (e, r) => {
3304
- const { __scopeSelect: t, ...n } = e, s = Ti(rs, t);
3305
- return /* @__PURE__ */ P.jsx(ue.div, { id: s.id, ...n, ref: r });
3306
- }
3307
- );
3308
- ns.displayName = rs;
3309
- var Lt = "SelectItem", [Vi, ss] = ht(Lt), os = v.forwardRef(
3310
- (e, r) => {
3311
- const {
3312
- __scopeSelect: t,
3313
- value: n,
3314
- disabled: s = !1,
3315
- textValue: o,
3316
- ...i
3317
- } = e, a = qe(Lt, t), c = Ye(Lt, t), u = a.value === n, [p, d] = v.useState(o ?? ""), [x, w] = v.useState(!1), g = we(
3318
- r,
3319
- (b) => {
3320
- var m;
3321
- return (m = c.itemRefCallback) == null ? void 0 : m.call(c, b, n, s);
3322
- }
3323
- ), A = yr(), E = () => {
3324
- s || (a.onValueChange(n), a.onOpenChange(!1));
3325
- };
3326
- if (n === "")
3327
- throw new Error(
3328
- "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."
3329
- );
3330
- return /* @__PURE__ */ P.jsx(
3331
- Vi,
3332
- {
3333
- scope: t,
3334
- value: n,
3335
- disabled: s,
3336
- textId: A,
3337
- isSelected: u,
3338
- onItemTextChange: v.useCallback((b) => {
3339
- d((m) => m || ((b == null ? void 0 : b.textContent) ?? "").trim());
3340
- }, []),
3341
- children: /* @__PURE__ */ P.jsx(
3342
- Wt.ItemSlot,
3343
- {
3344
- scope: t,
3345
- value: n,
3346
- disabled: s,
3347
- textValue: p,
3348
- children: /* @__PURE__ */ P.jsx(
3349
- ue.div,
3350
- {
3351
- role: "option",
3352
- "aria-labelledby": A,
3353
- "data-highlighted": x ? "" : void 0,
3354
- "aria-selected": u && x,
3355
- "data-state": u ? "checked" : "unchecked",
3356
- "aria-disabled": s || void 0,
3357
- "data-disabled": s ? "" : void 0,
3358
- tabIndex: s ? void 0 : -1,
3359
- ...i,
3360
- ref: g,
3361
- onFocus: ce(i.onFocus, () => w(!0)),
3362
- onBlur: ce(i.onBlur, () => w(!1)),
3363
- onPointerUp: ce(i.onPointerUp, E),
3364
- onPointerMove: ce(i.onPointerMove, (b) => {
3365
- var m;
3366
- s ? (m = c.onItemLeave) == null || m.call(c) : b.currentTarget.focus({ preventScroll: !0 });
3367
- }),
3368
- onPointerLeave: ce(i.onPointerLeave, (b) => {
3369
- var m;
3370
- b.currentTarget === document.activeElement && ((m = c.onItemLeave) == null || m.call(c));
3371
- }),
3372
- onKeyDown: ce(i.onKeyDown, (b) => {
3373
- var R;
3374
- ((R = c.searchRef) == null ? void 0 : R.current) !== "" && b.key === " " || (xi.includes(b.key) && E(), b.key === " " && b.preventDefault());
3375
- })
3376
- }
3377
- )
3378
- }
3379
- )
3380
- }
3381
- );
3382
- }
3383
- );
3384
- os.displayName = Lt;
3385
- var gt = "SelectItemText", is = v.forwardRef(
3386
- (e, r) => {
3387
- const { __scopeSelect: t, className: n, style: s, ...o } = e, i = qe(gt, t), a = Ye(gt, t), c = ss(gt, t), u = Ai(gt, t), [p, d] = v.useState(null), x = we(
3388
- r,
3389
- (b) => d(b),
3390
- c.onItemTextChange,
3391
- (b) => {
3392
- var m;
3393
- return (m = a.itemTextRefCallback) == null ? void 0 : m.call(a, b, c.value, c.disabled);
3394
- }
3395
- ), w = p == null ? void 0 : p.textContent, g = v.useMemo(
3396
- () => /* @__PURE__ */ P.jsx("option", { value: c.value, disabled: c.disabled, children: w }, c.value),
3397
- [c.disabled, c.value, w]
3398
- ), { onNativeOptionAdd: A, onNativeOptionRemove: E } = u;
3399
- return _e(() => (A(g), () => E(g)), [A, E, g]), /* @__PURE__ */ P.jsxs(P.Fragment, { children: [
3400
- /* @__PURE__ */ P.jsx(ue.span, { id: c.textId, ...o, ref: x }),
3401
- c.isSelected && i.valueNode && !i.valueNodeHasChildren ? gr.createPortal(o.children, i.valueNode) : null
3402
- ] });
3403
- }
3404
- );
3405
- is.displayName = gt;
3406
- var as = "SelectItemIndicator", ls = v.forwardRef(
3407
- (e, r) => {
3408
- const { __scopeSelect: t, ...n } = e;
3409
- return ss(as, t).isSelected ? /* @__PURE__ */ P.jsx(ue.span, { "aria-hidden": !0, ...n, ref: r }) : null;
3410
- }
3411
- );
3412
- ls.displayName = as;
3413
- var pr = "SelectScrollUpButton", cs = v.forwardRef((e, r) => {
3414
- const t = Ye(pr, e.__scopeSelect), n = Tr(pr, e.__scopeSelect), [s, o] = v.useState(!1), i = we(r, n.onScrollButtonChange);
3415
- return _e(() => {
3416
- if (t.viewport && t.isPositioned) {
3417
- let a = function() {
3418
- const u = c.scrollTop > 0;
3419
- o(u);
3420
- };
3421
- const c = t.viewport;
3422
- return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
3423
- }
3424
- }, [t.viewport, t.isPositioned]), s ? /* @__PURE__ */ P.jsx(
3425
- fs,
3426
- {
3427
- ...e,
3428
- ref: i,
3429
- onAutoScroll: () => {
3430
- const { viewport: a, selectedItem: c } = t;
3431
- a && c && (a.scrollTop = a.scrollTop - c.offsetHeight);
3432
- }
3433
- }
3434
- ) : null;
3435
- });
3436
- cs.displayName = pr;
3437
- var hr = "SelectScrollDownButton", us = v.forwardRef((e, r) => {
3438
- const t = Ye(hr, e.__scopeSelect), n = Tr(hr, e.__scopeSelect), [s, o] = v.useState(!1), i = we(r, n.onScrollButtonChange);
3439
- return _e(() => {
3440
- if (t.viewport && t.isPositioned) {
3441
- let a = function() {
3442
- const u = c.scrollHeight - c.clientHeight, p = Math.ceil(c.scrollTop) < u;
3443
- o(p);
3444
- };
3445
- const c = t.viewport;
3446
- return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
3447
- }
3448
- }, [t.viewport, t.isPositioned]), s ? /* @__PURE__ */ P.jsx(
3449
- fs,
3450
- {
3451
- ...e,
3452
- ref: i,
3453
- onAutoScroll: () => {
3454
- const { viewport: a, selectedItem: c } = t;
3455
- a && c && (a.scrollTop = a.scrollTop + c.offsetHeight);
3456
- }
3457
- }
3458
- ) : null;
3459
- });
3460
- us.displayName = hr;
3461
- var fs = v.forwardRef((e, r) => {
3462
- const { __scopeSelect: t, onAutoScroll: n, ...s } = e, o = Ye("SelectScrollButton", t), i = v.useRef(null), a = Ut(t), c = v.useCallback(() => {
3463
- i.current !== null && (window.clearInterval(i.current), i.current = null);
3464
- }, []);
3465
- return v.useEffect(() => () => c(), [c]), _e(() => {
3466
- var p;
3467
- const u = a().find((d) => d.ref.current === document.activeElement);
3468
- (p = u == null ? void 0 : u.ref.current) == null || p.scrollIntoView({ block: "nearest" });
3469
- }, [a]), /* @__PURE__ */ P.jsx(
3470
- ue.div,
3471
- {
3472
- "aria-hidden": !0,
3473
- ...s,
3474
- ref: r,
3475
- style: { flexShrink: 0, ...s.style },
3476
- onPointerDown: ce(s.onPointerDown, () => {
3477
- i.current === null && (i.current = window.setInterval(n, 50));
3478
- }),
3479
- onPointerMove: ce(s.onPointerMove, () => {
3480
- var u;
3481
- (u = o.onItemLeave) == null || u.call(o), i.current === null && (i.current = window.setInterval(n, 50));
3482
- }),
3483
- onPointerLeave: ce(s.onPointerLeave, () => {
3484
- c();
3485
- })
3486
- }
3487
- );
3488
- }), Di = "SelectSeparator", ds = v.forwardRef(
3489
- (e, r) => {
3490
- const { __scopeSelect: t, ...n } = e;
3491
- return /* @__PURE__ */ P.jsx(ue.div, { "aria-hidden": !0, ...n, ref: r });
3492
- }
3493
- );
3494
- ds.displayName = Di;
3495
- var mr = "SelectArrow", Ni = v.forwardRef(
3496
- (e, r) => {
3497
- const { __scopeSelect: t, ...n } = e, s = $t(t), o = qe(mr, t), i = Ye(mr, t);
3498
- return o.open && i.position === "popper" ? /* @__PURE__ */ P.jsx(gi, { ...s, ...n, ref: r }) : null;
3499
- }
3500
- );
3501
- Ni.displayName = mr;
3502
- function ps(e) {
3503
- return e === "" || e === void 0;
3504
- }
3505
- var hs = v.forwardRef(
3506
- (e, r) => {
3507
- const { value: t, ...n } = e, s = v.useRef(null), o = we(r, s), i = yi(t);
3508
- return v.useEffect(() => {
3509
- const a = s.current, c = window.HTMLSelectElement.prototype, p = Object.getOwnPropertyDescriptor(
3510
- c,
3511
- "value"
3512
- ).set;
3513
- if (i !== t && p) {
3514
- const d = new Event("change", { bubbles: !0 });
3515
- p.call(a, t), a.dispatchEvent(d);
3516
- }
3517
- }, [i, t]), /* @__PURE__ */ P.jsx($s, { asChild: !0, children: /* @__PURE__ */ P.jsx("select", { ...n, ref: o, defaultValue: t }) });
3518
- }
3519
- );
3520
- hs.displayName = "BubbleSelect";
3521
- function ms(e) {
3522
- const r = rn(e), t = v.useRef(""), n = v.useRef(0), s = v.useCallback(
3523
- (i) => {
3524
- const a = t.current + i;
3525
- r(a), function c(u) {
3526
- t.current = u, window.clearTimeout(n.current), u !== "" && (n.current = window.setTimeout(() => c(""), 1e3));
3527
- }(a);
3528
- },
3529
- [r]
3530
- ), o = v.useCallback(() => {
3531
- t.current = "", window.clearTimeout(n.current);
3532
- }, []);
3533
- return v.useEffect(() => () => window.clearTimeout(n.current), []), [t, s, o];
3534
- }
3535
- function gs(e, r, t) {
3536
- const s = r.length > 1 && Array.from(r).every((u) => u === r[0]) ? r[0] : r, o = t ? e.indexOf(t) : -1;
3537
- let i = Ii(e, Math.max(o, 0));
3538
- s.length === 1 && (i = i.filter((u) => u !== t));
3539
- const c = i.find(
3540
- (u) => u.textValue.toLowerCase().startsWith(s.toLowerCase())
3541
- );
3542
- return c !== t ? c : void 0;
3543
- }
3544
- function Ii(e, r) {
3545
- return e.map((t, n) => e[(r + n) % e.length]);
3546
- }
3547
- var ki = Wn, ys = $n, Mi = Kn, Li = qn, ji = Yn, vs = Gn, Bi = Jn, Hi = ts, xs = ns, ws = os, Wi = is, Ui = ls, bs = cs, Ss = us, As = ds;
3548
- const ca = ki, ua = Hi, fa = Mi, $i = v.forwardRef(({ className: e, children: r, ...t }, n) => /* @__PURE__ */ P.jsxs(
3549
- ys,
3550
- {
3551
- ref: n,
3552
- className: Ue(
3553
- "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",
3554
- e
3555
- ),
3556
- ...t,
3557
- children: [
3558
- /* @__PURE__ */ P.jsx("span", { className: "truncate", children: r }),
3559
- /* @__PURE__ */ P.jsx(Li, { asChild: !0, children: /* @__PURE__ */ P.jsx(sn, { className: "flex-shrink-0 h-4 w-4 opacity-50" }) })
3560
- ]
3561
- }
3562
- ));
3563
- $i.displayName = ys.displayName;
3564
- const _s = v.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ P.jsx(
3565
- bs,
3566
- {
3567
- ref: t,
3568
- className: Ue(
3569
- "flex cursor-default items-center justify-center py-1",
3570
- e
3571
- ),
3572
- ...r,
3573
- children: /* @__PURE__ */ P.jsx(Ys, { className: "h-4 w-4" })
3574
- }
3575
- ));
3576
- _s.displayName = bs.displayName;
3577
- const Cs = v.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ P.jsx(
3578
- Ss,
3579
- {
3580
- ref: t,
3581
- className: Ue(
3582
- "flex cursor-default items-center justify-center py-1",
3583
- e
3584
- ),
3585
- ...r,
3586
- children: /* @__PURE__ */ P.jsx(sn, { className: "h-4 w-4" })
3587
- }
3588
- ));
3589
- Cs.displayName = Ss.displayName;
3590
- const zi = v.forwardRef(({ className: e, children: r, position: t = "popper", ...n }, s) => /* @__PURE__ */ P.jsx(ji, { children: /* @__PURE__ */ P.jsxs(
3591
- vs,
3592
- {
3593
- ref: s,
3594
- className: Ue(
3595
- "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",
3596
- 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",
3597
- e
3598
- ),
3599
- position: t,
3600
- ...n,
3601
- children: [
3602
- /* @__PURE__ */ P.jsx(_s, {}),
3603
- /* @__PURE__ */ P.jsx(
3604
- Bi,
3605
- {
3606
- className: Ue(
3607
- "p-1",
3608
- t === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
3609
- ),
3610
- children: r
3611
- }
3612
- ),
3613
- /* @__PURE__ */ P.jsx(Cs, {})
3614
- ]
3615
- }
3616
- ) }));
3617
- zi.displayName = vs.displayName;
3618
- const Ki = v.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ P.jsx(
3619
- xs,
3620
- {
3621
- ref: t,
3622
- className: Ue("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
3623
- ...r
3624
- }
3625
- ));
3626
- Ki.displayName = xs.displayName;
3627
- const qi = v.forwardRef(({ className: e, children: r, ...t }, n) => /* @__PURE__ */ P.jsxs(
3628
- ws,
3629
- {
3630
- ref: n,
3631
- className: Ue(
3632
- "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",
3633
- e
3634
- ),
3635
- ...t,
3636
- children: [
3637
- /* @__PURE__ */ P.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ P.jsx(Ui, { children: /* @__PURE__ */ P.jsx(qs, { className: "h-4 w-4" }) }) }),
3638
- /* @__PURE__ */ P.jsx(Wi, { children: r })
3639
- ]
3640
- }
3641
- ));
3642
- qi.displayName = ws.displayName;
3643
- const Yi = v.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ P.jsx(
3644
- As,
3645
- {
3646
- ref: t,
3647
- className: Ue("-mx-1 my-1 h-px bg-muted", e),
3648
- ...r
3649
- }
3650
- ));
3651
- Yi.displayName = As.displayName;
3652
- export {
3653
- oa as C,
3654
- sa as F,
3655
- ca as S,
3656
- na as a,
3657
- $i as b,
3658
- fa as c,
3659
- zi as d,
3660
- ua as e,
3661
- qi as f,
3662
- ia as g,
3663
- Js as h,
3664
- jt as i,
3665
- aa as u
3666
- };
3667
- //# sourceMappingURL=Select-CcBbwJ2R.js.map