@chaibuilder/sdk 2.1.2 → 2.1.4

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.
@@ -1,1900 +0,0 @@
1
- import { jsx as d, jsxs as Y } from "react/jsx-runtime";
2
- import * as y from "react";
3
- import N from "react";
4
- import * as me from "@radix-ui/react-accordion";
5
- import { ChevronDownIcon as ia, Cross2Icon as wt, MagnifyingGlassIcon as na, ChevronRightIcon as la, CheckIcon as da, DotFilledIcon as ca } from "@radix-ui/react-icons";
6
- import { cva as ke } from "class-variance-authority";
7
- import * as B from "@radix-ui/react-alert-dialog";
8
- import { Slot as Nt } from "@radix-ui/react-slot";
9
- import * as ye from "@radix-ui/react-avatar";
10
- import { Command as G } from "cmdk";
11
- import * as A from "@radix-ui/react-dialog";
12
- import * as R from "@radix-ui/react-dropdown-menu";
13
- import * as _t from "@radix-ui/react-label";
14
- import * as Ee from "@radix-ui/react-hover-card";
15
- import * as Ce from "@radix-ui/react-popover";
16
- import * as fe from "@radix-ui/react-scroll-area";
17
- import * as Ft from "@radix-ui/react-separator";
18
- import { useTheme as ua } from "next-themes";
19
- import { Toaster as fa } from "sonner";
20
- import * as $e from "@radix-ui/react-switch";
21
- import * as ge from "@radix-ui/react-tabs";
22
- import * as be from "@radix-ui/react-tooltip";
23
- import { clsx as ma } from "clsx";
24
- import { twMerge as ga } from "tailwind-merge";
25
- const m = (...e) => ga(ma(e)), ls = me.Root, pa = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(me.Item, { ref: t, className: m("border-b", e), ...a }));
26
- pa.displayName = "AccordionItem";
27
- const ya = y.forwardRef(({ className: e, children: a, ...t }, s) => /* @__PURE__ */ d(me.Header, { className: "flex", children: /* @__PURE__ */ Y(
28
- me.Trigger,
29
- {
30
- ref: s,
31
- className: m(
32
- "flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
33
- e
34
- ),
35
- ...t,
36
- children: [
37
- a,
38
- t.hideArrow ? null : /* @__PURE__ */ d(ia, { className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" })
39
- ]
40
- }
41
- ) }));
42
- ya.displayName = me.Trigger.displayName;
43
- const ba = y.forwardRef(({ className: e, children: a, ...t }, s) => /* @__PURE__ */ d(
44
- me.Content,
45
- {
46
- ref: s,
47
- className: m(
48
- "text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
49
- e
50
- ),
51
- ...t,
52
- children: /* @__PURE__ */ d("div", { className: "pb-4 pt-0", children: a })
53
- }
54
- ));
55
- ba.displayName = me.Content.displayName;
56
- const ha = ke(
57
- "relative w-full rounded-lg border px-4 py-3 text-sm [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
58
- {
59
- variants: {
60
- variant: {
61
- default: "bg-background text-foreground",
62
- destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
63
- }
64
- },
65
- defaultVariants: {
66
- variant: "default"
67
- }
68
- }
69
- ), va = y.forwardRef(({ className: e, variant: a, ...t }, s) => /* @__PURE__ */ d("div", { ref: s, role: "alert", className: m(ha({ variant: a }), e), ...t }));
70
- va.displayName = "Alert";
71
- const xa = y.forwardRef(
72
- ({ className: e, ...a }, t) => /* @__PURE__ */ d("h5", { ref: t, className: m("mb-1 font-medium leading-none tracking-tight", e), ...a })
73
- );
74
- xa.displayName = "AlertTitle";
75
- const wa = y.forwardRef(
76
- ({ className: e, ...a }, t) => /* @__PURE__ */ d("div", { ref: t, className: m("text-sm [&_p]:leading-relaxed", e), ...a })
77
- );
78
- wa.displayName = "AlertDescription";
79
- const Ge = ke(
80
- "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
81
- {
82
- variants: {
83
- variant: {
84
- default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
85
- destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
86
- outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
87
- secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
88
- ghost: "hover:bg-accent hover:text-accent-foreground",
89
- link: "text-primary underline-offset-4 hover:underline"
90
- },
91
- size: {
92
- default: "h-9 px-4 py-2",
93
- sm: "h-8 rounded-md px-3 text-xs",
94
- lg: "h-10 rounded-md px-8",
95
- icon: "h-9 w-9"
96
- }
97
- },
98
- defaultVariants: {
99
- variant: "default",
100
- size: "default"
101
- }
102
- }
103
- ), Na = y.forwardRef(
104
- ({ className: e, variant: a, size: t, asChild: s = !1, ...o }, n) => /* @__PURE__ */ d(s ? Nt : "button", { className: m(Ge({ variant: a, size: t, className: e })), ref: n, ...o })
105
- );
106
- Na.displayName = "Button";
107
- const ds = B.Root, cs = B.Trigger, Ct = ({ className: e, ...a }) => /* @__PURE__ */ d(B.Portal, { className: m(e), ...a });
108
- Ct.displayName = B.Portal.displayName;
109
- const kt = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
110
- B.Overlay,
111
- {
112
- className: m(
113
- "fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
114
- e
115
- ),
116
- ...a,
117
- ref: t
118
- }
119
- ));
120
- kt.displayName = B.Overlay.displayName;
121
- const _a = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ Y(Ct, { children: [
122
- /* @__PURE__ */ d(kt, {}),
123
- /* @__PURE__ */ d(
124
- B.Content,
125
- {
126
- ref: t,
127
- className: m(
128
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",
129
- e
130
- ),
131
- ...a
132
- }
133
- )
134
- ] }));
135
- _a.displayName = B.Content.displayName;
136
- const Fa = ({ className: e, ...a }) => /* @__PURE__ */ d("div", { className: m("flex flex-col space-y-2 text-center sm:text-left", e), ...a });
137
- Fa.displayName = "AlertDialogHeader";
138
- const Ca = ({ className: e, ...a }) => /* @__PURE__ */ d("div", { className: m("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e), ...a });
139
- Ca.displayName = "AlertDialogFooter";
140
- const ka = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(B.Title, { ref: t, className: m("text-lg font-semibold", e), ...a }));
141
- ka.displayName = B.Title.displayName;
142
- const Da = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(B.Description, { ref: t, className: m("text-sm text-muted-foreground", e), ...a }));
143
- Da.displayName = B.Description.displayName;
144
- const Aa = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(B.Action, { ref: t, className: m(Ge(), e), ...a }));
145
- Aa.displayName = B.Action.displayName;
146
- const Va = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
147
- B.Cancel,
148
- {
149
- ref: t,
150
- className: m(Ge({ variant: "outline" }), "mt-2 sm:mt-0", e),
151
- ...a
152
- }
153
- ));
154
- Va.displayName = B.Cancel.displayName;
155
- const Ra = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
156
- ye.Root,
157
- {
158
- ref: t,
159
- className: m("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", e),
160
- ...a
161
- }
162
- ));
163
- Ra.displayName = ye.Root.displayName;
164
- const Sa = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(ye.Image, { ref: t, className: m("aspect-square h-full w-full", e), ...a }));
165
- Sa.displayName = ye.Image.displayName;
166
- const Ta = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
167
- ye.Fallback,
168
- {
169
- ref: t,
170
- className: m("flex h-full w-full items-center justify-center rounded-full bg-muted", e),
171
- ...a
172
- }
173
- ));
174
- Ta.displayName = ye.Fallback.displayName;
175
- const Ia = ke(
176
- "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
177
- {
178
- variants: {
179
- variant: {
180
- default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
181
- secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
182
- destructive: "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
183
- outline: "text-foreground"
184
- }
185
- },
186
- defaultVariants: {
187
- variant: "default"
188
- }
189
- }
190
- ), us = ({ className: e, variant: a, ...t }) => /* @__PURE__ */ d("div", { className: m(Ia({ variant: a }), e), ...t }), Ea = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d("div", { ref: t, className: m("rounded-xl border bg-card text-card-foreground shadow", e), ...a }));
191
- Ea.displayName = "Card";
192
- const Pa = y.forwardRef(
193
- ({ className: e, ...a }, t) => /* @__PURE__ */ d("div", { ref: t, className: m("flex flex-col space-y-1.5 p-6", e), ...a })
194
- );
195
- Pa.displayName = "CardHeader";
196
- const Ma = y.forwardRef(
197
- ({ className: e, ...a }, t) => /* @__PURE__ */ d("h3", { ref: t, className: m("font-semibold leading-none tracking-tight", e), ...a })
198
- );
199
- Ma.displayName = "CardTitle";
200
- const La = y.forwardRef(
201
- ({ className: e, ...a }, t) => /* @__PURE__ */ d("p", { ref: t, className: m("text-sm text-muted-foreground", e), ...a })
202
- );
203
- La.displayName = "CardDescription";
204
- const Oa = y.forwardRef(
205
- ({ className: e, ...a }, t) => /* @__PURE__ */ d("div", { ref: t, className: m("p-6 pt-0", e), ...a })
206
- );
207
- Oa.displayName = "CardContent";
208
- const za = y.forwardRef(
209
- ({ className: e, ...a }, t) => /* @__PURE__ */ d("div", { ref: t, className: m(" flex items-center p-6 pt-0", e), ...a })
210
- );
211
- za.displayName = "CardFooter";
212
- const Ua = A.Root, fs = A.Trigger, Dt = ({ className: e, ...a }) => /* @__PURE__ */ d(A.Portal, { className: m(e), ...a });
213
- Dt.displayName = A.Portal.displayName;
214
- const At = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
215
- A.Overlay,
216
- {
217
- ref: t,
218
- className: m(
219
- "fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
220
- e
221
- ),
222
- ...a
223
- }
224
- ));
225
- At.displayName = A.Overlay.displayName;
226
- const Vt = y.forwardRef(({ className: e, children: a, ...t }, s) => /* @__PURE__ */ Y(Dt, { children: [
227
- /* @__PURE__ */ d(At, {}),
228
- /* @__PURE__ */ Y(
229
- A.Content,
230
- {
231
- ref: s,
232
- className: m(
233
- "fixed left-[50%] top-[50%] z-[999] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",
234
- e
235
- ),
236
- ...t,
237
- children: [
238
- a,
239
- /* @__PURE__ */ Y(A.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
240
- /* @__PURE__ */ d(wt, { className: "h-4 w-4" }),
241
- /* @__PURE__ */ d("span", { className: "sr-only", children: "Close" })
242
- ] })
243
- ]
244
- }
245
- )
246
- ] }));
247
- Vt.displayName = A.Content.displayName;
248
- const Ba = ({ className: e, ...a }) => /* @__PURE__ */ d("div", { className: m("flex flex-col space-y-1.5 text-center sm:text-left", e), ...a });
249
- Ba.displayName = "DialogHeader";
250
- const Ha = ({ className: e, ...a }) => /* @__PURE__ */ d("div", { className: m("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e), ...a });
251
- Ha.displayName = "DialogFooter";
252
- const ja = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
253
- A.Title,
254
- {
255
- ref: t,
256
- className: m("text-lg font-semibold leading-none tracking-tight", e),
257
- ...a
258
- }
259
- ));
260
- ja.displayName = A.Title.displayName;
261
- const qa = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(A.Description, { ref: t, className: m("text-sm text-muted-foreground", e), ...a }));
262
- qa.displayName = A.Description.displayName;
263
- const Rt = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
264
- G,
265
- {
266
- ref: t,
267
- className: m(
268
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
269
- e
270
- ),
271
- ...a
272
- }
273
- ));
274
- Rt.displayName = G.displayName;
275
- const ms = ({ children: e, ...a }) => /* @__PURE__ */ d(Ua, { ...a, children: /* @__PURE__ */ d(Vt, { className: "overflow-hidden p-0", children: /* @__PURE__ */ d(Rt, { className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children: e }) }) }), $a = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ Y("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
276
- /* @__PURE__ */ d(na, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
277
- /* @__PURE__ */ d(
278
- G.Input,
279
- {
280
- ref: t,
281
- className: m(
282
- "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
283
- e
284
- ),
285
- ...a
286
- }
287
- )
288
- ] }));
289
- $a.displayName = G.Input.displayName;
290
- const Wa = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
291
- G.List,
292
- {
293
- ref: t,
294
- className: m("max-h-[300px] overflow-y-auto overflow-x-hidden", e),
295
- ...a
296
- }
297
- ));
298
- Wa.displayName = G.List.displayName;
299
- const Ga = y.forwardRef((e, a) => /* @__PURE__ */ d(G.Empty, { ref: a, className: "py-6 text-center text-sm", ...e }));
300
- Ga.displayName = G.Empty.displayName;
301
- const Ka = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
302
- G.Group,
303
- {
304
- ref: t,
305
- className: m(
306
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
307
- e
308
- ),
309
- ...a
310
- }
311
- ));
312
- Ka.displayName = G.Group.displayName;
313
- const Ja = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(G.Separator, { ref: t, className: m("-mx-1 h-px bg-border", e), ...a }));
314
- Ja.displayName = G.Separator.displayName;
315
- const Ya = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
316
- G.Item,
317
- {
318
- ref: t,
319
- className: m(
320
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
321
- e
322
- ),
323
- ...a
324
- }
325
- ));
326
- Ya.displayName = G.Item.displayName;
327
- const Qa = ({ className: e, ...a }) => /* @__PURE__ */ d("span", { className: m("ml-auto text-xs tracking-widest text-muted-foreground", e), ...a });
328
- Qa.displayName = "CommandShortcut";
329
- const gs = R.Root, ps = R.Trigger, ys = R.Group, bs = R.Portal, hs = R.Sub, vs = R.RadioGroup, Xa = y.forwardRef(({ className: e, inset: a, children: t, ...s }, o) => /* @__PURE__ */ Y(
330
- R.SubTrigger,
331
- {
332
- ref: o,
333
- className: m(
334
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
335
- a && "pl-8",
336
- e
337
- ),
338
- ...s,
339
- children: [
340
- t,
341
- /* @__PURE__ */ d(la, { className: "ml-auto h-4 w-4" })
342
- ]
343
- }
344
- ));
345
- Xa.displayName = R.SubTrigger.displayName;
346
- const Za = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
347
- R.SubContent,
348
- {
349
- ref: t,
350
- className: m(
351
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",
352
- e
353
- ),
354
- ...a
355
- }
356
- ));
357
- Za.displayName = R.SubContent.displayName;
358
- const er = y.forwardRef(({ className: e, sideOffset: a = 4, ...t }, s) => /* @__PURE__ */ d(R.Portal, { children: /* @__PURE__ */ d(
359
- R.Content,
360
- {
361
- ref: s,
362
- sideOffset: a,
363
- className: m(
364
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
365
- "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",
366
- e
367
- ),
368
- ...t
369
- }
370
- ) }));
371
- er.displayName = R.Content.displayName;
372
- const tr = y.forwardRef(({ className: e, inset: a, ...t }, s) => /* @__PURE__ */ d(
373
- R.Item,
374
- {
375
- ref: s,
376
- className: m(
377
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
378
- a && "pl-8",
379
- e
380
- ),
381
- ...t
382
- }
383
- ));
384
- tr.displayName = R.Item.displayName;
385
- const ar = y.forwardRef(({ className: e, children: a, checked: t, ...s }, o) => /* @__PURE__ */ Y(
386
- R.CheckboxItem,
387
- {
388
- ref: o,
389
- className: m(
390
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
391
- e
392
- ),
393
- checked: t,
394
- ...s,
395
- children: [
396
- /* @__PURE__ */ d("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ d(R.ItemIndicator, { children: /* @__PURE__ */ d(da, { className: "h-4 w-4" }) }) }),
397
- a
398
- ]
399
- }
400
- ));
401
- ar.displayName = R.CheckboxItem.displayName;
402
- const rr = y.forwardRef(({ className: e, children: a, ...t }, s) => /* @__PURE__ */ Y(
403
- R.RadioItem,
404
- {
405
- ref: s,
406
- className: m(
407
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
408
- e
409
- ),
410
- ...t,
411
- children: [
412
- /* @__PURE__ */ d("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ d(R.ItemIndicator, { children: /* @__PURE__ */ d(ca, { className: "h-4 w-4 fill-current" }) }) }),
413
- a
414
- ]
415
- }
416
- ));
417
- rr.displayName = R.RadioItem.displayName;
418
- const sr = y.forwardRef(({ className: e, inset: a, ...t }, s) => /* @__PURE__ */ d(
419
- R.Label,
420
- {
421
- ref: s,
422
- className: m("px-2 py-1.5 text-sm font-semibold", a && "pl-8", e),
423
- ...t
424
- }
425
- ));
426
- sr.displayName = R.Label.displayName;
427
- const or = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(R.Separator, { ref: t, className: m("-mx-1 my-1 h-px bg-muted", e), ...a }));
428
- or.displayName = R.Separator.displayName;
429
- const ir = ({ className: e, ...a }) => /* @__PURE__ */ d("span", { className: m("ml-auto text-xs tracking-widest opacity-60", e), ...a });
430
- ir.displayName = "DropdownMenuShortcut";
431
- var De = (e) => e.type === "checkbox", ue = (e) => e instanceof Date, $ = (e) => e == null;
432
- const St = (e) => typeof e == "object";
433
- var I = (e) => !$(e) && !Array.isArray(e) && St(e) && !ue(e), Tt = (e) => I(e) && e.target ? De(e.target) ? e.target.checked : e.target.value : e, nr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, It = (e, a) => e.has(nr(a)), lr = (e) => {
434
- const a = e.constructor && e.constructor.prototype;
435
- return I(a) && a.hasOwnProperty("isPrototypeOf");
436
- }, Ke = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
437
- function z(e) {
438
- let a;
439
- const t = Array.isArray(e), s = typeof FileList < "u" ? e instanceof FileList : !1;
440
- if (e instanceof Date)
441
- a = new Date(e);
442
- else if (e instanceof Set)
443
- a = new Set(e);
444
- else if (!(Ke && (e instanceof Blob || s)) && (t || I(e)))
445
- if (a = t ? [] : {}, !t && !lr(e))
446
- a = e;
447
- else
448
- for (const o in e)
449
- e.hasOwnProperty(o) && (a[o] = z(e[o]));
450
- else
451
- return e;
452
- return a;
453
- }
454
- var Pe = (e) => Array.isArray(e) ? e.filter(Boolean) : [], T = (e) => e === void 0, g = (e, a, t) => {
455
- if (!a || !I(e))
456
- return t;
457
- const s = Pe(a.split(/[,[\].]+?/)).reduce((o, n) => $(o) ? o : o[n], e);
458
- return T(s) || s === e ? T(e[a]) ? t : e[a] : s;
459
- }, J = (e) => typeof e == "boolean", Je = (e) => /^\w*$/.test(e), Et = (e) => Pe(e.replace(/["|']|\]/g, "").split(/\.|\[/)), D = (e, a, t) => {
460
- let s = -1;
461
- const o = Je(a) ? [a] : Et(a), n = o.length, u = n - 1;
462
- for (; ++s < n; ) {
463
- const b = o[s];
464
- let _ = t;
465
- if (s !== u) {
466
- const P = e[b];
467
- _ = I(P) || Array.isArray(P) ? P : isNaN(+o[s + 1]) ? {} : [];
468
- }
469
- if (b === "__proto__" || b === "constructor" || b === "prototype")
470
- return;
471
- e[b] = _, e = e[b];
472
- }
473
- };
474
- const Re = {
475
- BLUR: "blur",
476
- FOCUS_OUT: "focusout",
477
- CHANGE: "change"
478
- }, ee = {
479
- onBlur: "onBlur",
480
- onChange: "onChange",
481
- onSubmit: "onSubmit",
482
- onTouched: "onTouched",
483
- all: "all"
484
- }, ie = {
485
- max: "max",
486
- min: "min",
487
- maxLength: "maxLength",
488
- minLength: "minLength",
489
- pattern: "pattern",
490
- required: "required",
491
- validate: "validate"
492
- }, Pt = N.createContext(null), Me = () => N.useContext(Pt), dr = (e) => {
493
- const { children: a, ...t } = e;
494
- return N.createElement(Pt.Provider, { value: t }, a);
495
- };
496
- var Mt = (e, a, t, s = !0) => {
497
- const o = {
498
- defaultValues: a._defaultValues
499
- };
500
- for (const n in e)
501
- Object.defineProperty(o, n, {
502
- get: () => {
503
- const u = n;
504
- return a._proxyFormState[u] !== ee.all && (a._proxyFormState[u] = !s || ee.all), t && (t[u] = !0), e[u];
505
- }
506
- });
507
- return o;
508
- };
509
- function cr(e) {
510
- const a = Me(), { control: t = a.control, disabled: s, name: o, exact: n } = e, [u, b] = N.useState(t._formState), _ = N.useRef({
511
- isDirty: !1,
512
- isLoading: !1,
513
- dirtyFields: !1,
514
- touchedFields: !1,
515
- validatingFields: !1,
516
- isValidating: !1,
517
- isValid: !1,
518
- errors: !1
519
- }), P = N.useRef(o);
520
- return P.current = o, N.useEffect(() => t._subscribe({
521
- name: P.current,
522
- formState: _.current,
523
- exact: n,
524
- callback: (C) => {
525
- !s && b({
526
- ...t._formState,
527
- ...C
528
- });
529
- }
530
- }), [t, s, n]), N.useEffect(() => {
531
- _.current.isValid && t._setValid(!0);
532
- }, [t]), N.useMemo(() => Mt(u, t, _.current, !1), [u, t]);
533
- }
534
- var se = (e) => typeof e == "string", Lt = (e, a, t, s, o) => se(e) ? (s && a.watch.add(e), g(t, e, o)) : Array.isArray(e) ? e.map((n) => (s && a.watch.add(n), g(t, n))) : (s && (a.watchAll = !0), t);
535
- function ur(e) {
536
- const a = Me(), { control: t = a.control, name: s, defaultValue: o, disabled: n, exact: u } = e, b = N.useRef(s), _ = N.useRef(o);
537
- b.current = s, N.useEffect(() => t._subscribe({
538
- name: b.current,
539
- formState: {
540
- values: !0
541
- },
542
- exact: u,
543
- callback: (V) => !n && C(Lt(b.current, t._names, V.values || t._formValues, !1, _.current))
544
- }), [t, n, u]);
545
- const [P, C] = N.useState(t._getWatch(s, o));
546
- return N.useEffect(() => t._removeUnmounted()), P;
547
- }
548
- function fr(e) {
549
- const a = Me(), { name: t, disabled: s, control: o = a.control, shouldUnregister: n } = e, u = It(o._names.array, t), b = ur({
550
- control: o,
551
- name: t,
552
- defaultValue: g(o._formValues, t, g(o._defaultValues, t, e.defaultValue)),
553
- exact: !0
554
- }), _ = cr({
555
- control: o,
556
- name: t,
557
- exact: !0
558
- }), P = N.useRef(e), C = N.useRef(o.register(t, {
559
- ...e.rules,
560
- value: b,
561
- ...J(e.disabled) ? { disabled: e.disabled } : {}
562
- })), V = N.useMemo(() => Object.defineProperties({}, {
563
- invalid: {
564
- enumerable: !0,
565
- get: () => !!g(_.errors, t)
566
- },
567
- isDirty: {
568
- enumerable: !0,
569
- get: () => !!g(_.dirtyFields, t)
570
- },
571
- isTouched: {
572
- enumerable: !0,
573
- get: () => !!g(_.touchedFields, t)
574
- },
575
- isValidating: {
576
- enumerable: !0,
577
- get: () => !!g(_.validatingFields, t)
578
- },
579
- error: {
580
- enumerable: !0,
581
- get: () => g(_.errors, t)
582
- }
583
- }), [_, t]), x = N.useCallback((H) => C.current.onChange({
584
- target: {
585
- value: Tt(H),
586
- name: t
587
- },
588
- type: Re.CHANGE
589
- }), [t]), de = N.useCallback(() => C.current.onBlur({
590
- target: {
591
- value: g(o._formValues, t),
592
- name: t
593
- },
594
- type: Re.BLUR
595
- }), [t, o._formValues]), X = N.useCallback((H) => {
596
- const j = g(o._fields, t);
597
- j && H && (j._f.ref = {
598
- focus: () => H.focus(),
599
- select: () => H.select(),
600
- setCustomValidity: (v) => H.setCustomValidity(v),
601
- reportValidity: () => H.reportValidity()
602
- });
603
- }, [o._fields, t]), O = N.useMemo(() => ({
604
- name: t,
605
- value: b,
606
- ...J(s) || _.disabled ? { disabled: _.disabled || s } : {},
607
- onChange: x,
608
- onBlur: de,
609
- ref: X
610
- }), [t, s, _.disabled, x, de, X, b]);
611
- return N.useEffect(() => {
612
- const H = o._options.shouldUnregister || n;
613
- o.register(t, {
614
- ...P.current.rules,
615
- ...J(P.current.disabled) ? { disabled: P.current.disabled } : {}
616
- });
617
- const j = (v, Z) => {
618
- const K = g(o._fields, v);
619
- K && K._f && (K._f.mount = Z);
620
- };
621
- if (j(t, !0), H) {
622
- const v = z(g(o._options.defaultValues, t));
623
- D(o._defaultValues, t, v), T(g(o._formValues, t)) && D(o._formValues, t, v);
624
- }
625
- return !u && o.register(t), () => {
626
- (u ? H && !o._state.action : H) ? o.unregister(t) : j(t, !1);
627
- };
628
- }, [t, o, u, n]), N.useEffect(() => {
629
- o._setDisabledField({
630
- disabled: s,
631
- name: t
632
- });
633
- }, [s, t, o]), N.useMemo(() => ({
634
- field: O,
635
- formState: _,
636
- fieldState: V
637
- }), [O, _, V]);
638
- }
639
- const mr = (e) => e.render(fr(e));
640
- var gr = (e, a, t, s, o) => a ? {
641
- ...t[e],
642
- types: {
643
- ...t[e] && t[e].types ? t[e].types : {},
644
- [s]: o || !0
645
- }
646
- } : {}, _e = (e) => Array.isArray(e) ? e : [e], ct = () => {
647
- let e = [];
648
- return {
649
- get observers() {
650
- return e;
651
- },
652
- next: (o) => {
653
- for (const n of e)
654
- n.next && n.next(o);
655
- },
656
- subscribe: (o) => (e.push(o), {
657
- unsubscribe: () => {
658
- e = e.filter((n) => n !== o);
659
- }
660
- }),
661
- unsubscribe: () => {
662
- e = [];
663
- }
664
- };
665
- }, We = (e) => $(e) || !St(e);
666
- function le(e, a) {
667
- if (We(e) || We(a))
668
- return e === a;
669
- if (ue(e) && ue(a))
670
- return e.getTime() === a.getTime();
671
- const t = Object.keys(e), s = Object.keys(a);
672
- if (t.length !== s.length)
673
- return !1;
674
- for (const o of t) {
675
- const n = e[o];
676
- if (!s.includes(o))
677
- return !1;
678
- if (o !== "ref") {
679
- const u = a[o];
680
- if (ue(n) && ue(u) || I(n) && I(u) || Array.isArray(n) && Array.isArray(u) ? !le(n, u) : n !== u)
681
- return !1;
682
- }
683
- }
684
- return !0;
685
- }
686
- var q = (e) => I(e) && !Object.keys(e).length, Ye = (e) => e.type === "file", te = (e) => typeof e == "function", Se = (e) => {
687
- if (!Ke)
688
- return !1;
689
- const a = e ? e.ownerDocument : 0;
690
- return e instanceof (a && a.defaultView ? a.defaultView.HTMLElement : HTMLElement);
691
- }, Ot = (e) => e.type === "select-multiple", Qe = (e) => e.type === "radio", pr = (e) => Qe(e) || De(e), qe = (e) => Se(e) && e.isConnected;
692
- function yr(e, a) {
693
- const t = a.slice(0, -1).length;
694
- let s = 0;
695
- for (; s < t; )
696
- e = T(e) ? s++ : e[a[s++]];
697
- return e;
698
- }
699
- function br(e) {
700
- for (const a in e)
701
- if (e.hasOwnProperty(a) && !T(e[a]))
702
- return !1;
703
- return !0;
704
- }
705
- function M(e, a) {
706
- const t = Array.isArray(a) ? a : Je(a) ? [a] : Et(a), s = t.length === 1 ? e : yr(e, t), o = t.length - 1, n = t[o];
707
- return s && delete s[n], o !== 0 && (I(s) && q(s) || Array.isArray(s) && br(s)) && M(e, t.slice(0, -1)), e;
708
- }
709
- var zt = (e) => {
710
- for (const a in e)
711
- if (te(e[a]))
712
- return !0;
713
- return !1;
714
- };
715
- function Te(e, a = {}) {
716
- const t = Array.isArray(e);
717
- if (I(e) || t)
718
- for (const s in e)
719
- Array.isArray(e[s]) || I(e[s]) && !zt(e[s]) ? (a[s] = Array.isArray(e[s]) ? [] : {}, Te(e[s], a[s])) : $(e[s]) || (a[s] = !0);
720
- return a;
721
- }
722
- function Ut(e, a, t) {
723
- const s = Array.isArray(e);
724
- if (I(e) || s)
725
- for (const o in e)
726
- Array.isArray(e[o]) || I(e[o]) && !zt(e[o]) ? T(a) || We(t[o]) ? t[o] = Array.isArray(e[o]) ? Te(e[o], []) : { ...Te(e[o]) } : Ut(e[o], $(a) ? {} : a[o], t[o]) : t[o] = !le(e[o], a[o]);
727
- return t;
728
- }
729
- var we = (e, a) => Ut(e, a, Te(a));
730
- const ut = {
731
- value: !1,
732
- isValid: !1
733
- }, ft = { value: !0, isValid: !0 };
734
- var Bt = (e) => {
735
- if (Array.isArray(e)) {
736
- if (e.length > 1) {
737
- const a = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
738
- return { value: a, isValid: !!a.length };
739
- }
740
- return e[0].checked && !e[0].disabled ? (
741
- // @ts-expect-error expected to work in the browser
742
- e[0].attributes && !T(e[0].attributes.value) ? T(e[0].value) || e[0].value === "" ? ft : { value: e[0].value, isValid: !0 } : ft
743
- ) : ut;
744
- }
745
- return ut;
746
- }, Ht = (e, { valueAsNumber: a, valueAsDate: t, setValueAs: s }) => T(e) ? e : a ? e === "" ? NaN : e && +e : t && se(e) ? new Date(e) : s ? s(e) : e;
747
- const mt = {
748
- isValid: !1,
749
- value: null
750
- };
751
- var jt = (e) => Array.isArray(e) ? e.reduce((a, t) => t && t.checked && !t.disabled ? {
752
- isValid: !0,
753
- value: t.value
754
- } : a, mt) : mt;
755
- function gt(e) {
756
- const a = e.ref;
757
- return Ye(a) ? a.files : Qe(a) ? jt(e.refs).value : Ot(a) ? [...a.selectedOptions].map(({ value: t }) => t) : De(a) ? Bt(e.refs).value : Ht(T(a.value) ? e.ref.value : a.value, e);
758
- }
759
- var hr = (e, a, t, s) => {
760
- const o = {};
761
- for (const n of e) {
762
- const u = g(a, n);
763
- u && D(o, n, u._f);
764
- }
765
- return {
766
- criteriaMode: t,
767
- names: [...e],
768
- fields: o,
769
- shouldUseNativeValidation: s
770
- };
771
- }, Ie = (e) => e instanceof RegExp, Ne = (e) => T(e) ? e : Ie(e) ? e.source : I(e) ? Ie(e.value) ? e.value.source : e.value : e, pt = (e) => ({
772
- isOnSubmit: !e || e === ee.onSubmit,
773
- isOnBlur: e === ee.onBlur,
774
- isOnChange: e === ee.onChange,
775
- isOnAll: e === ee.all,
776
- isOnTouch: e === ee.onTouched
777
- });
778
- const yt = "AsyncFunction";
779
- var vr = (e) => !!e && !!e.validate && !!(te(e.validate) && e.validate.constructor.name === yt || I(e.validate) && Object.values(e.validate).find((a) => a.constructor.name === yt)), xr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), bt = (e, a, t) => !t && (a.watchAll || a.watch.has(e) || [...a.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
780
- const Fe = (e, a, t, s) => {
781
- for (const o of t || Object.keys(e)) {
782
- const n = g(e, o);
783
- if (n) {
784
- const { _f: u, ...b } = n;
785
- if (u) {
786
- if (u.refs && u.refs[0] && a(u.refs[0], o) && !s)
787
- return !0;
788
- if (u.ref && a(u.ref, u.name) && !s)
789
- return !0;
790
- if (Fe(b, a))
791
- break;
792
- } else if (I(b) && Fe(b, a))
793
- break;
794
- }
795
- }
796
- };
797
- function ht(e, a, t) {
798
- const s = g(e, t);
799
- if (s || Je(t))
800
- return {
801
- error: s,
802
- name: t
803
- };
804
- const o = t.split(".");
805
- for (; o.length; ) {
806
- const n = o.join("."), u = g(a, n), b = g(e, n);
807
- if (u && !Array.isArray(u) && t !== n)
808
- return { name: t };
809
- if (b && b.type)
810
- return {
811
- name: n,
812
- error: b
813
- };
814
- o.pop();
815
- }
816
- return {
817
- name: t
818
- };
819
- }
820
- var wr = (e, a, t, s) => {
821
- t(e);
822
- const { name: o, ...n } = e;
823
- return q(n) || Object.keys(n).length >= Object.keys(a).length || Object.keys(n).find((u) => a[u] === (!s || ee.all));
824
- }, Nr = (e, a, t) => !e || !a || e === a || _e(e).some((s) => s && (t ? s === a : s.startsWith(a) || a.startsWith(s))), _r = (e, a, t, s, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(a || e) : (t ? s.isOnBlur : o.isOnBlur) ? !e : (t ? s.isOnChange : o.isOnChange) ? e : !0, Fr = (e, a) => !Pe(g(e, a)).length && M(e, a), Cr = (e, a, t) => {
825
- const s = _e(g(e, t));
826
- return D(s, "root", a[t]), D(e, t, s), e;
827
- }, Ve = (e) => se(e);
828
- function vt(e, a, t = "validate") {
829
- if (Ve(e) || Array.isArray(e) && e.every(Ve) || J(e) && !e)
830
- return {
831
- type: t,
832
- message: Ve(e) ? e : "",
833
- ref: a
834
- };
835
- }
836
- var pe = (e) => I(e) && !Ie(e) ? e : {
837
- value: e,
838
- message: ""
839
- }, xt = async (e, a, t, s, o, n) => {
840
- const { ref: u, refs: b, required: _, maxLength: P, minLength: C, min: V, max: x, pattern: de, validate: X, name: O, valueAsNumber: H, mount: j } = e._f, v = g(t, O);
841
- if (!j || a.has(O))
842
- return {};
843
- const Z = b ? b[0] : u, K = (k) => {
844
- o && Z.reportValidity && (Z.setCustomValidity(J(k) ? "" : k || ""), Z.reportValidity());
845
- }, L = {}, he = Qe(u), ve = De(u), Oe = he || ve, ae = (H || Ye(u)) && T(u.value) && T(v) || Se(u) && u.value === "" || v === "" || Array.isArray(v) && !v.length, ce = gr.bind(null, O, s, L), oe = (k, w, S, W = ie.maxLength, Q = ie.minLength) => {
846
- const re = k ? w : S;
847
- L[O] = {
848
- type: k ? W : Q,
849
- message: re,
850
- ref: u,
851
- ...ce(k ? W : Q, re)
852
- };
853
- };
854
- if (n ? !Array.isArray(v) || !v.length : _ && (!Oe && (ae || $(v)) || J(v) && !v || ve && !Bt(b).isValid || he && !jt(b).isValid)) {
855
- const { value: k, message: w } = Ve(_) ? { value: !!_, message: _ } : pe(_);
856
- if (k && (L[O] = {
857
- type: ie.required,
858
- message: w,
859
- ref: Z,
860
- ...ce(ie.required, w)
861
- }, !s))
862
- return K(w), L;
863
- }
864
- if (!ae && (!$(V) || !$(x))) {
865
- let k, w;
866
- const S = pe(x), W = pe(V);
867
- if (!$(v) && !isNaN(v)) {
868
- const Q = u.valueAsNumber || v && +v;
869
- $(S.value) || (k = Q > S.value), $(W.value) || (w = Q < W.value);
870
- } else {
871
- const Q = u.valueAsDate || new Date(v), re = (Ae) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Ae), ne = u.type == "time", xe = u.type == "week";
872
- se(S.value) && v && (k = ne ? re(v) > re(S.value) : xe ? v > S.value : Q > new Date(S.value)), se(W.value) && v && (w = ne ? re(v) < re(W.value) : xe ? v < W.value : Q < new Date(W.value));
873
- }
874
- if ((k || w) && (oe(!!k, S.message, W.message, ie.max, ie.min), !s))
875
- return K(L[O].message), L;
876
- }
877
- if ((P || C) && !ae && (se(v) || n && Array.isArray(v))) {
878
- const k = pe(P), w = pe(C), S = !$(k.value) && v.length > +k.value, W = !$(w.value) && v.length < +w.value;
879
- if ((S || W) && (oe(S, k.message, w.message), !s))
880
- return K(L[O].message), L;
881
- }
882
- if (de && !ae && se(v)) {
883
- const { value: k, message: w } = pe(de);
884
- if (Ie(k) && !v.match(k) && (L[O] = {
885
- type: ie.pattern,
886
- message: w,
887
- ref: u,
888
- ...ce(ie.pattern, w)
889
- }, !s))
890
- return K(w), L;
891
- }
892
- if (X) {
893
- if (te(X)) {
894
- const k = await X(v, t), w = vt(k, Z);
895
- if (w && (L[O] = {
896
- ...w,
897
- ...ce(ie.validate, w.message)
898
- }, !s))
899
- return K(w.message), L;
900
- } else if (I(X)) {
901
- let k = {};
902
- for (const w in X) {
903
- if (!q(k) && !s)
904
- break;
905
- const S = vt(await X[w](v, t), Z, w);
906
- S && (k = {
907
- ...S,
908
- ...ce(w, S.message)
909
- }, K(S.message), s && (L[O] = k));
910
- }
911
- if (!q(k) && (L[O] = {
912
- ref: Z,
913
- ...k
914
- }, !s))
915
- return L;
916
- }
917
- }
918
- return K(!0), L;
919
- };
920
- const kr = {
921
- mode: ee.onSubmit,
922
- reValidateMode: ee.onChange,
923
- shouldFocusError: !0
924
- };
925
- function Dr(e = {}) {
926
- let a = {
927
- ...kr,
928
- ...e
929
- }, t = {
930
- submitCount: 0,
931
- isDirty: !1,
932
- isLoading: te(a.defaultValues),
933
- isValidating: !1,
934
- isSubmitted: !1,
935
- isSubmitting: !1,
936
- isSubmitSuccessful: !1,
937
- isValid: !1,
938
- touchedFields: {},
939
- dirtyFields: {},
940
- validatingFields: {},
941
- errors: a.errors || {},
942
- disabled: a.disabled || !1
943
- };
944
- const s = {};
945
- let o = I(a.defaultValues) || I(a.values) ? z(a.values || a.defaultValues) || {} : {}, n = a.shouldUnregister ? {} : z(o), u = {
946
- action: !1,
947
- mount: !1,
948
- watch: !1
949
- }, b = {
950
- mount: /* @__PURE__ */ new Set(),
951
- disabled: /* @__PURE__ */ new Set(),
952
- unMount: /* @__PURE__ */ new Set(),
953
- array: /* @__PURE__ */ new Set(),
954
- watch: /* @__PURE__ */ new Set()
955
- }, _, P = 0;
956
- const C = {
957
- isDirty: !1,
958
- dirtyFields: !1,
959
- validatingFields: !1,
960
- touchedFields: !1,
961
- isValidating: !1,
962
- isValid: !1,
963
- errors: !1
964
- };
965
- let V = {
966
- ...C
967
- };
968
- const x = {
969
- array: ct(),
970
- state: ct()
971
- }, de = pt(a.mode), X = pt(a.reValidateMode), O = a.criteriaMode === ee.all, H = (r) => (i) => {
972
- clearTimeout(P), P = setTimeout(r, i);
973
- }, j = async (r) => {
974
- if (!a.disabled && (C.isValid || V.isValid || r)) {
975
- const i = a.resolver ? q((await ae()).errors) : await oe(s, !0);
976
- i !== t.isValid && x.state.next({
977
- isValid: i
978
- });
979
- }
980
- }, v = (r, i) => {
981
- !a.disabled && (C.isValidating || C.validatingFields || V.isValidating || V.validatingFields) && ((r || Array.from(b.mount)).forEach((l) => {
982
- l && (i ? D(t.validatingFields, l, i) : M(t.validatingFields, l));
983
- }), x.state.next({
984
- validatingFields: t.validatingFields,
985
- isValidating: !q(t.validatingFields)
986
- }));
987
- }, Z = (r, i = [], l, p, f = !0, c = !0) => {
988
- if (p && l && !a.disabled) {
989
- if (u.action = !0, c && Array.isArray(g(s, r))) {
990
- const h = l(g(s, r), p.argA, p.argB);
991
- f && D(s, r, h);
992
- }
993
- if (c && Array.isArray(g(t.errors, r))) {
994
- const h = l(g(t.errors, r), p.argA, p.argB);
995
- f && D(t.errors, r, h), Fr(t.errors, r);
996
- }
997
- if ((C.touchedFields || V.touchedFields) && c && Array.isArray(g(t.touchedFields, r))) {
998
- const h = l(g(t.touchedFields, r), p.argA, p.argB);
999
- f && D(t.touchedFields, r, h);
1000
- }
1001
- (C.dirtyFields || V.dirtyFields) && (t.dirtyFields = we(o, n)), x.state.next({
1002
- name: r,
1003
- isDirty: w(r, i),
1004
- dirtyFields: t.dirtyFields,
1005
- errors: t.errors,
1006
- isValid: t.isValid
1007
- });
1008
- } else
1009
- D(n, r, i);
1010
- }, K = (r, i) => {
1011
- D(t.errors, r, i), x.state.next({
1012
- errors: t.errors
1013
- });
1014
- }, L = (r) => {
1015
- t.errors = r, x.state.next({
1016
- errors: t.errors,
1017
- isValid: !1
1018
- });
1019
- }, he = (r, i, l, p) => {
1020
- const f = g(s, r);
1021
- if (f) {
1022
- const c = g(n, r, T(l) ? g(o, r) : l);
1023
- T(c) || p && p.defaultChecked || i ? D(n, r, i ? c : gt(f._f)) : Q(r, c), u.mount && j();
1024
- }
1025
- }, ve = (r, i, l, p, f) => {
1026
- let c = !1, h = !1;
1027
- const F = {
1028
- name: r
1029
- };
1030
- if (!a.disabled) {
1031
- if (!l || p) {
1032
- (C.isDirty || V.isDirty) && (h = t.isDirty, t.isDirty = F.isDirty = w(), c = h !== F.isDirty);
1033
- const E = le(g(o, r), i);
1034
- h = !!g(t.dirtyFields, r), E ? M(t.dirtyFields, r) : D(t.dirtyFields, r, !0), F.dirtyFields = t.dirtyFields, c = c || (C.dirtyFields || V.dirtyFields) && h !== !E;
1035
- }
1036
- if (l) {
1037
- const E = g(t.touchedFields, r);
1038
- E || (D(t.touchedFields, r, l), F.touchedFields = t.touchedFields, c = c || (C.touchedFields || V.touchedFields) && E !== l);
1039
- }
1040
- c && f && x.state.next(F);
1041
- }
1042
- return c ? F : {};
1043
- }, Oe = (r, i, l, p) => {
1044
- const f = g(t.errors, r), c = (C.isValid || V.isValid) && J(i) && t.isValid !== i;
1045
- if (a.delayError && l ? (_ = H(() => K(r, l)), _(a.delayError)) : (clearTimeout(P), _ = null, l ? D(t.errors, r, l) : M(t.errors, r)), (l ? !le(f, l) : f) || !q(p) || c) {
1046
- const h = {
1047
- ...p,
1048
- ...c && J(i) ? { isValid: i } : {},
1049
- errors: t.errors,
1050
- name: r
1051
- };
1052
- t = {
1053
- ...t,
1054
- ...h
1055
- }, x.state.next(h);
1056
- }
1057
- }, ae = async (r) => {
1058
- v(r, !0);
1059
- const i = await a.resolver(n, a.context, hr(r || b.mount, s, a.criteriaMode, a.shouldUseNativeValidation));
1060
- return v(r), i;
1061
- }, ce = async (r) => {
1062
- const { errors: i } = await ae(r);
1063
- if (r)
1064
- for (const l of r) {
1065
- const p = g(i, l);
1066
- p ? D(t.errors, l, p) : M(t.errors, l);
1067
- }
1068
- else
1069
- t.errors = i;
1070
- return i;
1071
- }, oe = async (r, i, l = {
1072
- valid: !0
1073
- }) => {
1074
- for (const p in r) {
1075
- const f = r[p];
1076
- if (f) {
1077
- const { _f: c, ...h } = f;
1078
- if (c) {
1079
- const F = b.array.has(c.name), E = f._f && vr(f._f);
1080
- E && C.validatingFields && v([p], !0);
1081
- const U = await xt(f, b.disabled, n, O, a.shouldUseNativeValidation && !i, F);
1082
- if (E && C.validatingFields && v([p]), U[c.name] && (l.valid = !1, i))
1083
- break;
1084
- !i && (g(U, c.name) ? F ? Cr(t.errors, U, c.name) : D(t.errors, c.name, U[c.name]) : M(t.errors, c.name));
1085
- }
1086
- !q(h) && await oe(h, i, l);
1087
- }
1088
- }
1089
- return l.valid;
1090
- }, k = () => {
1091
- for (const r of b.unMount) {
1092
- const i = g(s, r);
1093
- i && (i._f.refs ? i._f.refs.every((l) => !qe(l)) : !qe(i._f.ref)) && Ue(r);
1094
- }
1095
- b.unMount = /* @__PURE__ */ new Set();
1096
- }, w = (r, i) => !a.disabled && (r && i && D(n, r, i), !le(Xe(), o)), S = (r, i, l) => Lt(r, b, {
1097
- ...u.mount ? n : T(i) ? o : se(r) ? { [r]: i } : i
1098
- }, l, i), W = (r) => Pe(g(u.mount ? n : o, r, a.shouldUnregister ? g(o, r, []) : [])), Q = (r, i, l = {}) => {
1099
- const p = g(s, r);
1100
- let f = i;
1101
- if (p) {
1102
- const c = p._f;
1103
- c && (!c.disabled && D(n, r, Ht(i, c)), f = Se(c.ref) && $(i) ? "" : i, Ot(c.ref) ? [...c.ref.options].forEach((h) => h.selected = f.includes(h.value)) : c.refs ? De(c.ref) ? c.refs.length > 1 ? c.refs.forEach((h) => (!h.defaultChecked || !h.disabled) && (h.checked = Array.isArray(f) ? !!f.find((F) => F === h.value) : f === h.value)) : c.refs[0] && (c.refs[0].checked = !!f) : c.refs.forEach((h) => h.checked = h.value === f) : Ye(c.ref) ? c.ref.value = "" : (c.ref.value = f, c.ref.type || x.state.next({
1104
- name: r,
1105
- values: z(n)
1106
- })));
1107
- }
1108
- (l.shouldDirty || l.shouldTouch) && ve(r, f, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && ze(r);
1109
- }, re = (r, i, l) => {
1110
- for (const p in i) {
1111
- const f = i[p], c = `${r}.${p}`, h = g(s, c);
1112
- (b.array.has(r) || I(f) || h && !h._f) && !ue(f) ? re(c, f, l) : Q(c, f, l);
1113
- }
1114
- }, ne = (r, i, l = {}) => {
1115
- const p = g(s, r), f = b.array.has(r), c = z(i);
1116
- D(n, r, c), f ? (x.array.next({
1117
- name: r,
1118
- values: z(n)
1119
- }), (C.isDirty || C.dirtyFields || V.isDirty || V.dirtyFields) && l.shouldDirty && x.state.next({
1120
- name: r,
1121
- dirtyFields: we(o, n),
1122
- isDirty: w(r, c)
1123
- })) : p && !p._f && !$(c) ? re(r, c, l) : Q(r, c, l), bt(r, b) && x.state.next({ ...t }), x.state.next({
1124
- name: u.mount ? r : void 0,
1125
- values: z(n)
1126
- });
1127
- }, xe = async (r) => {
1128
- u.mount = !0;
1129
- const i = r.target;
1130
- let l = i.name, p = !0;
1131
- const f = g(s, l), c = (h) => {
1132
- p = Number.isNaN(h) || ue(h) && isNaN(h.getTime()) || le(h, g(n, l, h));
1133
- };
1134
- if (f) {
1135
- let h, F;
1136
- const E = i.type ? gt(f._f) : Tt(r), U = r.type === Re.BLUR || r.type === Re.FOCUS_OUT, ra = !xr(f._f) && !a.resolver && !g(t.errors, l) && !f._f.deps || _r(U, g(t.touchedFields, l), t.isSubmitted, X, de), He = bt(l, b, U);
1137
- D(n, l, E), U ? (f._f.onBlur && f._f.onBlur(r), _ && _(0)) : f._f.onChange && f._f.onChange(r);
1138
- const je = ve(l, E, U), sa = !q(je) || He;
1139
- if (!U && x.state.next({
1140
- name: l,
1141
- type: r.type,
1142
- values: z(n)
1143
- }), ra)
1144
- return (C.isValid || V.isValid) && (a.mode === "onBlur" ? U && j() : U || j()), sa && x.state.next({ name: l, ...He ? {} : je });
1145
- if (!U && He && x.state.next({ ...t }), a.resolver) {
1146
- const { errors: lt } = await ae([l]);
1147
- if (c(E), p) {
1148
- const oa = ht(t.errors, s, l), dt = ht(lt, s, oa.name || l);
1149
- h = dt.error, l = dt.name, F = q(lt);
1150
- }
1151
- } else
1152
- v([l], !0), h = (await xt(f, b.disabled, n, O, a.shouldUseNativeValidation))[l], v([l]), c(E), p && (h ? F = !1 : (C.isValid || V.isValid) && (F = await oe(s, !0)));
1153
- p && (f._f.deps && ze(f._f.deps), Oe(l, F, h, je));
1154
- }
1155
- }, Ae = (r, i) => {
1156
- if (g(t.errors, i) && r.focus)
1157
- return r.focus(), 1;
1158
- }, ze = async (r, i = {}) => {
1159
- let l, p;
1160
- const f = _e(r);
1161
- if (a.resolver) {
1162
- const c = await ce(T(r) ? r : f);
1163
- l = q(c), p = r ? !f.some((h) => g(c, h)) : l;
1164
- } else r ? (p = (await Promise.all(f.map(async (c) => {
1165
- const h = g(s, c);
1166
- return await oe(h && h._f ? { [c]: h } : h);
1167
- }))).every(Boolean), !(!p && !t.isValid) && j()) : p = l = await oe(s);
1168
- return x.state.next({
1169
- ...!se(r) || (C.isValid || V.isValid) && l !== t.isValid ? {} : { name: r },
1170
- ...a.resolver || !r ? { isValid: l } : {},
1171
- errors: t.errors
1172
- }), i.shouldFocus && !p && Fe(s, Ae, r ? f : b.mount), p;
1173
- }, Xe = (r) => {
1174
- const i = {
1175
- ...u.mount ? n : o
1176
- };
1177
- return T(r) ? i : se(r) ? g(i, r) : r.map((l) => g(i, l));
1178
- }, Ze = (r, i) => ({
1179
- invalid: !!g((i || t).errors, r),
1180
- isDirty: !!g((i || t).dirtyFields, r),
1181
- error: g((i || t).errors, r),
1182
- isValidating: !!g(t.validatingFields, r),
1183
- isTouched: !!g((i || t).touchedFields, r)
1184
- }), Yt = (r) => {
1185
- r && _e(r).forEach((i) => M(t.errors, i)), x.state.next({
1186
- errors: r ? t.errors : {}
1187
- });
1188
- }, et = (r, i, l) => {
1189
- const p = (g(s, r, { _f: {} })._f || {}).ref, f = g(t.errors, r) || {}, { ref: c, message: h, type: F, ...E } = f;
1190
- D(t.errors, r, {
1191
- ...E,
1192
- ...i,
1193
- ref: p
1194
- }), x.state.next({
1195
- name: r,
1196
- errors: t.errors,
1197
- isValid: !1
1198
- }), l && l.shouldFocus && p && p.focus && p.focus();
1199
- }, Qt = (r, i) => te(r) ? x.state.subscribe({
1200
- next: (l) => r(S(void 0, i), l)
1201
- }) : S(r, i, !0), tt = (r) => x.state.subscribe({
1202
- next: (i) => {
1203
- Nr(r.name, i.name, r.exact) && wr(i, r.formState || C, aa, r.reRenderRoot) && r.callback({
1204
- values: { ...n },
1205
- ...t,
1206
- ...i
1207
- });
1208
- }
1209
- }).unsubscribe, Xt = (r) => (u.mount = !0, V = {
1210
- ...V,
1211
- ...r.formState
1212
- }, tt({
1213
- ...r,
1214
- formState: V
1215
- })), Ue = (r, i = {}) => {
1216
- for (const l of r ? _e(r) : b.mount)
1217
- b.mount.delete(l), b.array.delete(l), i.keepValue || (M(s, l), M(n, l)), !i.keepError && M(t.errors, l), !i.keepDirty && M(t.dirtyFields, l), !i.keepTouched && M(t.touchedFields, l), !i.keepIsValidating && M(t.validatingFields, l), !a.shouldUnregister && !i.keepDefaultValue && M(o, l);
1218
- x.state.next({
1219
- values: z(n)
1220
- }), x.state.next({
1221
- ...t,
1222
- ...i.keepDirty ? { isDirty: w() } : {}
1223
- }), !i.keepIsValid && j();
1224
- }, at = ({ disabled: r, name: i }) => {
1225
- (J(r) && u.mount || r || b.disabled.has(i)) && (r ? b.disabled.add(i) : b.disabled.delete(i));
1226
- }, Be = (r, i = {}) => {
1227
- let l = g(s, r);
1228
- const p = J(i.disabled) || J(a.disabled);
1229
- return D(s, r, {
1230
- ...l || {},
1231
- _f: {
1232
- ...l && l._f ? l._f : { ref: { name: r } },
1233
- name: r,
1234
- mount: !0,
1235
- ...i
1236
- }
1237
- }), b.mount.add(r), l ? at({
1238
- disabled: J(i.disabled) ? i.disabled : a.disabled,
1239
- name: r
1240
- }) : he(r, !0, i.value), {
1241
- ...p ? { disabled: i.disabled || a.disabled } : {},
1242
- ...a.progressive ? {
1243
- required: !!i.required,
1244
- min: Ne(i.min),
1245
- max: Ne(i.max),
1246
- minLength: Ne(i.minLength),
1247
- maxLength: Ne(i.maxLength),
1248
- pattern: Ne(i.pattern)
1249
- } : {},
1250
- name: r,
1251
- onChange: xe,
1252
- onBlur: xe,
1253
- ref: (f) => {
1254
- if (f) {
1255
- Be(r, i), l = g(s, r);
1256
- const c = T(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, h = pr(c), F = l._f.refs || [];
1257
- if (h ? F.find((E) => E === c) : c === l._f.ref)
1258
- return;
1259
- D(s, r, {
1260
- _f: {
1261
- ...l._f,
1262
- ...h ? {
1263
- refs: [
1264
- ...F.filter(qe),
1265
- c,
1266
- ...Array.isArray(g(o, r)) ? [{}] : []
1267
- ],
1268
- ref: { type: c.type, name: r }
1269
- } : { ref: c }
1270
- }
1271
- }), he(r, !1, void 0, c);
1272
- } else
1273
- l = g(s, r, {}), l._f && (l._f.mount = !1), (a.shouldUnregister || i.shouldUnregister) && !(It(b.array, r) && u.action) && b.unMount.add(r);
1274
- }
1275
- };
1276
- }, rt = () => a.shouldFocusError && Fe(s, Ae, b.mount), Zt = (r) => {
1277
- J(r) && (x.state.next({ disabled: r }), Fe(s, (i, l) => {
1278
- const p = g(s, l);
1279
- p && (i.disabled = p._f.disabled || r, Array.isArray(p._f.refs) && p._f.refs.forEach((f) => {
1280
- f.disabled = p._f.disabled || r;
1281
- }));
1282
- }, 0, !1));
1283
- }, st = (r, i) => async (l) => {
1284
- let p;
1285
- l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
1286
- let f = z(n);
1287
- if (x.state.next({
1288
- isSubmitting: !0
1289
- }), a.resolver) {
1290
- const { errors: c, values: h } = await ae();
1291
- t.errors = c, f = h;
1292
- } else
1293
- await oe(s);
1294
- if (b.disabled.size)
1295
- for (const c of b.disabled)
1296
- D(f, c, void 0);
1297
- if (M(t.errors, "root"), q(t.errors)) {
1298
- x.state.next({
1299
- errors: {}
1300
- });
1301
- try {
1302
- await r(f, l);
1303
- } catch (c) {
1304
- p = c;
1305
- }
1306
- } else
1307
- i && await i({ ...t.errors }, l), rt(), setTimeout(rt);
1308
- if (x.state.next({
1309
- isSubmitted: !0,
1310
- isSubmitting: !1,
1311
- isSubmitSuccessful: q(t.errors) && !p,
1312
- submitCount: t.submitCount + 1,
1313
- errors: t.errors
1314
- }), p)
1315
- throw p;
1316
- }, ea = (r, i = {}) => {
1317
- g(s, r) && (T(i.defaultValue) ? ne(r, z(g(o, r))) : (ne(r, i.defaultValue), D(o, r, z(i.defaultValue))), i.keepTouched || M(t.touchedFields, r), i.keepDirty || (M(t.dirtyFields, r), t.isDirty = i.defaultValue ? w(r, z(g(o, r))) : w()), i.keepError || (M(t.errors, r), C.isValid && j()), x.state.next({ ...t }));
1318
- }, ot = (r, i = {}) => {
1319
- const l = r ? z(r) : o, p = z(l), f = q(r), c = f ? o : p;
1320
- if (i.keepDefaultValues || (o = l), !i.keepValues) {
1321
- if (i.keepDirtyValues) {
1322
- const h = /* @__PURE__ */ new Set([
1323
- ...b.mount,
1324
- ...Object.keys(we(o, n))
1325
- ]);
1326
- for (const F of Array.from(h))
1327
- g(t.dirtyFields, F) ? D(c, F, g(n, F)) : ne(F, g(c, F));
1328
- } else {
1329
- if (Ke && T(r))
1330
- for (const h of b.mount) {
1331
- const F = g(s, h);
1332
- if (F && F._f) {
1333
- const E = Array.isArray(F._f.refs) ? F._f.refs[0] : F._f.ref;
1334
- if (Se(E)) {
1335
- const U = E.closest("form");
1336
- if (U) {
1337
- U.reset();
1338
- break;
1339
- }
1340
- }
1341
- }
1342
- }
1343
- for (const h of b.mount)
1344
- ne(h, g(c, h));
1345
- }
1346
- n = z(c), x.array.next({
1347
- values: { ...c }
1348
- }), x.state.next({
1349
- values: { ...c }
1350
- });
1351
- }
1352
- b = {
1353
- mount: i.keepDirtyValues ? b.mount : /* @__PURE__ */ new Set(),
1354
- unMount: /* @__PURE__ */ new Set(),
1355
- array: /* @__PURE__ */ new Set(),
1356
- disabled: /* @__PURE__ */ new Set(),
1357
- watch: /* @__PURE__ */ new Set(),
1358
- watchAll: !1,
1359
- focus: ""
1360
- }, u.mount = !C.isValid || !!i.keepIsValid || !!i.keepDirtyValues, u.watch = !!a.shouldUnregister, x.state.next({
1361
- submitCount: i.keepSubmitCount ? t.submitCount : 0,
1362
- isDirty: f ? !1 : i.keepDirty ? t.isDirty : !!(i.keepDefaultValues && !le(r, o)),
1363
- isSubmitted: i.keepIsSubmitted ? t.isSubmitted : !1,
1364
- dirtyFields: f ? {} : i.keepDirtyValues ? i.keepDefaultValues && n ? we(o, n) : t.dirtyFields : i.keepDefaultValues && r ? we(o, r) : i.keepDirty ? t.dirtyFields : {},
1365
- touchedFields: i.keepTouched ? t.touchedFields : {},
1366
- errors: i.keepErrors ? t.errors : {},
1367
- isSubmitSuccessful: i.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
1368
- isSubmitting: !1
1369
- });
1370
- }, it = (r, i) => ot(te(r) ? r(n) : r, i), ta = (r, i = {}) => {
1371
- const l = g(s, r), p = l && l._f;
1372
- if (p) {
1373
- const f = p.refs ? p.refs[0] : p.ref;
1374
- f.focus && (f.focus(), i.shouldSelect && te(f.select) && f.select());
1375
- }
1376
- }, aa = (r) => {
1377
- t = {
1378
- ...t,
1379
- ...r
1380
- };
1381
- }, nt = {
1382
- control: {
1383
- register: Be,
1384
- unregister: Ue,
1385
- getFieldState: Ze,
1386
- handleSubmit: st,
1387
- setError: et,
1388
- _subscribe: tt,
1389
- _runSchema: ae,
1390
- _getWatch: S,
1391
- _getDirty: w,
1392
- _setValid: j,
1393
- _setFieldArray: Z,
1394
- _setDisabledField: at,
1395
- _setErrors: L,
1396
- _getFieldArray: W,
1397
- _reset: ot,
1398
- _resetDefaultValues: () => te(a.defaultValues) && a.defaultValues().then((r) => {
1399
- it(r, a.resetOptions), x.state.next({
1400
- isLoading: !1
1401
- });
1402
- }),
1403
- _removeUnmounted: k,
1404
- _disableForm: Zt,
1405
- _subjects: x,
1406
- _proxyFormState: C,
1407
- get _fields() {
1408
- return s;
1409
- },
1410
- get _formValues() {
1411
- return n;
1412
- },
1413
- get _state() {
1414
- return u;
1415
- },
1416
- set _state(r) {
1417
- u = r;
1418
- },
1419
- get _defaultValues() {
1420
- return o;
1421
- },
1422
- get _names() {
1423
- return b;
1424
- },
1425
- set _names(r) {
1426
- b = r;
1427
- },
1428
- get _formState() {
1429
- return t;
1430
- },
1431
- get _options() {
1432
- return a;
1433
- },
1434
- set _options(r) {
1435
- a = {
1436
- ...a,
1437
- ...r
1438
- };
1439
- }
1440
- },
1441
- subscribe: Xt,
1442
- trigger: ze,
1443
- register: Be,
1444
- handleSubmit: st,
1445
- watch: Qt,
1446
- setValue: ne,
1447
- getValues: Xe,
1448
- reset: it,
1449
- resetField: ea,
1450
- clearErrors: Yt,
1451
- unregister: Ue,
1452
- setError: et,
1453
- setFocus: ta,
1454
- getFieldState: Ze
1455
- };
1456
- return {
1457
- ...nt,
1458
- formControl: nt
1459
- };
1460
- }
1461
- function xs(e = {}) {
1462
- const a = N.useRef(void 0), t = N.useRef(void 0), [s, o] = N.useState({
1463
- isDirty: !1,
1464
- isValidating: !1,
1465
- isLoading: te(e.defaultValues),
1466
- isSubmitted: !1,
1467
- isSubmitting: !1,
1468
- isSubmitSuccessful: !1,
1469
- isValid: !1,
1470
- submitCount: 0,
1471
- dirtyFields: {},
1472
- touchedFields: {},
1473
- validatingFields: {},
1474
- errors: e.errors || {},
1475
- disabled: e.disabled || !1,
1476
- defaultValues: te(e.defaultValues) ? void 0 : e.defaultValues
1477
- });
1478
- a.current || (a.current = {
1479
- ...e.formControl ? e.formControl : Dr(e),
1480
- formState: s
1481
- }, e.formControl && e.defaultValues && !te(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions));
1482
- const n = a.current.control;
1483
- return n._options = e, N.useLayoutEffect(() => n._subscribe({
1484
- formState: n._proxyFormState,
1485
- callback: () => o({ ...n._formState }),
1486
- reRenderRoot: !0
1487
- }), [n]), N.useEffect(() => n._disableForm(e.disabled), [n, e.disabled]), N.useEffect(() => {
1488
- if (n._proxyFormState.isDirty) {
1489
- const u = n._getDirty();
1490
- u !== s.isDirty && n._subjects.state.next({
1491
- isDirty: u
1492
- });
1493
- }
1494
- }, [n, s.isDirty]), N.useEffect(() => {
1495
- e.values && !le(e.values, t.current) ? (n._reset(e.values, n._options.resetOptions), t.current = e.values, o((u) => ({ ...u }))) : n._resetDefaultValues();
1496
- }, [e.values, n]), N.useEffect(() => {
1497
- e.errors && !q(e.errors) && n._setErrors(e.errors);
1498
- }, [e.errors, n]), N.useEffect(() => {
1499
- n._state.mount || (n._setValid(), n._state.mount = !0), n._state.watch && (n._state.watch = !1, n._subjects.state.next({ ...n._formState })), n._removeUnmounted();
1500
- }), N.useEffect(() => {
1501
- e.shouldUnregister && n._subjects.state.next({
1502
- values: n._getWatch()
1503
- });
1504
- }, [e.shouldUnregister, n]), a.current.formState = Mt(s, n), a.current;
1505
- }
1506
- const Ar = ke("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"), qt = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(_t.Root, { ref: t, className: m(Ar(), e), ...a }));
1507
- qt.displayName = _t.Root.displayName;
1508
- const ws = dr, $t = y.createContext({}), Ns = ({
1509
- ...e
1510
- }) => /* @__PURE__ */ d($t.Provider, { value: { name: e.name }, children: /* @__PURE__ */ d(mr, { ...e }) }), Le = () => {
1511
- const e = y.useContext($t), a = y.useContext(Wt), { getFieldState: t, formState: s } = Me(), o = t(e.name, s);
1512
- if (!e)
1513
- throw new Error("useFormField should be used within <FormField>");
1514
- const { id: n } = a;
1515
- return {
1516
- id: n,
1517
- name: e.name,
1518
- formItemId: `${n}-form-item`,
1519
- formDescriptionId: `${n}-form-item-description`,
1520
- formMessageId: `${n}-form-item-message`,
1521
- ...o
1522
- };
1523
- }, Wt = y.createContext({}), Vr = y.forwardRef(
1524
- ({ className: e, ...a }, t) => {
1525
- const s = y.useId();
1526
- return /* @__PURE__ */ d(Wt.Provider, { value: { id: s }, children: /* @__PURE__ */ d("div", { ref: t, className: m("space-y-2", e), ...a }) });
1527
- }
1528
- );
1529
- Vr.displayName = "FormItem";
1530
- const Rr = y.forwardRef(({ className: e, ...a }, t) => {
1531
- const { error: s, formItemId: o } = Le();
1532
- return /* @__PURE__ */ d(qt, { ref: t, className: m(s && "text-destructive", e), htmlFor: o, ...a });
1533
- });
1534
- Rr.displayName = "FormLabel";
1535
- const Sr = y.forwardRef(
1536
- ({ ...e }, a) => {
1537
- const { error: t, formItemId: s, formDescriptionId: o, formMessageId: n } = Le();
1538
- return /* @__PURE__ */ d(
1539
- Nt,
1540
- {
1541
- ref: a,
1542
- id: s,
1543
- "aria-describedby": t ? `${o} ${n}` : `${o}`,
1544
- "aria-invalid": !!t,
1545
- ...e
1546
- }
1547
- );
1548
- }
1549
- );
1550
- Sr.displayName = "FormControl";
1551
- const Tr = y.forwardRef(
1552
- ({ className: e, ...a }, t) => {
1553
- const { formDescriptionId: s } = Le();
1554
- return /* @__PURE__ */ d("p", { ref: t, id: s, className: m("text-sm text-muted-foreground", e), ...a });
1555
- }
1556
- );
1557
- Tr.displayName = "FormDescription";
1558
- const Ir = y.forwardRef(
1559
- ({ className: e, children: a, ...t }, s) => {
1560
- const { error: o, formMessageId: n } = Le(), u = o ? String(o == null ? void 0 : o.message) : a;
1561
- return u ? /* @__PURE__ */ d("p", { ref: s, id: n, className: m("text-sm font-medium text-destructive", e), ...t, children: u }) : null;
1562
- }
1563
- );
1564
- Ir.displayName = "FormMessage";
1565
- const _s = Ee.Root, Fs = Ee.Trigger, Er = y.forwardRef(({ className: e, align: a = "center", sideOffset: t = 4, ...s }, o) => /* @__PURE__ */ d(
1566
- Ee.Content,
1567
- {
1568
- ref: o,
1569
- align: a,
1570
- sideOffset: t,
1571
- className: m(
1572
- "z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",
1573
- e
1574
- ),
1575
- ...s
1576
- }
1577
- ));
1578
- Er.displayName = Ee.Content.displayName;
1579
- const Pr = y.forwardRef(({ className: e, type: a, ...t }, s) => /* @__PURE__ */ d(
1580
- "input",
1581
- {
1582
- type: a,
1583
- className: m(
1584
- "flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
1585
- e
1586
- ),
1587
- ref: s,
1588
- ...t,
1589
- autoCapitalize: "off",
1590
- autoCorrect: "off",
1591
- spellCheck: "false"
1592
- }
1593
- ));
1594
- Pr.displayName = "Input";
1595
- const Cs = Ce.Root, ks = Ce.Trigger, Mr = y.forwardRef(({ className: e, align: a = "center", sideOffset: t = 4, ...s }, o) => /* @__PURE__ */ d(Ce.Portal, { children: /* @__PURE__ */ d(
1596
- Ce.Content,
1597
- {
1598
- ref: o,
1599
- align: a,
1600
- sideOffset: t,
1601
- className: m(
1602
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",
1603
- e
1604
- ),
1605
- ...s
1606
- }
1607
- ) }));
1608
- Mr.displayName = Ce.Content.displayName;
1609
- const Lr = y.forwardRef(({ className: e, children: a, ...t }, s) => /* @__PURE__ */ Y(fe.Root, { ref: s, className: m("relative overflow-hidden", e), ...t, children: [
1610
- /* @__PURE__ */ d(fe.Viewport, { className: "h-full w-full rounded-[inherit]", children: a }),
1611
- /* @__PURE__ */ d(Gt, {}),
1612
- /* @__PURE__ */ d(fe.Corner, {})
1613
- ] }));
1614
- Lr.displayName = fe.Root.displayName;
1615
- const Gt = y.forwardRef(({ className: e, orientation: a = "vertical", ...t }, s) => /* @__PURE__ */ d(
1616
- fe.ScrollAreaScrollbar,
1617
- {
1618
- ref: s,
1619
- orientation: a,
1620
- className: m(
1621
- "flex touch-none select-none transition-colors",
1622
- a === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
1623
- a === "horizontal" && "h-2.5 border-t border-t-transparent p-[1px]",
1624
- e
1625
- ),
1626
- ...t,
1627
- children: /* @__PURE__ */ d(fe.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
1628
- }
1629
- ));
1630
- Gt.displayName = fe.ScrollAreaScrollbar.displayName;
1631
- const Or = y.forwardRef(({ className: e, orientation: a = "horizontal", decorative: t = !0, ...s }, o) => /* @__PURE__ */ d(
1632
- Ft.Root,
1633
- {
1634
- ref: o,
1635
- decorative: t,
1636
- orientation: a,
1637
- className: m("shrink-0 bg-border", a === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", e),
1638
- ...s
1639
- }
1640
- ));
1641
- Or.displayName = Ft.Root.displayName;
1642
- const Ds = A.Root, As = A.Trigger, Vs = A.Close, Kt = ({ className: e, ...a }) => /* @__PURE__ */ d(A.Portal, { className: m(e), ...a });
1643
- Kt.displayName = A.Portal.displayName;
1644
- const Jt = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
1645
- A.Overlay,
1646
- {
1647
- className: m(
1648
- "fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
1649
- e
1650
- ),
1651
- ...a,
1652
- ref: t
1653
- }
1654
- ));
1655
- Jt.displayName = A.Overlay.displayName;
1656
- const zr = ke(
1657
- "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
1658
- {
1659
- variants: {
1660
- side: {
1661
- top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
1662
- bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
1663
- left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
1664
- right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"
1665
- }
1666
- },
1667
- defaultVariants: {
1668
- side: "right"
1669
- }
1670
- }
1671
- ), Ur = y.forwardRef(
1672
- ({ side: e = "right", className: a, children: t, ...s }, o) => /* @__PURE__ */ Y(Kt, { children: [
1673
- /* @__PURE__ */ d(Jt, {}),
1674
- /* @__PURE__ */ Y(A.Content, { ref: o, className: m(zr({ side: e }), a), ...s, children: [
1675
- t,
1676
- /* @__PURE__ */ Y(A.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
1677
- /* @__PURE__ */ d(wt, { className: "h-4 w-4" }),
1678
- /* @__PURE__ */ d("span", { className: "sr-only", children: "Close" })
1679
- ] })
1680
- ] })
1681
- ] })
1682
- );
1683
- Ur.displayName = A.Content.displayName;
1684
- const Br = ({ className: e, ...a }) => /* @__PURE__ */ d("div", { className: m("flex flex-col space-y-2 text-center sm:text-left", e), ...a });
1685
- Br.displayName = "SheetHeader";
1686
- const Hr = ({ className: e, ...a }) => /* @__PURE__ */ d("div", { className: m("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e), ...a });
1687
- Hr.displayName = "SheetFooter";
1688
- const jr = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(A.Title, { ref: t, className: m("text-lg font-semibold text-foreground", e), ...a }));
1689
- jr.displayName = A.Title.displayName;
1690
- const qr = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(A.Description, { ref: t, className: m("text-sm text-muted-foreground", e), ...a }));
1691
- qr.displayName = A.Description.displayName;
1692
- const Rs = ({ className: e, ...a }) => /* @__PURE__ */ d("div", { className: m("animate-pulse rounded-md bg-primary/10", e), ...a }), Ss = ({ ...e }) => {
1693
- const { theme: a = "system" } = ua();
1694
- return /* @__PURE__ */ d(
1695
- fa,
1696
- {
1697
- theme: a,
1698
- className: "toaster group",
1699
- toastOptions: {
1700
- classNames: {
1701
- toast: "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
1702
- description: "group-[.toast]:text-muted-foreground",
1703
- actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
1704
- cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"
1705
- }
1706
- },
1707
- ...e
1708
- }
1709
- );
1710
- }, $r = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
1711
- $e.Root,
1712
- {
1713
- className: m(
1714
- "peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:focus-visible:ring-slate-800 dark:focus-visible:ring-offset-slate-950 dark:data-[state=checked]:bg-slate-50 dark:data-[state=unchecked]:bg-slate-800",
1715
- e
1716
- ),
1717
- ...a,
1718
- ref: t,
1719
- children: /* @__PURE__ */ d(
1720
- $e.Thumb,
1721
- {
1722
- className: m(
1723
- "pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 dark:bg-slate-950"
1724
- )
1725
- }
1726
- )
1727
- }
1728
- ));
1729
- $r.displayName = $e.Root.displayName;
1730
- const Ts = ge.Root, Wr = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
1731
- ge.List,
1732
- {
1733
- ref: t,
1734
- className: m(
1735
- "inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
1736
- e
1737
- ),
1738
- ...a
1739
- }
1740
- ));
1741
- Wr.displayName = ge.List.displayName;
1742
- const Gr = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
1743
- ge.Trigger,
1744
- {
1745
- ref: t,
1746
- className: m(
1747
- "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
1748
- e
1749
- ),
1750
- ...a
1751
- }
1752
- ));
1753
- Gr.displayName = ge.Trigger.displayName;
1754
- const Kr = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
1755
- ge.Content,
1756
- {
1757
- ref: t,
1758
- className: m(
1759
- "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1760
- e
1761
- ),
1762
- ...a
1763
- }
1764
- ));
1765
- Kr.displayName = ge.Content.displayName;
1766
- const Jr = y.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ d(
1767
- "textarea",
1768
- {
1769
- className: m(
1770
- "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
1771
- e
1772
- ),
1773
- ref: t,
1774
- ...a,
1775
- autoCapitalize: "off",
1776
- autoCorrect: "off",
1777
- spellCheck: "false"
1778
- }
1779
- ));
1780
- Jr.displayName = "Textarea";
1781
- const Is = be.Portal, Es = be.Provider, Ps = be.Root, Ms = be.Trigger, Yr = y.forwardRef(({ className: e, sideOffset: a = 4, ...t }, s) => /* @__PURE__ */ d(
1782
- be.Content,
1783
- {
1784
- ref: s,
1785
- sideOffset: a,
1786
- className: m(
1787
- "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",
1788
- e
1789
- ),
1790
- ...t
1791
- }
1792
- ));
1793
- Yr.displayName = be.Content.displayName;
1794
- export {
1795
- or as $,
1796
- ls as A,
1797
- Na as B,
1798
- Ea as C,
1799
- Oa as D,
1800
- Rt as E,
1801
- ms as F,
1802
- $a as G,
1803
- Wa as H,
1804
- Ga as I,
1805
- Ka as J,
1806
- Ya as K,
1807
- Qa as L,
1808
- Ja as M,
1809
- Ua as N,
1810
- fs as O,
1811
- Vt as P,
1812
- Ba as Q,
1813
- Ha as R,
1814
- ja as S,
1815
- qa as T,
1816
- gs as U,
1817
- ps as V,
1818
- er as W,
1819
- tr as X,
1820
- ar as Y,
1821
- rr as Z,
1822
- sr as _,
1823
- pa as a,
1824
- ir as a0,
1825
- ys as a1,
1826
- bs as a2,
1827
- hs as a3,
1828
- Za as a4,
1829
- Xa as a5,
1830
- vs as a6,
1831
- ws as a7,
1832
- Sr as a8,
1833
- Tr as a9,
1834
- $r as aA,
1835
- Ts as aB,
1836
- Wr as aC,
1837
- Gr as aD,
1838
- Kr as aE,
1839
- Jr as aF,
1840
- Ps as aG,
1841
- Ms as aH,
1842
- Yr as aI,
1843
- Es as aJ,
1844
- Is as aK,
1845
- g as aL,
1846
- D as aM,
1847
- gr as aN,
1848
- xs as aO,
1849
- Ns as aa,
1850
- Vr as ab,
1851
- Rr as ac,
1852
- Ir as ad,
1853
- Le as ae,
1854
- _s as af,
1855
- Fs as ag,
1856
- Er as ah,
1857
- Pr as ai,
1858
- qt as aj,
1859
- Cs as ak,
1860
- ks as al,
1861
- Mr as am,
1862
- Lr as an,
1863
- Gt as ao,
1864
- Or as ap,
1865
- Ds as aq,
1866
- As as ar,
1867
- Vs as as,
1868
- Ur as at,
1869
- Br as au,
1870
- Hr as av,
1871
- jr as aw,
1872
- qr as ax,
1873
- Rs as ay,
1874
- Ss as az,
1875
- ya as b,
1876
- m as c,
1877
- ba as d,
1878
- va as e,
1879
- xa as f,
1880
- wa as g,
1881
- ds as h,
1882
- cs as i,
1883
- _a as j,
1884
- Fa as k,
1885
- Ca as l,
1886
- ka as m,
1887
- Da as n,
1888
- Aa as o,
1889
- Va as p,
1890
- Ra as q,
1891
- Ta as r,
1892
- Sa as s,
1893
- us as t,
1894
- Ia as u,
1895
- Ge as v,
1896
- Pa as w,
1897
- za as x,
1898
- Ma as y,
1899
- La as z
1900
- };