@krak-stack/registry 0.1.0

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 (84) hide show
  1. package/README.md +29 -0
  2. package/dist/components/ui/alert-dialog.d.ts +18 -0
  3. package/dist/components/ui/app-brand.d.ts +26 -0
  4. package/dist/components/ui/app-brand.js +78 -0
  5. package/dist/components/ui/attachment.d.ts +23 -0
  6. package/dist/components/ui/badge.d.ts +7 -0
  7. package/dist/components/ui/button.d.ts +8 -0
  8. package/dist/components/ui/card.d.ts +11 -0
  9. package/dist/components/ui/checkbox.d.ts +3 -0
  10. package/dist/components/ui/code-block.d.ts +14 -0
  11. package/dist/components/ui/code-block.js +224 -0
  12. package/dist/components/ui/command.d.ts +18 -0
  13. package/dist/components/ui/copy-button.d.ts +18 -0
  14. package/dist/components/ui/copy-button.js +133 -0
  15. package/dist/components/ui/data-table.d.ts +264 -0
  16. package/dist/components/ui/data-table.js +3594 -0
  17. package/dist/components/ui/dialog.d.ts +13 -0
  18. package/dist/components/ui/dropdown-menu.d.ts +29 -0
  19. package/dist/components/ui/editing-locale-switcher.d.ts +7 -0
  20. package/dist/components/ui/editing-locale-switcher.js +626 -0
  21. package/dist/components/ui/effect-form.d.ts +137 -0
  22. package/dist/components/ui/effect-form.js +2330 -0
  23. package/dist/components/ui/field.d.ts +24 -0
  24. package/dist/components/ui/file-picker.d.ts +30 -0
  25. package/dist/components/ui/file-picker.js +811 -0
  26. package/dist/components/ui/form.d.ts +402 -0
  27. package/dist/components/ui/form.js +2245 -0
  28. package/dist/components/ui/google-map.d.ts +103 -0
  29. package/dist/components/ui/google-map.js +754 -0
  30. package/dist/components/ui/icon-input.d.ts +9 -0
  31. package/dist/components/ui/icon-input.js +971 -0
  32. package/dist/components/ui/input-group.d.ts +17 -0
  33. package/dist/components/ui/input.d.ts +3 -0
  34. package/dist/components/ui/label.d.ts +3 -0
  35. package/dist/components/ui/loading.d.ts +7 -0
  36. package/dist/components/ui/loading.js +467 -0
  37. package/dist/components/ui/locale-switcher.d.ts +7 -0
  38. package/dist/components/ui/locale-switcher.js +632 -0
  39. package/dist/components/ui/pagination.d.ts +43 -0
  40. package/dist/components/ui/pagination.js +787 -0
  41. package/dist/components/ui/popover.d.ts +9 -0
  42. package/dist/components/ui/scroll-area.d.ts +4 -0
  43. package/dist/components/ui/search-menu.d.ts +34 -0
  44. package/dist/components/ui/search-menu.js +839 -0
  45. package/dist/components/ui/select.d.ts +15 -0
  46. package/dist/components/ui/separator.d.ts +3 -0
  47. package/dist/components/ui/sheet.d.ts +14 -0
  48. package/dist/components/ui/sidebar-layout.d.ts +29 -0
  49. package/dist/components/ui/sidebar-layout.js +755 -0
  50. package/dist/components/ui/sidebar.d.ts +63 -0
  51. package/dist/components/ui/skeleton.d.ts +2 -0
  52. package/dist/components/ui/stats-card.d.ts +12 -0
  53. package/dist/components/ui/stats-card.js +125 -0
  54. package/dist/components/ui/table.d.ts +10 -0
  55. package/dist/components/ui/textarea.d.ts +3 -0
  56. package/dist/components/ui/theme-switcher.d.ts +29 -0
  57. package/dist/components/ui/theme-switcher.js +775 -0
  58. package/dist/components/ui/tooltip.d.ts +6 -0
  59. package/dist/components/ui/virtualized-combobox.d.ts +54 -0
  60. package/dist/components/ui/virtualized-combobox.js +821 -0
  61. package/dist/hooks/use-mobile.d.ts +1 -0
  62. package/dist/lib/query.d.ts +49 -0
  63. package/dist/lib/utils.d.ts +2 -0
  64. package/dist/paraglide/runtime.d.ts +978 -0
  65. package/dist/services/embedding.d.ts +2 -0
  66. package/dist/services/embedding.js +23 -0
  67. package/dist/services/notification/channels/index.d.ts +22 -0
  68. package/dist/services/notification/channels/index.js +11 -0
  69. package/dist/services/notification/channels/ses/index.d.ts +51 -0
  70. package/dist/services/notification/channels/ses/index.js +145 -0
  71. package/dist/services/notification/channels/ses/schema.d.ts +13 -0
  72. package/dist/services/notification/channels/ses/schema.js +35 -0
  73. package/dist/services/notification/index.d.ts +15 -0
  74. package/dist/services/notification/index.js +67 -0
  75. package/dist/services/notification/schema.d.ts +10 -0
  76. package/dist/services/notification/schema.js +30 -0
  77. package/dist/services/opentelemetry.d.ts +8 -0
  78. package/dist/services/opentelemetry.js +23 -0
  79. package/dist/services/s3/index.d.ts +62 -0
  80. package/dist/services/s3/index.js +208 -0
  81. package/dist/services/s3/schema.d.ts +18 -0
  82. package/dist/services/s3/schema.js +37 -0
  83. package/package.json +218 -0
  84. package/tailwind.css +1 -0
@@ -0,0 +1,2330 @@
1
+ // ../../src/components/ui/effect-form.tsx
2
+ import { useAtomSet, useAtomValue } from "@effect/atom-react";
3
+ import { Block } from "@tanstack/react-router";
4
+ import { Cause, Option, Schema } from "effect";
5
+ import { AsyncResult } from "effect/unstable/reactivity";
6
+ import { Languages, Loader2, Plus, Trash } from "lucide-react";
7
+
8
+ // ../../src/components/ui/alert-dialog.tsx
9
+ import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
10
+
11
+ // ../../src/lib/utils.ts
12
+ import { clsx } from "clsx";
13
+ import { twMerge } from "tailwind-merge";
14
+ function cn(...inputs) {
15
+ return twMerge(clsx(inputs));
16
+ }
17
+
18
+ // ../../src/components/ui/button.tsx
19
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
20
+ import { cva } from "class-variance-authority";
21
+ import { jsxDEV } from "react/jsx-dev-runtime";
22
+ var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
23
+ variants: {
24
+ variant: {
25
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
26
+ outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
27
+ secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
28
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
29
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
30
+ link: "text-primary underline-offset-4 hover:underline"
31
+ },
32
+ size: {
33
+ default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
34
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
35
+ sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
36
+ lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
37
+ icon: "size-9",
38
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
39
+ "icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
40
+ "icon-lg": "size-10"
41
+ }
42
+ },
43
+ defaultVariants: {
44
+ variant: "default",
45
+ size: "default"
46
+ }
47
+ });
48
+ function Button({
49
+ className,
50
+ variant = "default",
51
+ size = "default",
52
+ ...props
53
+ }) {
54
+ return /* @__PURE__ */ jsxDEV(ButtonPrimitive, {
55
+ "data-slot": "button",
56
+ className: cn(buttonVariants({ variant, size, className })),
57
+ ...props
58
+ }, undefined, false, undefined, this);
59
+ }
60
+
61
+ // ../../src/components/ui/alert-dialog.tsx
62
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
63
+ "use client";
64
+ function AlertDialog({ ...props }) {
65
+ return /* @__PURE__ */ jsxDEV2(AlertDialogPrimitive.Root, {
66
+ "data-slot": "alert-dialog",
67
+ ...props
68
+ }, undefined, false, undefined, this);
69
+ }
70
+ function AlertDialogPortal({ ...props }) {
71
+ return /* @__PURE__ */ jsxDEV2(AlertDialogPrimitive.Portal, {
72
+ "data-slot": "alert-dialog-portal",
73
+ ...props
74
+ }, undefined, false, undefined, this);
75
+ }
76
+ function AlertDialogOverlay({
77
+ className,
78
+ ...props
79
+ }) {
80
+ return /* @__PURE__ */ jsxDEV2(AlertDialogPrimitive.Backdrop, {
81
+ "data-slot": "alert-dialog-overlay",
82
+ className: cn("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className),
83
+ ...props
84
+ }, undefined, false, undefined, this);
85
+ }
86
+ function AlertDialogContent({
87
+ className,
88
+ size = "default",
89
+ ...props
90
+ }) {
91
+ return /* @__PURE__ */ jsxDEV2(AlertDialogPortal, {
92
+ children: [
93
+ /* @__PURE__ */ jsxDEV2(AlertDialogOverlay, {}, undefined, false, undefined, this),
94
+ /* @__PURE__ */ jsxDEV2(AlertDialogPrimitive.Popup, {
95
+ "data-slot": "alert-dialog-content",
96
+ "data-size": size,
97
+ className: cn("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
98
+ ...props
99
+ }, undefined, false, undefined, this)
100
+ ]
101
+ }, undefined, true, undefined, this);
102
+ }
103
+ function AlertDialogHeader({
104
+ className,
105
+ ...props
106
+ }) {
107
+ return /* @__PURE__ */ jsxDEV2("div", {
108
+ "data-slot": "alert-dialog-header",
109
+ className: cn("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]", className),
110
+ ...props
111
+ }, undefined, false, undefined, this);
112
+ }
113
+ function AlertDialogFooter({
114
+ className,
115
+ ...props
116
+ }) {
117
+ return /* @__PURE__ */ jsxDEV2("div", {
118
+ "data-slot": "alert-dialog-footer",
119
+ className: cn("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end", className),
120
+ ...props
121
+ }, undefined, false, undefined, this);
122
+ }
123
+ function AlertDialogTitle({
124
+ className,
125
+ ...props
126
+ }) {
127
+ return /* @__PURE__ */ jsxDEV2(AlertDialogPrimitive.Title, {
128
+ "data-slot": "alert-dialog-title",
129
+ className: cn("text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2", className),
130
+ ...props
131
+ }, undefined, false, undefined, this);
132
+ }
133
+ function AlertDialogDescription({
134
+ className,
135
+ ...props
136
+ }) {
137
+ return /* @__PURE__ */ jsxDEV2(AlertDialogPrimitive.Description, {
138
+ "data-slot": "alert-dialog-description",
139
+ className: cn("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className),
140
+ ...props
141
+ }, undefined, false, undefined, this);
142
+ }
143
+ function AlertDialogAction({
144
+ className,
145
+ ...props
146
+ }) {
147
+ return /* @__PURE__ */ jsxDEV2(Button, {
148
+ "data-slot": "alert-dialog-action",
149
+ className: cn(className),
150
+ ...props
151
+ }, undefined, false, undefined, this);
152
+ }
153
+ function AlertDialogCancel({
154
+ className,
155
+ variant = "outline",
156
+ size = "default",
157
+ ...props
158
+ }) {
159
+ return /* @__PURE__ */ jsxDEV2(AlertDialogPrimitive.Close, {
160
+ "data-slot": "alert-dialog-cancel",
161
+ className: cn(className),
162
+ render: /* @__PURE__ */ jsxDEV2(Button, {
163
+ variant,
164
+ size
165
+ }, undefined, false, undefined, this),
166
+ ...props
167
+ }, undefined, false, undefined, this);
168
+ }
169
+
170
+ // ../../src/components/ui/file-picker.tsx
171
+ import {
172
+ useEffect,
173
+ useMemo,
174
+ useRef,
175
+ useState
176
+ } from "react";
177
+ import { CloudUpload, FileIcon, FileUp, RefreshCw, Trash2 } from "lucide-react";
178
+
179
+ // ../../src/components/ui/attachment.tsx
180
+ import { mergeProps } from "@base-ui/react/merge-props";
181
+ import { useRender } from "@base-ui/react/use-render";
182
+ import { cva as cva2 } from "class-variance-authority";
183
+ import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
184
+ var attachmentVariants = cva2("group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed", {
185
+ variants: {
186
+ size: {
187
+ default: "gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2",
188
+ sm: "gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5",
189
+ xs: "gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1"
190
+ },
191
+ orientation: {
192
+ horizontal: "min-w-40 items-center",
193
+ vertical: "w-24 flex-col has-data-[slot=attachment-content]:w-30"
194
+ }
195
+ }
196
+ });
197
+ function Attachment({
198
+ className,
199
+ state = "done",
200
+ size = "default",
201
+ orientation = "horizontal",
202
+ ...props
203
+ }) {
204
+ return /* @__PURE__ */ jsxDEV3("div", {
205
+ "data-slot": "attachment",
206
+ "data-state": state,
207
+ "data-size": size,
208
+ "data-orientation": orientation,
209
+ className: cn(attachmentVariants({ size, orientation }), className),
210
+ ...props
211
+ }, undefined, false, undefined, this);
212
+ }
213
+ var attachmentMediaVariants = cva2("relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5", {
214
+ variants: {
215
+ variant: {
216
+ icon: "",
217
+ image: "opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover"
218
+ }
219
+ },
220
+ defaultVariants: {
221
+ variant: "icon"
222
+ }
223
+ });
224
+ function AttachmentMedia({
225
+ className,
226
+ variant = "icon",
227
+ ...props
228
+ }) {
229
+ return /* @__PURE__ */ jsxDEV3("div", {
230
+ "data-slot": "attachment-media",
231
+ "data-variant": variant,
232
+ className: cn(attachmentMediaVariants({ variant }), className),
233
+ ...props
234
+ }, undefined, false, undefined, this);
235
+ }
236
+ function AttachmentContent({
237
+ className,
238
+ ...props
239
+ }) {
240
+ return /* @__PURE__ */ jsxDEV3("div", {
241
+ "data-slot": "attachment-content",
242
+ className: cn("max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1", className),
243
+ ...props
244
+ }, undefined, false, undefined, this);
245
+ }
246
+ function AttachmentTitle({
247
+ className,
248
+ ...props
249
+ }) {
250
+ return /* @__PURE__ */ jsxDEV3("span", {
251
+ "data-slot": "attachment-title",
252
+ className: cn("block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer", className),
253
+ ...props
254
+ }, undefined, false, undefined, this);
255
+ }
256
+ function AttachmentDescription({
257
+ className,
258
+ ...props
259
+ }) {
260
+ return /* @__PURE__ */ jsxDEV3("span", {
261
+ "data-slot": "attachment-description",
262
+ className: cn("mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80", "max-w-full", className),
263
+ ...props
264
+ }, undefined, false, undefined, this);
265
+ }
266
+ function AttachmentActions({
267
+ className,
268
+ ...props
269
+ }) {
270
+ return /* @__PURE__ */ jsxDEV3("div", {
271
+ "data-slot": "attachment-actions",
272
+ className: cn("relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1", className),
273
+ ...props
274
+ }, undefined, false, undefined, this);
275
+ }
276
+ function AttachmentAction({
277
+ className,
278
+ variant,
279
+ size = "icon-xs",
280
+ ...props
281
+ }) {
282
+ return /* @__PURE__ */ jsxDEV3(Button, {
283
+ "data-slot": "attachment-action",
284
+ variant: variant ?? "ghost",
285
+ size,
286
+ className: cn(className),
287
+ ...props
288
+ }, undefined, false, undefined, this);
289
+ }
290
+
291
+ // ../../src/components/ui/input.tsx
292
+ import { Input as InputPrimitive } from "@base-ui/react/input";
293
+ import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
294
+ function Input({ className, type, ...props }) {
295
+ return /* @__PURE__ */ jsxDEV4(InputPrimitive, {
296
+ type,
297
+ "data-slot": "input",
298
+ className: cn("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
299
+ ...props
300
+ }, undefined, false, undefined, this);
301
+ }
302
+
303
+ // ../../src/paraglide/runtime.js
304
+ import"@inlang/paraglide-js/urlpattern-polyfill";
305
+ var baseLocale = "en";
306
+ var locales = ["en", "fr"];
307
+ var cookieName = "locale";
308
+ var cookieMaxAge = 34560000;
309
+ var cookieDomain = "";
310
+ var localStorageKey = "PARAGLIDE_LOCALE";
311
+ var strategy = [
312
+ "url",
313
+ "cookie",
314
+ "preferredLanguage",
315
+ "baseLocale"
316
+ ];
317
+ var routeStrategies = [
318
+ {
319
+ match: "/api/:path(.*)?",
320
+ exclude: true
321
+ }
322
+ ];
323
+ var urlPatterns = [
324
+ {
325
+ pattern: "/:path(.*)?",
326
+ localized: [
327
+ [
328
+ "en",
329
+ "/en/:path(.*)?"
330
+ ],
331
+ [
332
+ "fr",
333
+ "/fr/:path(.*)?"
334
+ ]
335
+ ]
336
+ }
337
+ ];
338
+ var cachedRouteStrategyUrl;
339
+ var cachedRouteStrategy;
340
+ function findMatchingRouteStrategy(url) {
341
+ if (routeStrategies.length === 0) {
342
+ return;
343
+ }
344
+ const urlString = typeof url === "string" ? url : url.href;
345
+ if (cachedRouteStrategyUrl === urlString) {
346
+ return cachedRouteStrategy;
347
+ }
348
+ const urlObject = new URL(urlString, "http://dummy.com");
349
+ let match;
350
+ for (const routeStrategy of routeStrategies) {
351
+ const pattern = new URLPattern(routeStrategy.match, urlObject.href);
352
+ if (pattern.exec(urlObject.href)) {
353
+ match = routeStrategy;
354
+ break;
355
+ }
356
+ }
357
+ cachedRouteStrategyUrl = urlString;
358
+ cachedRouteStrategy = match;
359
+ return match;
360
+ }
361
+ function getStrategyForUrl(url) {
362
+ const routeStrategy = findMatchingRouteStrategy(url);
363
+ if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
364
+ return routeStrategy.strategy;
365
+ }
366
+ return strategy;
367
+ }
368
+ var serverAsyncLocalStorage = undefined;
369
+ var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
370
+ var experimentalStaticLocale = undefined;
371
+ var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
372
+ var TREE_SHAKE_URL_STRATEGY_USED = true;
373
+ var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
374
+ var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
375
+ var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
376
+ var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
377
+ globalThis.__paraglide = globalThis.__paraglide ?? {};
378
+ globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
379
+ var _locale;
380
+ var localeInitiallySet = false;
381
+ var getLocale = () => {
382
+ if (experimentalStaticLocale !== undefined) {
383
+ return experimentalStaticLocale;
384
+ }
385
+ if (serverAsyncLocalStorage) {
386
+ const locale = serverAsyncLocalStorage?.getStore()?.locale;
387
+ if (locale) {
388
+ return locale;
389
+ }
390
+ }
391
+ let strategyToUse = strategy;
392
+ if (!isServer && typeof window !== "undefined" && window.location?.href) {
393
+ strategyToUse = getStrategyForUrl(window.location.href);
394
+ }
395
+ const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
396
+ if (resolved) {
397
+ if (!localeInitiallySet) {
398
+ _locale = resolved;
399
+ localeInitiallySet = true;
400
+ setLocale(resolved, { reload: false });
401
+ }
402
+ return resolved;
403
+ }
404
+ throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
405
+ };
406
+ function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
407
+ let locale;
408
+ for (const strat of strategyToUse) {
409
+ if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
410
+ locale = extractLocaleFromCookie();
411
+ } else if (strat === "baseLocale") {
412
+ locale = baseLocale;
413
+ } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
414
+ locale = extractLocaleFromUrl(urlForUrlStrategy);
415
+ } else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
416
+ locale = _locale;
417
+ } else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
418
+ locale = extractLocaleFromNavigator();
419
+ } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
420
+ locale = localStorage.getItem(localStorageKey) ?? undefined;
421
+ } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
422
+ const handler = customClientStrategies.get(strat);
423
+ if (handler) {
424
+ const result = handler.getLocale();
425
+ if (result instanceof Promise) {
426
+ continue;
427
+ }
428
+ if (result !== undefined) {
429
+ return assertIsLocale(result);
430
+ }
431
+ }
432
+ }
433
+ const matchedLocale = toLocale(locale);
434
+ if (matchedLocale) {
435
+ return matchedLocale;
436
+ }
437
+ }
438
+ return;
439
+ }
440
+ var rtlLanguages = new Set([
441
+ "ar",
442
+ "dv",
443
+ "fa",
444
+ "he",
445
+ "ks",
446
+ "ku",
447
+ "ps",
448
+ "sd",
449
+ "ug",
450
+ "ur",
451
+ "yi"
452
+ ]);
453
+ var navigateOrReload = (newLocation) => {
454
+ if (newLocation) {
455
+ window.location.href = newLocation;
456
+ } else {
457
+ window.location.reload();
458
+ }
459
+ };
460
+ var setLocale = (newLocale, options) => {
461
+ const optionsWithDefaults = {
462
+ reload: true,
463
+ ...options
464
+ };
465
+ let currentLocale;
466
+ try {
467
+ currentLocale = getLocale();
468
+ } catch {}
469
+ const customSetLocalePromises = [];
470
+ let newLocation = undefined;
471
+ let strategyToUse = strategy;
472
+ if (!isServer && typeof window !== "undefined" && window.location?.href) {
473
+ strategyToUse = getStrategyForUrl(window.location.href);
474
+ }
475
+ for (const strat of strategyToUse) {
476
+ if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
477
+ _locale = newLocale;
478
+ } else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
479
+ if (isServer || typeof document === "undefined" || typeof window === "undefined") {
480
+ continue;
481
+ }
482
+ const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
483
+ document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
484
+ } else if (strat === "baseLocale") {
485
+ continue;
486
+ } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
487
+ newLocation = localizeUrl(window.location.href, {
488
+ locale: newLocale
489
+ }).href;
490
+ } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
491
+ localStorage.setItem(localStorageKey, newLocale);
492
+ } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
493
+ const handler = customClientStrategies.get(strat);
494
+ if (handler) {
495
+ let result = handler.setLocale(newLocale);
496
+ if (result instanceof Promise) {
497
+ result = result.catch((error) => {
498
+ throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
499
+ cause: error
500
+ });
501
+ });
502
+ customSetLocalePromises.push(result);
503
+ }
504
+ }
505
+ }
506
+ }
507
+ const runReload = () => {
508
+ if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
509
+ navigateOrReload(newLocation);
510
+ }
511
+ };
512
+ if (customSetLocalePromises.length) {
513
+ return Promise.all(customSetLocalePromises).then(() => {
514
+ runReload();
515
+ });
516
+ }
517
+ runReload();
518
+ return;
519
+ };
520
+ var getUrlOrigin = () => {
521
+ if (serverAsyncLocalStorage) {
522
+ return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
523
+ } else if (typeof window !== "undefined") {
524
+ return window.location.origin;
525
+ }
526
+ return "http://fallback.com";
527
+ };
528
+ function toLocale(value) {
529
+ if (typeof value !== "string") {
530
+ return;
531
+ }
532
+ const lowerValue = value.toLowerCase();
533
+ for (const locale of locales) {
534
+ if (locale.toLowerCase() === lowerValue) {
535
+ return locale;
536
+ }
537
+ }
538
+ return;
539
+ }
540
+ function assertIsLocale(input) {
541
+ const locale = toLocale(input);
542
+ if (locale)
543
+ return locale;
544
+ throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
545
+ }
546
+ function extractLocaleFromCookie() {
547
+ if (typeof document === "undefined" || !document.cookie) {
548
+ return;
549
+ }
550
+ const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
551
+ const locale = match?.[2];
552
+ return toLocale(locale);
553
+ }
554
+ function extractLocaleFromNavigator() {
555
+ if (!navigator?.languages?.length) {
556
+ return;
557
+ }
558
+ const languages = navigator.languages.map((lang) => ({
559
+ fullTag: lang,
560
+ baseTag: lang.split("-")[0]
561
+ }));
562
+ for (const lang of languages) {
563
+ const fullLocale = toLocale(lang.fullTag);
564
+ if (fullLocale) {
565
+ return fullLocale;
566
+ }
567
+ const baseLocale2 = toLocale(lang.baseTag);
568
+ if (baseLocale2) {
569
+ return baseLocale2;
570
+ }
571
+ }
572
+ return;
573
+ }
574
+ var cachedUrl;
575
+ var cachedLocale;
576
+ function extractLocaleFromUrl(url) {
577
+ const urlString = typeof url === "string" ? url : url.href;
578
+ if (cachedUrl === urlString) {
579
+ return cachedLocale;
580
+ }
581
+ let result;
582
+ if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
583
+ result = defaultUrlPatternExtractLocale(url);
584
+ } else {
585
+ const urlObj = typeof url === "string" ? new URL(url) : url;
586
+ for (const element of urlPatterns) {
587
+ for (const [locale, localizedPattern] of element.localized) {
588
+ const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
589
+ if (match) {
590
+ result = locale;
591
+ break;
592
+ }
593
+ }
594
+ if (result)
595
+ break;
596
+ }
597
+ }
598
+ cachedUrl = urlString;
599
+ cachedLocale = result;
600
+ return result;
601
+ }
602
+ function defaultUrlPatternExtractLocale(url) {
603
+ const urlObj = new URL(url, "http://dummy.com");
604
+ const pathSegments = urlObj.pathname.split("/").filter(Boolean);
605
+ return toLocale(pathSegments[0]) || baseLocale;
606
+ }
607
+ function localizeUrl(url, options) {
608
+ const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
609
+ if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
610
+ return localizeUrlDefaultPattern(url, targetLocale);
611
+ }
612
+ const urlObj = typeof url === "string" ? new URL(url) : url;
613
+ for (const element of urlPatterns) {
614
+ for (const [, localizedPattern] of element.localized) {
615
+ const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
616
+ if (!match) {
617
+ continue;
618
+ }
619
+ const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
620
+ if (!targetPattern) {
621
+ continue;
622
+ }
623
+ const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
624
+ return fillMissingUrlParts(localizedUrl, match);
625
+ }
626
+ const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
627
+ if (unlocalizedMatch) {
628
+ const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
629
+ if (targetPattern) {
630
+ const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
631
+ return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
632
+ }
633
+ }
634
+ }
635
+ return urlObj;
636
+ }
637
+ function localizeUrlDefaultPattern(url, locale) {
638
+ const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
639
+ const currentLocale = extractLocaleFromUrl(urlObj);
640
+ if (currentLocale === locale) {
641
+ return urlObj;
642
+ }
643
+ const pathSegments = urlObj.pathname.split("/").filter(Boolean);
644
+ if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
645
+ pathSegments.shift();
646
+ }
647
+ if (locale === baseLocale) {
648
+ urlObj.pathname = "/" + pathSegments.join("/");
649
+ } else {
650
+ urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
651
+ }
652
+ return urlObj;
653
+ }
654
+ function fillMissingUrlParts(url, match) {
655
+ if (match.protocol.groups["0"]) {
656
+ url.protocol = match.protocol.groups["0"] ?? "";
657
+ }
658
+ if (match.hostname.groups["0"]) {
659
+ url.hostname = match.hostname.groups["0"] ?? "";
660
+ }
661
+ if (match.username.groups["0"]) {
662
+ url.username = match.username.groups["0"] ?? "";
663
+ }
664
+ if (match.password.groups["0"]) {
665
+ url.password = match.password.groups["0"] ?? "";
666
+ }
667
+ if (match.port.groups["0"]) {
668
+ url.port = match.port.groups["0"] ?? "";
669
+ }
670
+ if (match.pathname.groups["0"]) {
671
+ url.pathname = match.pathname.groups["0"] ?? "";
672
+ }
673
+ if (match.search.groups["0"]) {
674
+ url.search = match.search.groups["0"] ?? "";
675
+ }
676
+ if (match.hash.groups["0"]) {
677
+ url.hash = match.hash.groups["0"] ?? "";
678
+ }
679
+ return url;
680
+ }
681
+ function fillPattern(pattern, values, origin) {
682
+ let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
683
+ return `${protocol}#PORT-${port}#${slash}`;
684
+ });
685
+ let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
686
+ if (modifier === "?") {
687
+ return content;
688
+ }
689
+ return content;
690
+ });
691
+ let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
692
+ const value = values[name];
693
+ if (value === null) {
694
+ return "";
695
+ }
696
+ if (modifier === "?") {
697
+ return value !== undefined ? `${slash}${value}` : "";
698
+ }
699
+ if (modifier === "+" || modifier === "*") {
700
+ if (value === undefined && modifier === "+") {
701
+ throw new Error(`Missing value for "${name}" (one or more required)`);
702
+ }
703
+ return value ? `${slash}${value}` : "";
704
+ }
705
+ if (value === undefined) {
706
+ throw new Error(`Missing value for "${name}"`);
707
+ }
708
+ return `${slash}${value}`;
709
+ });
710
+ filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
711
+ return new URL(filled, origin);
712
+ }
713
+ function aggregateGroups(match) {
714
+ return {
715
+ ...match.hash.groups,
716
+ ...match.hostname.groups,
717
+ ...match.password.groups,
718
+ ...match.pathname.groups,
719
+ ...match.port.groups,
720
+ ...match.protocol.groups,
721
+ ...match.search.groups,
722
+ ...match.username.groups
723
+ };
724
+ }
725
+ var customServerStrategies = new Map;
726
+ var customClientStrategies = new Map;
727
+ function isCustomStrategy(strategy2) {
728
+ return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
729
+ }
730
+
731
+ // ../../src/components/ui/file-picker.tsx
732
+ import { jsxDEV as jsxDEV5, Fragment } from "react/jsx-dev-runtime";
733
+ "use client";
734
+ var messages = {
735
+ en: {
736
+ accepts: (accepts) => `Accepts: ${accepts}`,
737
+ chooseFile: "Choose file",
738
+ deleteFile: "Delete",
739
+ dropFile: "Drag and drop a file here",
740
+ replaceFile: "Replace file"
741
+ },
742
+ fr: {
743
+ accepts: (accepts) => `Accepte : ${accepts}`,
744
+ chooseFile: "Choisir un fichier",
745
+ deleteFile: "Supprimer",
746
+ dropFile: "Glissez-déposez un fichier ici",
747
+ replaceFile: "Remplacer le fichier"
748
+ }
749
+ };
750
+ var filePickerMessages = (overrides) => ({
751
+ ...getLocale().startsWith("fr") ? messages.fr : messages.en,
752
+ ...overrides
753
+ });
754
+ var formatBytes = (bytes) => {
755
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
756
+ if (bytes === 0)
757
+ return "0 Bytes";
758
+ const index = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), sizes.length - 1);
759
+ if (index === 0)
760
+ return `${bytes} ${sizes[index]}`;
761
+ return `${(bytes / 1024 ** index).toFixed(1)} ${sizes[index]}`;
762
+ };
763
+ var fileDescription = (file) => [
764
+ file.type || file.name.split(".").pop()?.toUpperCase(),
765
+ formatBytes(file.size)
766
+ ].filter(Boolean).join(" · ");
767
+ var FilePicker = ({
768
+ accept = "",
769
+ canClear = false,
770
+ file,
771
+ id,
772
+ image,
773
+ invalid = false,
774
+ messages: messages2,
775
+ name,
776
+ onBlur,
777
+ onChange,
778
+ onClear,
779
+ required,
780
+ title
781
+ }) => {
782
+ const labels = filePickerMessages(messages2);
783
+ const inputRef = useRef(null);
784
+ const dragDepthRef = useRef(0);
785
+ const [dragging, setDragging] = useState(false);
786
+ const imageEnabled = image !== undefined;
787
+ const objectUrl = useMemo(() => file && imageEnabled ? URL.createObjectURL(file) : undefined, [file, imageEnabled]);
788
+ useEffect(() => () => {
789
+ if (objectUrl)
790
+ URL.revokeObjectURL(objectUrl);
791
+ }, [objectUrl]);
792
+ const imageUrl = objectUrl ?? image?.src;
793
+ const selected = Boolean(file || imageUrl);
794
+ const selectFile = (nextFile) => {
795
+ if (nextFile)
796
+ onChange(nextFile);
797
+ };
798
+ const handleDrop = (event) => {
799
+ event.preventDefault();
800
+ dragDepthRef.current = 0;
801
+ setDragging(false);
802
+ if (inputRef.current)
803
+ inputRef.current.files = event.dataTransfer.files;
804
+ selectFile(event.dataTransfer.files[0]);
805
+ onBlur?.();
806
+ };
807
+ const clear = () => {
808
+ onClear();
809
+ if (inputRef.current)
810
+ inputRef.current.value = "";
811
+ };
812
+ const input = /* @__PURE__ */ jsxDEV5(Input, {
813
+ ref: inputRef,
814
+ className: "sr-only",
815
+ id,
816
+ name,
817
+ type: "file",
818
+ accept,
819
+ required,
820
+ onBlur,
821
+ onChange: (event) => selectFile(event.target.files?.[0]),
822
+ "aria-invalid": invalid
823
+ }, undefined, false, undefined, this);
824
+ if (!selected) {
825
+ return /* @__PURE__ */ jsxDEV5("div", {
826
+ className: "bg-muted/30 data-[dragging=true]:bg-muted flex min-h-32 flex-col items-center justify-center gap-3 rounded-xl border border-dashed p-6 text-center transition-colors",
827
+ "data-dragging": dragging,
828
+ onDragEnter: (event) => {
829
+ event.preventDefault();
830
+ dragDepthRef.current += 1;
831
+ setDragging(true);
832
+ },
833
+ onDragLeave: (event) => {
834
+ event.preventDefault();
835
+ dragDepthRef.current -= 1;
836
+ if (dragDepthRef.current <= 0) {
837
+ dragDepthRef.current = 0;
838
+ setDragging(false);
839
+ }
840
+ },
841
+ onDragOver: (event) => event.preventDefault(),
842
+ onDrop: handleDrop,
843
+ children: [
844
+ /* @__PURE__ */ jsxDEV5(CloudUpload, {
845
+ className: "text-muted-foreground size-6"
846
+ }, undefined, false, undefined, this),
847
+ /* @__PURE__ */ jsxDEV5("div", {
848
+ children: [
849
+ /* @__PURE__ */ jsxDEV5("p", {
850
+ className: "text-sm font-medium",
851
+ children: labels.dropFile
852
+ }, undefined, false, undefined, this),
853
+ /* @__PURE__ */ jsxDEV5("p", {
854
+ className: "text-muted-foreground text-xs",
855
+ children: labels.accepts(accept)
856
+ }, undefined, false, undefined, this)
857
+ ]
858
+ }, undefined, true, undefined, this),
859
+ /* @__PURE__ */ jsxDEV5(Button, {
860
+ type: "button",
861
+ variant: "outline",
862
+ onClick: () => inputRef.current?.click(),
863
+ children: [
864
+ /* @__PURE__ */ jsxDEV5(FileUp, {
865
+ "data-icon": "inline-start"
866
+ }, undefined, false, undefined, this),
867
+ labels.chooseFile
868
+ ]
869
+ }, undefined, true, undefined, this),
870
+ input
871
+ ]
872
+ }, undefined, true, undefined, this);
873
+ }
874
+ return /* @__PURE__ */ jsxDEV5(Fragment, {
875
+ children: [
876
+ /* @__PURE__ */ jsxDEV5(Attachment, {
877
+ className: image ? "w-fit max-w-full" : "w-full",
878
+ orientation: image ? "vertical" : "horizontal",
879
+ state: invalid ? "error" : "done",
880
+ children: [
881
+ /* @__PURE__ */ jsxDEV5(AttachmentMedia, {
882
+ variant: image ? "image" : "icon",
883
+ className: image ? "aspect-auto w-full max-w-full [&_img]:aspect-auto! [&_img]:object-contain!" : undefined,
884
+ children: image && imageUrl ? /* @__PURE__ */ jsxDEV5("img", {
885
+ src: imageUrl,
886
+ alt: image.alt,
887
+ width: image.width,
888
+ height: image.height,
889
+ className: "h-auto max-w-full object-contain",
890
+ style: { maxHeight: image.height }
891
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV5(FileIcon, {}, undefined, false, undefined, this)
892
+ }, undefined, false, undefined, this),
893
+ /* @__PURE__ */ jsxDEV5(AttachmentContent, {
894
+ className: image ? "w-full" : undefined,
895
+ children: [
896
+ /* @__PURE__ */ jsxDEV5(AttachmentTitle, {
897
+ children: title
898
+ }, undefined, false, undefined, this),
899
+ file ? /* @__PURE__ */ jsxDEV5(AttachmentDescription, {
900
+ children: fileDescription(file)
901
+ }, undefined, false, undefined, this) : null
902
+ ]
903
+ }, undefined, true, undefined, this),
904
+ /* @__PURE__ */ jsxDEV5(AttachmentActions, {
905
+ children: [
906
+ /* @__PURE__ */ jsxDEV5(AttachmentAction, {
907
+ type: "button",
908
+ "aria-label": labels.replaceFile,
909
+ onClick: () => inputRef.current?.click(),
910
+ children: /* @__PURE__ */ jsxDEV5(RefreshCw, {}, undefined, false, undefined, this)
911
+ }, undefined, false, undefined, this),
912
+ canClear ? /* @__PURE__ */ jsxDEV5(AttachmentAction, {
913
+ type: "button",
914
+ "aria-label": `${labels.deleteFile} ${typeof title === "string" ? title : ""}`,
915
+ onClick: clear,
916
+ children: /* @__PURE__ */ jsxDEV5(Trash2, {}, undefined, false, undefined, this)
917
+ }, undefined, false, undefined, this) : null
918
+ ]
919
+ }, undefined, true, undefined, this)
920
+ ]
921
+ }, undefined, true, undefined, this),
922
+ input
923
+ ]
924
+ }, undefined, true, undefined, this);
925
+ };
926
+
927
+ // ../../src/components/ui/badge.tsx
928
+ import { mergeProps as mergeProps2 } from "@base-ui/react/merge-props";
929
+ import { useRender as useRender2 } from "@base-ui/react/use-render";
930
+ import { cva as cva3 } from "class-variance-authority";
931
+ var badgeVariants = cva3("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
932
+ variants: {
933
+ variant: {
934
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
935
+ secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
936
+ destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
937
+ outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
938
+ ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
939
+ link: "text-primary underline-offset-4 hover:underline"
940
+ }
941
+ },
942
+ defaultVariants: {
943
+ variant: "default"
944
+ }
945
+ });
946
+ function Badge({
947
+ className,
948
+ variant = "default",
949
+ render,
950
+ ...props
951
+ }) {
952
+ return useRender2({
953
+ defaultTagName: "span",
954
+ props: mergeProps2({
955
+ className: cn(badgeVariants({ variant }), className)
956
+ }, props),
957
+ render,
958
+ state: {
959
+ slot: "badge",
960
+ variant
961
+ }
962
+ });
963
+ }
964
+
965
+ // ../../src/components/ui/checkbox.tsx
966
+ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
967
+ import { CheckIcon } from "lucide-react";
968
+ import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
969
+ "use client";
970
+ function Checkbox({ className, ...props }) {
971
+ return /* @__PURE__ */ jsxDEV6(CheckboxPrimitive.Root, {
972
+ "data-slot": "checkbox",
973
+ className: cn("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input shadow-xs transition-shadow outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary", className),
974
+ ...props,
975
+ children: /* @__PURE__ */ jsxDEV6(CheckboxPrimitive.Indicator, {
976
+ "data-slot": "checkbox-indicator",
977
+ className: "grid place-content-center text-current transition-none [&>svg]:size-3.5",
978
+ children: /* @__PURE__ */ jsxDEV6(CheckIcon, {}, undefined, false, undefined, this)
979
+ }, undefined, false, undefined, this)
980
+ }, undefined, false, undefined, this);
981
+ }
982
+
983
+ // ../../src/components/ui/field.tsx
984
+ import { useMemo as useMemo2 } from "react";
985
+ import { cva as cva4 } from "class-variance-authority";
986
+
987
+ // ../../src/components/ui/label.tsx
988
+ import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
989
+ "use client";
990
+ function Label({ className, ...props }) {
991
+ return /* @__PURE__ */ jsxDEV7("label", {
992
+ "data-slot": "label",
993
+ className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
994
+ ...props
995
+ }, undefined, false, undefined, this);
996
+ }
997
+
998
+ // ../../src/components/ui/separator.tsx
999
+ import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
1000
+ import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
1001
+
1002
+ // ../../src/components/ui/field.tsx
1003
+ import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
1004
+ function FieldSet({ className, ...props }) {
1005
+ return /* @__PURE__ */ jsxDEV9("fieldset", {
1006
+ "data-slot": "field-set",
1007
+ className: cn("flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className),
1008
+ ...props
1009
+ }, undefined, false, undefined, this);
1010
+ }
1011
+ function FieldLegend({
1012
+ className,
1013
+ variant = "legend",
1014
+ ...props
1015
+ }) {
1016
+ return /* @__PURE__ */ jsxDEV9("legend", {
1017
+ "data-slot": "field-legend",
1018
+ "data-variant": variant,
1019
+ className: cn("mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base", className),
1020
+ ...props
1021
+ }, undefined, false, undefined, this);
1022
+ }
1023
+ function FieldGroup({ className, ...props }) {
1024
+ return /* @__PURE__ */ jsxDEV9("div", {
1025
+ "data-slot": "field-group",
1026
+ className: cn("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4", className),
1027
+ ...props
1028
+ }, undefined, false, undefined, this);
1029
+ }
1030
+ var fieldVariants = cva4("group/field flex w-full gap-3 data-[invalid=true]:text-destructive", {
1031
+ variants: {
1032
+ orientation: {
1033
+ vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
1034
+ horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
1035
+ responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
1036
+ }
1037
+ },
1038
+ defaultVariants: {
1039
+ orientation: "vertical"
1040
+ }
1041
+ });
1042
+ function Field({
1043
+ className,
1044
+ orientation = "vertical",
1045
+ ...props
1046
+ }) {
1047
+ return /* @__PURE__ */ jsxDEV9("div", {
1048
+ role: "group",
1049
+ "data-slot": "field",
1050
+ "data-orientation": orientation,
1051
+ className: cn(fieldVariants({ orientation }), className),
1052
+ ...props
1053
+ }, undefined, false, undefined, this);
1054
+ }
1055
+ function FieldLabel({
1056
+ className,
1057
+ ...props
1058
+ }) {
1059
+ return /* @__PURE__ */ jsxDEV9(Label, {
1060
+ "data-slot": "field-label",
1061
+ className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", className),
1062
+ ...props
1063
+ }, undefined, false, undefined, this);
1064
+ }
1065
+ function FieldDescription({ className, ...props }) {
1066
+ return /* @__PURE__ */ jsxDEV9("p", {
1067
+ "data-slot": "field-description",
1068
+ className: cn("text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5", "last:mt-0 nth-last-2:-mt-1", "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className),
1069
+ ...props
1070
+ }, undefined, false, undefined, this);
1071
+ }
1072
+
1073
+ // ../../src/components/ui/select.tsx
1074
+ import { Select as SelectPrimitive } from "@base-ui/react/select";
1075
+ import { ChevronDownIcon, CheckIcon as CheckIcon2, ChevronUpIcon } from "lucide-react";
1076
+ import { jsxDEV as jsxDEV10 } from "react/jsx-dev-runtime";
1077
+ "use client";
1078
+ var Select = SelectPrimitive.Root;
1079
+ function SelectGroup({ className, ...props }) {
1080
+ return /* @__PURE__ */ jsxDEV10(SelectPrimitive.Group, {
1081
+ "data-slot": "select-group",
1082
+ className: cn("scroll-my-1 p-1", className),
1083
+ ...props
1084
+ }, undefined, false, undefined, this);
1085
+ }
1086
+ function SelectValue({ className, ...props }) {
1087
+ return /* @__PURE__ */ jsxDEV10(SelectPrimitive.Value, {
1088
+ "data-slot": "select-value",
1089
+ className: cn("flex flex-1 text-left", className),
1090
+ ...props
1091
+ }, undefined, false, undefined, this);
1092
+ }
1093
+ function SelectTrigger({
1094
+ className,
1095
+ size = "default",
1096
+ children,
1097
+ ...props
1098
+ }) {
1099
+ return /* @__PURE__ */ jsxDEV10(SelectPrimitive.Trigger, {
1100
+ "data-slot": "select-trigger",
1101
+ "data-size": size,
1102
+ className: cn("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
1103
+ ...props,
1104
+ children: [
1105
+ children,
1106
+ /* @__PURE__ */ jsxDEV10(SelectPrimitive.Icon, {
1107
+ render: /* @__PURE__ */ jsxDEV10(ChevronDownIcon, {
1108
+ className: "text-muted-foreground pointer-events-none size-4"
1109
+ }, undefined, false, undefined, this)
1110
+ }, undefined, false, undefined, this)
1111
+ ]
1112
+ }, undefined, true, undefined, this);
1113
+ }
1114
+ function SelectContent({
1115
+ className,
1116
+ children,
1117
+ side = "bottom",
1118
+ sideOffset = 4,
1119
+ align = "center",
1120
+ alignOffset = 0,
1121
+ alignItemWithTrigger = true,
1122
+ ...props
1123
+ }) {
1124
+ return /* @__PURE__ */ jsxDEV10(SelectPrimitive.Portal, {
1125
+ children: /* @__PURE__ */ jsxDEV10(SelectPrimitive.Positioner, {
1126
+ side,
1127
+ sideOffset,
1128
+ align,
1129
+ alignOffset,
1130
+ alignItemWithTrigger,
1131
+ className: "isolate z-50",
1132
+ children: /* @__PURE__ */ jsxDEV10(SelectPrimitive.Popup, {
1133
+ "data-slot": "select-content",
1134
+ "data-align-trigger": alignItemWithTrigger,
1135
+ className: cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
1136
+ ...props,
1137
+ children: [
1138
+ /* @__PURE__ */ jsxDEV10(SelectScrollUpButton, {}, undefined, false, undefined, this),
1139
+ /* @__PURE__ */ jsxDEV10(SelectPrimitive.List, {
1140
+ children
1141
+ }, undefined, false, undefined, this),
1142
+ /* @__PURE__ */ jsxDEV10(SelectScrollDownButton, {}, undefined, false, undefined, this)
1143
+ ]
1144
+ }, undefined, true, undefined, this)
1145
+ }, undefined, false, undefined, this)
1146
+ }, undefined, false, undefined, this);
1147
+ }
1148
+ function SelectItem({
1149
+ className,
1150
+ children,
1151
+ ...props
1152
+ }) {
1153
+ return /* @__PURE__ */ jsxDEV10(SelectPrimitive.Item, {
1154
+ "data-slot": "select-item",
1155
+ className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
1156
+ ...props,
1157
+ children: [
1158
+ /* @__PURE__ */ jsxDEV10(SelectPrimitive.ItemText, {
1159
+ className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap",
1160
+ children
1161
+ }, undefined, false, undefined, this),
1162
+ /* @__PURE__ */ jsxDEV10(SelectPrimitive.ItemIndicator, {
1163
+ render: /* @__PURE__ */ jsxDEV10("span", {
1164
+ className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center"
1165
+ }, undefined, false, undefined, this),
1166
+ children: /* @__PURE__ */ jsxDEV10(CheckIcon2, {
1167
+ className: "pointer-events-none"
1168
+ }, undefined, false, undefined, this)
1169
+ }, undefined, false, undefined, this)
1170
+ ]
1171
+ }, undefined, true, undefined, this);
1172
+ }
1173
+ function SelectScrollUpButton({
1174
+ className,
1175
+ ...props
1176
+ }) {
1177
+ return /* @__PURE__ */ jsxDEV10(SelectPrimitive.ScrollUpArrow, {
1178
+ "data-slot": "select-scroll-up-button",
1179
+ className: cn("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
1180
+ ...props,
1181
+ children: /* @__PURE__ */ jsxDEV10(ChevronUpIcon, {}, undefined, false, undefined, this)
1182
+ }, undefined, false, undefined, this);
1183
+ }
1184
+ function SelectScrollDownButton({
1185
+ className,
1186
+ ...props
1187
+ }) {
1188
+ return /* @__PURE__ */ jsxDEV10(SelectPrimitive.ScrollDownArrow, {
1189
+ "data-slot": "select-scroll-down-button",
1190
+ className: cn("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
1191
+ ...props,
1192
+ children: /* @__PURE__ */ jsxDEV10(ChevronDownIcon, {}, undefined, false, undefined, this)
1193
+ }, undefined, false, undefined, this);
1194
+ }
1195
+
1196
+ // ../../src/components/ui/textarea.tsx
1197
+ import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
1198
+ function Textarea({ className, ...props }) {
1199
+ return /* @__PURE__ */ jsxDEV11("textarea", {
1200
+ "data-slot": "textarea",
1201
+ className: cn("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
1202
+ ...props
1203
+ }, undefined, false, undefined, this);
1204
+ }
1205
+
1206
+ // ../../src/components/ui/virtualized-combobox.tsx
1207
+ import { Combobox as ComboboxPrimitive } from "@base-ui/react";
1208
+ import { useVirtualizer } from "@tanstack/react-virtual";
1209
+ import { Check, ChevronsUpDown } from "lucide-react";
1210
+ import {
1211
+ useCallback,
1212
+ useImperativeHandle,
1213
+ useRef as useRef2
1214
+ } from "react";
1215
+
1216
+ // ../../src/components/ui/input-group.tsx
1217
+ import { cva as cva5 } from "class-variance-authority";
1218
+ import { jsxDEV as jsxDEV12 } from "react/jsx-dev-runtime";
1219
+ function InputGroup({ className, ...props }) {
1220
+ return /* @__PURE__ */ jsxDEV12("div", {
1221
+ "data-slot": "input-group",
1222
+ role: "group",
1223
+ className: cn("group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5", className),
1224
+ ...props
1225
+ }, undefined, false, undefined, this);
1226
+ }
1227
+ var inputGroupAddonVariants = cva5("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
1228
+ variants: {
1229
+ align: {
1230
+ "inline-start": "order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]",
1231
+ "inline-end": "order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]",
1232
+ "block-start": "order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
1233
+ "block-end": "order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"
1234
+ }
1235
+ },
1236
+ defaultVariants: { align: "inline-start" }
1237
+ });
1238
+ var inputGroupButtonVariants = cva5("flex items-center gap-2 text-sm shadow-none", {
1239
+ variants: {
1240
+ size: {
1241
+ xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
1242
+ sm: "",
1243
+ "icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
1244
+ "icon-sm": "size-8 p-0 has-[>svg]:p-0"
1245
+ }
1246
+ },
1247
+ defaultVariants: { size: "xs" }
1248
+ });
1249
+ function InputGroupInput({
1250
+ className,
1251
+ ...props
1252
+ }) {
1253
+ return /* @__PURE__ */ jsxDEV12(Input, {
1254
+ "data-slot": "input-group-control",
1255
+ className: cn("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent", className),
1256
+ ...props
1257
+ }, undefined, false, undefined, this);
1258
+ }
1259
+
1260
+ // ../../src/components/ui/virtualized-combobox.tsx
1261
+ import { jsxDEV as jsxDEV13 } from "react/jsx-dev-runtime";
1262
+ "use client";
1263
+ var messages2 = {
1264
+ en: {
1265
+ search: "Search...",
1266
+ selected: (count) => `${count} selected`,
1267
+ selectMore: "Select more"
1268
+ },
1269
+ fr: {
1270
+ search: "Rechercher...",
1271
+ selected: (count) => `${count} sélectionnés`,
1272
+ selectMore: "Sélectionner davantage"
1273
+ }
1274
+ };
1275
+ var virtualizedComboboxMessages = (overrides) => ({
1276
+ ...getLocale().startsWith("fr") ? messages2.fr : messages2.en,
1277
+ ...overrides
1278
+ });
1279
+ var optionEquals = (item, selected) => item.value === selected.value;
1280
+ var VirtualizedComboboxList = ({
1281
+ emptyLabel,
1282
+ groupSelections,
1283
+ messages: messageOverrides,
1284
+ renderItem,
1285
+ selectedValues,
1286
+ virtualizerRef
1287
+ }) => {
1288
+ const filteredItems = ComboboxPrimitive.useFilteredItems();
1289
+ const labels = virtualizedComboboxMessages(messageOverrides);
1290
+ const entries = filteredItems.flatMap((item, index) => {
1291
+ if (!groupSelections)
1292
+ return [{ kind: "item", item, index }];
1293
+ const selected = selectedValues.has(item.value);
1294
+ const previous = filteredItems[index - 1];
1295
+ const startsGroup = index === 0 || selectedValues.has(previous?.value ?? "") !== selected;
1296
+ const itemEntry = { kind: "item", item, index };
1297
+ return startsGroup ? [
1298
+ {
1299
+ kind: "group",
1300
+ key: selected ? "selected" : "available",
1301
+ label: selected ? labels.selected(selectedValues.size) : labels.selectMore
1302
+ },
1303
+ itemEntry
1304
+ ] : [itemEntry];
1305
+ });
1306
+ const scrollRef = useRef2(null);
1307
+ const virtualizer = useVirtualizer({
1308
+ count: entries.length,
1309
+ getScrollElement: () => scrollRef.current,
1310
+ getItemKey: (index) => {
1311
+ const entry = entries[index];
1312
+ return entry?.kind === "group" ? `group-${entry.key}` : entry?.item.value ?? index;
1313
+ },
1314
+ estimateSize: () => 36,
1315
+ overscan: 8
1316
+ });
1317
+ useImperativeHandle(virtualizerRef, () => virtualizer, [virtualizer]);
1318
+ const handleScrollElementRef = useCallback((element) => {
1319
+ scrollRef.current = element;
1320
+ if (element)
1321
+ virtualizer.measure();
1322
+ }, [virtualizer]);
1323
+ if (filteredItems.length === 0) {
1324
+ return /* @__PURE__ */ jsxDEV13("div", {
1325
+ className: "text-muted-foreground py-6 text-center text-sm",
1326
+ children: emptyLabel
1327
+ }, undefined, false, undefined, this);
1328
+ }
1329
+ return /* @__PURE__ */ jsxDEV13(ComboboxPrimitive.List, {
1330
+ className: "scroll-py-1 overflow-auto overscroll-contain p-1",
1331
+ ref: handleScrollElementRef,
1332
+ style: {
1333
+ height: Math.min(virtualizer.getTotalSize() + 8, 288),
1334
+ maxHeight: "var(--available-height)"
1335
+ },
1336
+ children: /* @__PURE__ */ jsxDEV13("div", {
1337
+ className: "relative w-full",
1338
+ role: "presentation",
1339
+ style: { height: virtualizer.getTotalSize() },
1340
+ children: virtualizer.getVirtualItems().map((virtualItem) => {
1341
+ const entry = entries[virtualItem.index];
1342
+ if (!entry)
1343
+ return null;
1344
+ const style = {
1345
+ height: virtualItem.size,
1346
+ transform: `translateY(${virtualItem.start}px)`
1347
+ };
1348
+ if (entry.kind === "group") {
1349
+ return /* @__PURE__ */ jsxDEV13(ComboboxPrimitive.Group, {
1350
+ className: "contents",
1351
+ children: /* @__PURE__ */ jsxDEV13(ComboboxPrimitive.GroupLabel, {
1352
+ className: "text-muted-foreground absolute top-0 left-0 w-full px-2 pt-3 pb-1 text-xs",
1353
+ "data-index": virtualItem.index,
1354
+ ref: virtualizer.measureElement,
1355
+ style,
1356
+ children: entry.label
1357
+ }, undefined, false, undefined, this)
1358
+ }, entry.key, false, undefined, this);
1359
+ }
1360
+ return /* @__PURE__ */ jsxDEV13(ComboboxPrimitive.Item, {
1361
+ "aria-posinset": entry.index + 1,
1362
+ "aria-setsize": filteredItems.length,
1363
+ className: "data-highlighted:bg-accent data-highlighted:text-accent-foreground absolute top-0 left-0 flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50",
1364
+ "data-index": virtualItem.index,
1365
+ index: entry.index,
1366
+ ref: virtualizer.measureElement,
1367
+ style,
1368
+ value: entry.item,
1369
+ children: [
1370
+ renderItem?.(entry.item) ?? /* @__PURE__ */ jsxDEV13("span", {
1371
+ className: "min-w-0 truncate",
1372
+ children: entry.item.label
1373
+ }, undefined, false, undefined, this),
1374
+ /* @__PURE__ */ jsxDEV13(ComboboxPrimitive.ItemIndicator, {
1375
+ className: "absolute right-2 flex size-4 items-center justify-center",
1376
+ children: /* @__PURE__ */ jsxDEV13(Check, {}, undefined, false, undefined, this)
1377
+ }, undefined, false, undefined, this)
1378
+ ]
1379
+ }, entry.item.value, true, undefined, this);
1380
+ })
1381
+ }, undefined, false, undefined, this)
1382
+ }, undefined, false, undefined, this);
1383
+ };
1384
+ var VirtualizedComboboxContent = ({
1385
+ contentClassName,
1386
+ emptyLabel,
1387
+ groupSelections,
1388
+ messages: messageOverrides,
1389
+ renderItem,
1390
+ selectedValues,
1391
+ virtualizerRef
1392
+ }) => {
1393
+ const labels = virtualizedComboboxMessages(messageOverrides);
1394
+ return /* @__PURE__ */ jsxDEV13(ComboboxPrimitive.Portal, {
1395
+ children: /* @__PURE__ */ jsxDEV13(ComboboxPrimitive.Positioner, {
1396
+ align: "start",
1397
+ className: "isolate z-50",
1398
+ side: "bottom",
1399
+ sideOffset: 6,
1400
+ children: /* @__PURE__ */ jsxDEV13(ComboboxPrimitive.Popup, {
1401
+ className: cn("relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-0 origin-(--transform-origin) overflow-hidden rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-in-95", contentClassName),
1402
+ children: [
1403
+ /* @__PURE__ */ jsxDEV13("div", {
1404
+ className: "min-w-0 p-1 pb-0",
1405
+ children: /* @__PURE__ */ jsxDEV13(InputGroup, {
1406
+ className: "border-input/30 bg-input/30 h-8 w-full min-w-0 shadow-none",
1407
+ children: /* @__PURE__ */ jsxDEV13(ComboboxPrimitive.Input, {
1408
+ placeholder: labels.search,
1409
+ render: /* @__PURE__ */ jsxDEV13(InputGroupInput, {}, undefined, false, undefined, this)
1410
+ }, undefined, false, undefined, this)
1411
+ }, undefined, false, undefined, this)
1412
+ }, undefined, false, undefined, this),
1413
+ /* @__PURE__ */ jsxDEV13(VirtualizedComboboxList, {
1414
+ emptyLabel,
1415
+ groupSelections,
1416
+ messages: messageOverrides,
1417
+ renderItem,
1418
+ selectedValues,
1419
+ virtualizerRef
1420
+ }, undefined, false, undefined, this)
1421
+ ]
1422
+ }, undefined, true, undefined, this)
1423
+ }, undefined, false, undefined, this)
1424
+ }, undefined, false, undefined, this);
1425
+ };
1426
+ var defaultTrigger = (ariaLabel, ariaInvalid, disabled, label, triggerId) => /* @__PURE__ */ jsxDEV13(Button, {
1427
+ "aria-label": ariaLabel,
1428
+ "aria-invalid": ariaInvalid,
1429
+ className: "w-full max-w-full min-w-0 justify-between overflow-hidden",
1430
+ disabled,
1431
+ id: triggerId,
1432
+ type: "button",
1433
+ variant: "outline",
1434
+ children: [
1435
+ /* @__PURE__ */ jsxDEV13("span", {
1436
+ className: "min-w-0 truncate text-left",
1437
+ children: label
1438
+ }, undefined, false, undefined, this),
1439
+ /* @__PURE__ */ jsxDEV13(ChevronsUpDown, {
1440
+ className: "text-muted-foreground shrink-0 opacity-70"
1441
+ }, undefined, false, undefined, this)
1442
+ ]
1443
+ }, undefined, true, undefined, this);
1444
+ var selectedLabel = (value, placeholder) => {
1445
+ if (Array.isArray(value)) {
1446
+ return value.length > 0 ? value.map(({ label }) => label).join(", ") : placeholder;
1447
+ }
1448
+ return value && "label" in value ? value.label : placeholder;
1449
+ };
1450
+ var useComboboxVirtualizerRef = (providedRef) => {
1451
+ const localRef = useRef2(null);
1452
+ return providedRef ?? localRef;
1453
+ };
1454
+ var VirtualizedComboboxSingle = (props) => {
1455
+ const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
1456
+ return /* @__PURE__ */ jsxDEV13(ComboboxPrimitive.Root, {
1457
+ disabled: props.disabled,
1458
+ inputValue: props.searchValue,
1459
+ items: [...props.items],
1460
+ itemToStringLabel: (item) => item.label,
1461
+ isItemEqualToValue: optionEquals,
1462
+ onInputValueChange: (value) => props.onSearchValueChange?.(value),
1463
+ onItemHighlighted: (_, { index, reason }) => {
1464
+ if (reason === "keyboard" && index >= 0) {
1465
+ virtualizerRef.current?.scrollToIndex(index, { align: "auto" });
1466
+ }
1467
+ },
1468
+ onOpenChange: (open) => props.onOpenChange?.(open),
1469
+ onValueChange: (value) => props.onValueChange(value),
1470
+ open: props.open,
1471
+ value: props.value,
1472
+ virtualized: true,
1473
+ children: [
1474
+ /* @__PURE__ */ jsxDEV13(ComboboxPrimitive.Trigger, {
1475
+ render: props.trigger ?? defaultTrigger(props.ariaLabel, props.ariaInvalid, props.disabled, selectedLabel(props.value, props.placeholder), props.triggerId)
1476
+ }, undefined, false, undefined, this),
1477
+ /* @__PURE__ */ jsxDEV13(VirtualizedComboboxContent, {
1478
+ ...props,
1479
+ groupSelections: false,
1480
+ selectedValues: new Set(props.value ? [props.value.value] : []),
1481
+ virtualizerRef
1482
+ }, undefined, false, undefined, this)
1483
+ ]
1484
+ }, undefined, true, undefined, this);
1485
+ };
1486
+ var VirtualizedComboboxMultiple = (props) => {
1487
+ const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
1488
+ return /* @__PURE__ */ jsxDEV13(ComboboxPrimitive.Root, {
1489
+ disabled: props.disabled,
1490
+ inputValue: props.searchValue,
1491
+ items: [...props.items],
1492
+ itemToStringLabel: (item) => item.label,
1493
+ isItemEqualToValue: optionEquals,
1494
+ multiple: true,
1495
+ onInputValueChange: (value) => props.onSearchValueChange?.(value),
1496
+ onItemHighlighted: (_, { index, reason }) => {
1497
+ if (reason === "keyboard" && index >= 0) {
1498
+ virtualizerRef.current?.scrollToIndex(index, { align: "auto" });
1499
+ }
1500
+ },
1501
+ onOpenChange: (open) => props.onOpenChange?.(open),
1502
+ onValueChange: (value) => props.onValueChange(value),
1503
+ open: props.open,
1504
+ value: [...props.value],
1505
+ virtualized: true,
1506
+ children: [
1507
+ /* @__PURE__ */ jsxDEV13(ComboboxPrimitive.Trigger, {
1508
+ render: props.trigger ?? defaultTrigger(props.ariaLabel, props.ariaInvalid, props.disabled, selectedLabel(props.value, props.placeholder), props.triggerId)
1509
+ }, undefined, false, undefined, this),
1510
+ /* @__PURE__ */ jsxDEV13(VirtualizedComboboxContent, {
1511
+ ...props,
1512
+ groupSelections: true,
1513
+ selectedValues: new Set(props.value.map(({ value }) => value)),
1514
+ virtualizerRef
1515
+ }, undefined, false, undefined, this)
1516
+ ]
1517
+ }, undefined, true, undefined, this);
1518
+ };
1519
+ function VirtualizedCombobox(props) {
1520
+ return props.multiple ? /* @__PURE__ */ jsxDEV13(VirtualizedComboboxMultiple, {
1521
+ ...props
1522
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV13(VirtualizedComboboxSingle, {
1523
+ ...props
1524
+ }, undefined, false, undefined, this);
1525
+ }
1526
+
1527
+ // ../../src/components/ui/effect-form.tsx
1528
+ import { jsxDEV as jsxDEV14 } from "react/jsx-dev-runtime";
1529
+ var messages3 = {
1530
+ en: {
1531
+ add: "Add",
1532
+ blockNavigationCancel: "Cancel",
1533
+ blockNavigationConfirm: "Confirm",
1534
+ blockNavigationDescription: "Your changes have not been saved. If you leave, you will lose your changes.",
1535
+ blockNavigationTitle: "Leave without saving?",
1536
+ delete: "Delete",
1537
+ description: "Description",
1538
+ folder: "Folder",
1539
+ key: "Key",
1540
+ name: "Name",
1541
+ nameRequired: "Name is required",
1542
+ revert: "Revert to default",
1543
+ submit: "Submit",
1544
+ suggestedImageSize: (width, height) => `Suggested image size: ${width} x ${height}`,
1545
+ value: "Value"
1546
+ },
1547
+ fr: {
1548
+ add: "Ajouter",
1549
+ blockNavigationCancel: "Annuler",
1550
+ blockNavigationConfirm: "Confirmer",
1551
+ blockNavigationDescription: "Vos modifications n'ont pas été sauvegardées. Si vous quittez, vous les perdrez.",
1552
+ blockNavigationTitle: "Quitter sans sauvegarder?",
1553
+ delete: "Supprimer",
1554
+ description: "Description",
1555
+ folder: "Dossier",
1556
+ key: "Clé",
1557
+ name: "Nom",
1558
+ nameRequired: "Le nom est obligatoire",
1559
+ revert: "Revenir aux paramètres par défaut",
1560
+ submit: "Soumettre",
1561
+ suggestedImageSize: (width, height) => `Taille de l'image suggérée : ${width} x ${height}`,
1562
+ value: "Valeur"
1563
+ }
1564
+ };
1565
+ var effectFormMessages = (overrides) => ({
1566
+ ...getLocale().startsWith("fr") ? messages3.fr : messages3.en,
1567
+ ...overrides
1568
+ });
1569
+ var getCauseErrorMessage = (cause) => {
1570
+ const error = Cause.squash(cause);
1571
+ return error instanceof Error ? error.message : String(error);
1572
+ };
1573
+ var FieldWrapper = ({
1574
+ children,
1575
+ description,
1576
+ editingLocale,
1577
+ legend,
1578
+ locales: locales2,
1579
+ localized = true
1580
+ }) => /* @__PURE__ */ jsxDEV14(FieldSet, {
1581
+ children: [
1582
+ legend && /* @__PURE__ */ jsxDEV14(FieldLegend, {
1583
+ className: "flex items-center gap-2",
1584
+ children: [
1585
+ legend,
1586
+ localized && editingLocale && locales2 && /* @__PURE__ */ jsxDEV14(Badge, {
1587
+ variant: "outline",
1588
+ children: [
1589
+ /* @__PURE__ */ jsxDEV14(Languages, {}, undefined, false, undefined, this),
1590
+ locales2.find(({ value }) => value === editingLocale)?.label
1591
+ ]
1592
+ }, undefined, true, undefined, this)
1593
+ ]
1594
+ }, undefined, true, undefined, this),
1595
+ description && /* @__PURE__ */ jsxDEV14(FieldDescription, {
1596
+ children: description
1597
+ }, undefined, false, undefined, this),
1598
+ /* @__PURE__ */ jsxDEV14(FieldGroup, {
1599
+ children
1600
+ }, undefined, false, undefined, this)
1601
+ ]
1602
+ }, undefined, true, undefined, this);
1603
+ var ErrorMessage = ({ text }) => /* @__PURE__ */ jsxDEV14("em", {
1604
+ role: "alert",
1605
+ className: "text-destructive text-sm",
1606
+ children: text
1607
+ }, undefined, false, undefined, this);
1608
+ var SubmitError = ({
1609
+ result
1610
+ }) => {
1611
+ const message = AsyncResult.isFailure(result) ? Schema.isSchemaError(Cause.squash(result.cause)) ? undefined : getCauseErrorMessage(result.cause) : undefined;
1612
+ return message ? /* @__PURE__ */ jsxDEV14(ErrorMessage, {
1613
+ text: message
1614
+ }, undefined, false, undefined, this) : null;
1615
+ };
1616
+ var SubmitButton = ({
1617
+ children,
1618
+ form
1619
+ }) => {
1620
+ const submit = useAtomSet(form.submit);
1621
+ const submitResult = useAtomValue(form.submit);
1622
+ const isDirty = useAtomValue(form.isDirty);
1623
+ const hasChangedSinceSubmit = useAtomValue(form.hasChangedSinceSubmit);
1624
+ const lastSubmittedValues = useAtomValue(form.lastSubmittedValues);
1625
+ const hasPendingChanges = isDirty && (Option.isNone(lastSubmittedValues) || hasChangedSinceSubmit);
1626
+ return /* @__PURE__ */ jsxDEV14(Button, {
1627
+ type: "button",
1628
+ disabled: !hasPendingChanges || submitResult.waiting,
1629
+ className: "self-start",
1630
+ onClick: () => submit(),
1631
+ children: [
1632
+ submitResult.waiting && /* @__PURE__ */ jsxDEV14(Loader2, {
1633
+ "data-icon": "inline-start",
1634
+ className: "animate-spin"
1635
+ }, undefined, false, undefined, this),
1636
+ children ?? effectFormMessages().submit
1637
+ ]
1638
+ }, undefined, true, undefined, this);
1639
+ };
1640
+ var FieldError = ({
1641
+ error,
1642
+ message
1643
+ }) => Option.match(error, {
1644
+ onNone: () => null,
1645
+ onSome: (errorMessage) => /* @__PURE__ */ jsxDEV14(ErrorMessage, {
1646
+ text: message ?? errorMessage
1647
+ }, undefined, false, undefined, this)
1648
+ });
1649
+ var TextField = ({
1650
+ field,
1651
+ props
1652
+ }) => {
1653
+ const { children, description, errorMessage, label, ...inputProps } = props;
1654
+ return /* @__PURE__ */ jsxDEV14(Field, {
1655
+ "data-invalid": Option.isSome(field.error),
1656
+ children: [
1657
+ /* @__PURE__ */ jsxDEV14("div", {
1658
+ className: "flex w-full items-center gap-2",
1659
+ children: [
1660
+ /* @__PURE__ */ jsxDEV14(FieldLabel, {
1661
+ htmlFor: field.path,
1662
+ children: label
1663
+ }, undefined, false, undefined, this),
1664
+ children
1665
+ ]
1666
+ }, undefined, true, undefined, this),
1667
+ /* @__PURE__ */ jsxDEV14(Input, {
1668
+ ...inputProps,
1669
+ id: field.path,
1670
+ name: field.path,
1671
+ value: field.value,
1672
+ onBlur: field.onBlur,
1673
+ onChange: (event) => field.onChange(event.target.value),
1674
+ "aria-invalid": Option.isSome(field.error)
1675
+ }, undefined, false, undefined, this),
1676
+ description && /* @__PURE__ */ jsxDEV14(FieldDescription, {
1677
+ children: description
1678
+ }, undefined, false, undefined, this),
1679
+ /* @__PURE__ */ jsxDEV14(FieldError, {
1680
+ error: field.error,
1681
+ message: errorMessage
1682
+ }, undefined, false, undefined, this)
1683
+ ]
1684
+ }, undefined, true, undefined, this);
1685
+ };
1686
+ var NameField = ({
1687
+ field,
1688
+ props
1689
+ }) => /* @__PURE__ */ jsxDEV14(TextField, {
1690
+ field,
1691
+ props: {
1692
+ ...props,
1693
+ label: effectFormMessages().name,
1694
+ errorMessage: props.errorMessage ?? effectFormMessages().nameRequired
1695
+ }
1696
+ }, undefined, false, undefined, this);
1697
+ var TextAreaField = ({ field, props }) => {
1698
+ const { children, description, label, ...textareaProps } = props;
1699
+ const nativeTextareaProps = { ...textareaProps };
1700
+ delete nativeTextareaProps.original;
1701
+ return /* @__PURE__ */ jsxDEV14(Field, {
1702
+ "data-invalid": Option.isSome(field.error),
1703
+ children: [
1704
+ /* @__PURE__ */ jsxDEV14("div", {
1705
+ className: "flex w-full items-center gap-2",
1706
+ children: [
1707
+ /* @__PURE__ */ jsxDEV14(FieldLabel, {
1708
+ htmlFor: field.path,
1709
+ children: label
1710
+ }, undefined, false, undefined, this),
1711
+ children
1712
+ ]
1713
+ }, undefined, true, undefined, this),
1714
+ /* @__PURE__ */ jsxDEV14(Textarea, {
1715
+ ...nativeTextareaProps,
1716
+ id: field.path,
1717
+ name: field.path,
1718
+ value: field.value,
1719
+ onBlur: field.onBlur,
1720
+ onChange: (event) => field.onChange(event.target.value),
1721
+ "aria-invalid": Option.isSome(field.error)
1722
+ }, undefined, false, undefined, this),
1723
+ description && /* @__PURE__ */ jsxDEV14(FieldDescription, {
1724
+ children: description
1725
+ }, undefined, false, undefined, this),
1726
+ /* @__PURE__ */ jsxDEV14(FieldError, {
1727
+ error: field.error
1728
+ }, undefined, false, undefined, this)
1729
+ ]
1730
+ }, undefined, true, undefined, this);
1731
+ };
1732
+ var DescriptionField = ({ field, props }) => /* @__PURE__ */ jsxDEV14(TextAreaField, {
1733
+ field,
1734
+ props: { ...props, label: effectFormMessages().description }
1735
+ }, undefined, false, undefined, this);
1736
+ var FileField = ({ field, props }) => {
1737
+ const invalid = Option.isSome(field.error);
1738
+ return /* @__PURE__ */ jsxDEV14(Field, {
1739
+ "data-invalid": invalid,
1740
+ children: [
1741
+ /* @__PURE__ */ jsxDEV14(FieldLabel, {
1742
+ htmlFor: field.path,
1743
+ children: props.label
1744
+ }, undefined, false, undefined, this),
1745
+ /* @__PURE__ */ jsxDEV14(FilePicker, {
1746
+ accept: props.accept ?? "",
1747
+ canClear: field.value instanceof File,
1748
+ ...field.value ? { file: field.value } : {},
1749
+ id: field.path,
1750
+ invalid,
1751
+ name: field.path,
1752
+ onBlur: field.onBlur,
1753
+ onChange: (file) => {
1754
+ field.onChange(file);
1755
+ props.onFileChange?.(file);
1756
+ },
1757
+ onClear: () => {
1758
+ field.onChange(undefined);
1759
+ props.onFileChange?.(undefined);
1760
+ },
1761
+ ...props.required === undefined ? {} : { required: props.required },
1762
+ title: field.value?.name ?? props.label
1763
+ }, undefined, false, undefined, this),
1764
+ props.description && /* @__PURE__ */ jsxDEV14(FieldDescription, {
1765
+ children: props.description
1766
+ }, undefined, false, undefined, this),
1767
+ /* @__PURE__ */ jsxDEV14(FieldError, {
1768
+ error: field.error
1769
+ }, undefined, false, undefined, this)
1770
+ ]
1771
+ }, undefined, true, undefined, this);
1772
+ };
1773
+ var NullableTextAreaField = ({ field, props }) => {
1774
+ const { children, description, label, ...textareaProps } = props;
1775
+ const nativeTextareaProps = { ...textareaProps };
1776
+ delete nativeTextareaProps.original;
1777
+ return /* @__PURE__ */ jsxDEV14(Field, {
1778
+ "data-invalid": Option.isSome(field.error),
1779
+ children: [
1780
+ /* @__PURE__ */ jsxDEV14("div", {
1781
+ className: "flex w-full items-center gap-2",
1782
+ children: [
1783
+ /* @__PURE__ */ jsxDEV14(FieldLabel, {
1784
+ htmlFor: field.path,
1785
+ children: label
1786
+ }, undefined, false, undefined, this),
1787
+ children
1788
+ ]
1789
+ }, undefined, true, undefined, this),
1790
+ /* @__PURE__ */ jsxDEV14(Textarea, {
1791
+ ...nativeTextareaProps,
1792
+ id: field.path,
1793
+ name: field.path,
1794
+ value: field.value ?? "",
1795
+ onBlur: field.onBlur,
1796
+ onChange: (event) => field.onChange(event.target.value),
1797
+ "aria-invalid": Option.isSome(field.error)
1798
+ }, undefined, false, undefined, this),
1799
+ description && /* @__PURE__ */ jsxDEV14(FieldDescription, {
1800
+ children: description
1801
+ }, undefined, false, undefined, this),
1802
+ /* @__PURE__ */ jsxDEV14(FieldError, {
1803
+ error: field.error
1804
+ }, undefined, false, undefined, this)
1805
+ ]
1806
+ }, undefined, true, undefined, this);
1807
+ };
1808
+ var CheckboxField = ({
1809
+ field,
1810
+ props
1811
+ }) => /* @__PURE__ */ jsxDEV14(Field, {
1812
+ "data-invalid": Option.isSome(field.error),
1813
+ children: [
1814
+ /* @__PURE__ */ jsxDEV14("div", {
1815
+ className: "flex w-full flex-row items-center gap-2",
1816
+ children: [
1817
+ /* @__PURE__ */ jsxDEV14(Checkbox, {
1818
+ id: field.path,
1819
+ name: field.path,
1820
+ checked: field.value,
1821
+ onBlur: field.onBlur,
1822
+ onCheckedChange: field.onChange,
1823
+ "aria-invalid": Option.isSome(field.error)
1824
+ }, undefined, false, undefined, this),
1825
+ /* @__PURE__ */ jsxDEV14(FieldLabel, {
1826
+ htmlFor: field.path,
1827
+ children: props.label
1828
+ }, undefined, false, undefined, this),
1829
+ props.children
1830
+ ]
1831
+ }, undefined, true, undefined, this),
1832
+ props.description && /* @__PURE__ */ jsxDEV14(FieldDescription, {
1833
+ children: props.description
1834
+ }, undefined, false, undefined, this),
1835
+ /* @__PURE__ */ jsxDEV14(FieldError, {
1836
+ error: field.error
1837
+ }, undefined, false, undefined, this)
1838
+ ]
1839
+ }, undefined, true, undefined, this);
1840
+ var SelectField = ({
1841
+ field,
1842
+ props
1843
+ }) => /* @__PURE__ */ jsxDEV14(Field, {
1844
+ "data-invalid": Option.isSome(field.error),
1845
+ children: [
1846
+ /* @__PURE__ */ jsxDEV14(FieldLabel, {
1847
+ htmlFor: field.path,
1848
+ children: props.label
1849
+ }, undefined, false, undefined, this),
1850
+ /* @__PURE__ */ jsxDEV14(Select, {
1851
+ items: props.options,
1852
+ onValueChange: (value) => {
1853
+ if (value !== null)
1854
+ field.onChange(value);
1855
+ },
1856
+ value: field.value,
1857
+ children: [
1858
+ /* @__PURE__ */ jsxDEV14(SelectTrigger, {
1859
+ id: field.path,
1860
+ "aria-invalid": Option.isSome(field.error),
1861
+ children: /* @__PURE__ */ jsxDEV14(SelectValue, {
1862
+ placeholder: props.placeholder
1863
+ }, undefined, false, undefined, this)
1864
+ }, undefined, false, undefined, this),
1865
+ /* @__PURE__ */ jsxDEV14(SelectContent, {
1866
+ children: /* @__PURE__ */ jsxDEV14(SelectGroup, {
1867
+ children: props.options.map((option) => /* @__PURE__ */ jsxDEV14(SelectItem, {
1868
+ value: option.value,
1869
+ children: option.label
1870
+ }, option.value, false, undefined, this))
1871
+ }, undefined, false, undefined, this)
1872
+ }, undefined, false, undefined, this)
1873
+ ]
1874
+ }, undefined, true, undefined, this),
1875
+ props.description && /* @__PURE__ */ jsxDEV14(FieldDescription, {
1876
+ children: props.description
1877
+ }, undefined, false, undefined, this),
1878
+ /* @__PURE__ */ jsxDEV14(FieldError, {
1879
+ error: field.error
1880
+ }, undefined, false, undefined, this)
1881
+ ]
1882
+ }, undefined, true, undefined, this);
1883
+ var FolderField = ({
1884
+ field,
1885
+ props
1886
+ }) => /* @__PURE__ */ jsxDEV14(SelectField, {
1887
+ field,
1888
+ props: { ...props, label: effectFormMessages().folder }
1889
+ }, undefined, false, undefined, this);
1890
+ var MultiSelectField = ({
1891
+ field,
1892
+ props
1893
+ }) => /* @__PURE__ */ jsxDEV14(Field, {
1894
+ "data-invalid": Option.isSome(field.error),
1895
+ children: [
1896
+ /* @__PURE__ */ jsxDEV14(FieldLabel, {
1897
+ htmlFor: field.path,
1898
+ children: props.label
1899
+ }, undefined, false, undefined, this),
1900
+ /* @__PURE__ */ jsxDEV14(Select, {
1901
+ items: props.options,
1902
+ onValueChange: (value) => field.onChange(value ?? []),
1903
+ multiple: true,
1904
+ value: Array.from(field.value),
1905
+ children: [
1906
+ /* @__PURE__ */ jsxDEV14(SelectTrigger, {
1907
+ className: "gap-1",
1908
+ id: field.path,
1909
+ "aria-invalid": Option.isSome(field.error),
1910
+ children: /* @__PURE__ */ jsxDEV14(SelectValue, {
1911
+ placeholder: props.placeholder
1912
+ }, undefined, false, undefined, this)
1913
+ }, undefined, false, undefined, this),
1914
+ /* @__PURE__ */ jsxDEV14(SelectContent, {
1915
+ children: /* @__PURE__ */ jsxDEV14(SelectGroup, {
1916
+ children: props.options.map((option) => /* @__PURE__ */ jsxDEV14(SelectItem, {
1917
+ value: option.value,
1918
+ children: option.label
1919
+ }, option.value, false, undefined, this))
1920
+ }, undefined, false, undefined, this)
1921
+ }, undefined, false, undefined, this)
1922
+ ]
1923
+ }, undefined, true, undefined, this),
1924
+ props.description && /* @__PURE__ */ jsxDEV14(FieldDescription, {
1925
+ children: props.description
1926
+ }, undefined, false, undefined, this),
1927
+ /* @__PURE__ */ jsxDEV14(FieldError, {
1928
+ error: field.error
1929
+ }, undefined, false, undefined, this)
1930
+ ]
1931
+ }, undefined, true, undefined, this);
1932
+ var NullableMultiSelectField = ({
1933
+ field,
1934
+ props
1935
+ }) => /* @__PURE__ */ jsxDEV14(Field, {
1936
+ "data-invalid": Option.isSome(field.error),
1937
+ children: [
1938
+ /* @__PURE__ */ jsxDEV14(FieldLabel, {
1939
+ htmlFor: field.path,
1940
+ children: props.label
1941
+ }, undefined, false, undefined, this),
1942
+ /* @__PURE__ */ jsxDEV14(Select, {
1943
+ items: props.options,
1944
+ onValueChange: (value) => field.onChange(value && value.length > 0 ? value : null),
1945
+ multiple: true,
1946
+ value: field.value ? Array.from(field.value) : [],
1947
+ children: [
1948
+ /* @__PURE__ */ jsxDEV14(SelectTrigger, {
1949
+ className: "gap-1",
1950
+ id: field.path,
1951
+ "aria-invalid": Option.isSome(field.error),
1952
+ children: /* @__PURE__ */ jsxDEV14(SelectValue, {
1953
+ placeholder: props.placeholder
1954
+ }, undefined, false, undefined, this)
1955
+ }, undefined, false, undefined, this),
1956
+ /* @__PURE__ */ jsxDEV14(SelectContent, {
1957
+ children: /* @__PURE__ */ jsxDEV14(SelectGroup, {
1958
+ children: props.options.map((option) => /* @__PURE__ */ jsxDEV14(SelectItem, {
1959
+ value: option.value,
1960
+ children: option.label
1961
+ }, option.value, false, undefined, this))
1962
+ }, undefined, false, undefined, this)
1963
+ }, undefined, false, undefined, this)
1964
+ ]
1965
+ }, undefined, true, undefined, this),
1966
+ props.description && /* @__PURE__ */ jsxDEV14(FieldDescription, {
1967
+ children: props.description
1968
+ }, undefined, false, undefined, this),
1969
+ /* @__PURE__ */ jsxDEV14(FieldError, {
1970
+ error: field.error
1971
+ }, undefined, false, undefined, this)
1972
+ ]
1973
+ }, undefined, true, undefined, this);
1974
+ var getSearchableSelectItems = (values, initialItems, items) => {
1975
+ const itemsByValue = new Map([...initialItems, ...items].map((item) => [item.value, item]));
1976
+ const selectedItems = values.map((value) => itemsByValue.get(value) ?? { value, label: value });
1977
+ const selectedValues = new Set(values);
1978
+ return {
1979
+ selectedItems,
1980
+ mergedItems: [
1981
+ ...selectedItems,
1982
+ ...items.filter(({ value }) => !selectedValues.has(value))
1983
+ ]
1984
+ };
1985
+ };
1986
+ var SearchableSelectField = ({
1987
+ field,
1988
+ props
1989
+ }) => {
1990
+ const { selectedItems, mergedItems } = getSearchableSelectItems(field.value, props.initialItems ?? [], props.items);
1991
+ const invalid = Option.isSome(field.error);
1992
+ const labels = virtualizedComboboxMessages(props.messages);
1993
+ const ariaLabel = typeof props.label === "string" ? props.label : labels.search;
1994
+ return /* @__PURE__ */ jsxDEV14(Field, {
1995
+ className: "min-w-0",
1996
+ "data-invalid": invalid,
1997
+ children: [
1998
+ /* @__PURE__ */ jsxDEV14(FieldLabel, {
1999
+ htmlFor: field.path,
2000
+ children: props.label
2001
+ }, undefined, false, undefined, this),
2002
+ /* @__PURE__ */ jsxDEV14(VirtualizedCombobox, {
2003
+ ariaInvalid: invalid,
2004
+ ariaLabel,
2005
+ emptyLabel: props.emptyLabel,
2006
+ items: mergedItems,
2007
+ ...props.messages ? { messages: props.messages } : {},
2008
+ multiple: true,
2009
+ ...props.onSearchValueChange ? { onSearchValueChange: props.onSearchValueChange } : {},
2010
+ onValueChange: (options) => field.onChange(options.map(({ value }) => value)),
2011
+ placeholder: props.placeholder,
2012
+ ...props.renderItem ? { renderItem: props.renderItem } : {},
2013
+ ...props.searchValue === undefined ? {} : { searchValue: props.searchValue },
2014
+ triggerId: field.path,
2015
+ value: selectedItems
2016
+ }, undefined, false, undefined, this),
2017
+ props.description && /* @__PURE__ */ jsxDEV14(FieldDescription, {
2018
+ children: props.description
2019
+ }, undefined, false, undefined, this),
2020
+ /* @__PURE__ */ jsxDEV14(FieldError, {
2021
+ error: field.error
2022
+ }, undefined, false, undefined, this)
2023
+ ]
2024
+ }, undefined, true, undefined, this);
2025
+ };
2026
+ var SingleSearchableSelectField = ({
2027
+ field,
2028
+ props
2029
+ }) => {
2030
+ const { selectedItems, mergedItems } = getSearchableSelectItems(field.value ? [field.value] : [], props.initialItems ?? [], props.items);
2031
+ const invalid = Option.isSome(field.error);
2032
+ const labels = virtualizedComboboxMessages(props.messages);
2033
+ const ariaLabel = typeof props.label === "string" ? props.label : labels.search;
2034
+ return /* @__PURE__ */ jsxDEV14(Field, {
2035
+ className: "min-w-0",
2036
+ "data-invalid": invalid,
2037
+ children: [
2038
+ /* @__PURE__ */ jsxDEV14(FieldLabel, {
2039
+ htmlFor: field.path,
2040
+ children: props.label
2041
+ }, undefined, false, undefined, this),
2042
+ /* @__PURE__ */ jsxDEV14(VirtualizedCombobox, {
2043
+ ariaInvalid: invalid,
2044
+ ariaLabel,
2045
+ emptyLabel: props.emptyLabel,
2046
+ items: mergedItems,
2047
+ ...props.messages ? { messages: props.messages } : {},
2048
+ ...props.onSearchValueChange ? { onSearchValueChange: props.onSearchValueChange } : {},
2049
+ onValueChange: (option) => field.onChange(option?.value ?? ""),
2050
+ placeholder: props.placeholder,
2051
+ ...props.renderItem ? { renderItem: props.renderItem } : {},
2052
+ ...props.searchValue === undefined ? {} : { searchValue: props.searchValue },
2053
+ triggerId: field.path,
2054
+ value: selectedItems[0] ?? null
2055
+ }, undefined, false, undefined, this),
2056
+ props.description && /* @__PURE__ */ jsxDEV14(FieldDescription, {
2057
+ children: props.description
2058
+ }, undefined, false, undefined, this),
2059
+ /* @__PURE__ */ jsxDEV14(FieldError, {
2060
+ error: field.error
2061
+ }, undefined, false, undefined, this)
2062
+ ]
2063
+ }, undefined, true, undefined, this);
2064
+ };
2065
+ var NullableKeyValueField = ({
2066
+ field,
2067
+ props
2068
+ }) => {
2069
+ const entries = Object.entries(field.value ?? {});
2070
+ const updateEntry = (index, key, value) => Object.fromEntries(entries.map(([currentKey, currentValue], currentIndex) => currentIndex === index ? [key, value] : [currentKey, currentValue]));
2071
+ return /* @__PURE__ */ jsxDEV14(Field, {
2072
+ "data-invalid": Option.isSome(field.error),
2073
+ children: [
2074
+ /* @__PURE__ */ jsxDEV14(FieldLabel, {
2075
+ children: props.label
2076
+ }, undefined, false, undefined, this),
2077
+ entries.map(([key, value], index) => /* @__PURE__ */ jsxDEV14("div", {
2078
+ className: "flex w-full flex-row items-center gap-2",
2079
+ children: [
2080
+ /* @__PURE__ */ jsxDEV14(Input, {
2081
+ id: `${field.path}-${index}-key`,
2082
+ name: `${field.path}.${index}.key`,
2083
+ type: "text",
2084
+ className: "w-auto",
2085
+ placeholder: effectFormMessages().key,
2086
+ value: key,
2087
+ onBlur: field.onBlur,
2088
+ onChange: (event) => field.onChange(updateEntry(index, event.target.value, value)),
2089
+ "aria-invalid": Option.isSome(field.error)
2090
+ }, undefined, false, undefined, this),
2091
+ /* @__PURE__ */ jsxDEV14(Input, {
2092
+ id: `${field.path}-${index}-value`,
2093
+ name: `${field.path}.${index}.value`,
2094
+ type: "text",
2095
+ className: "w-auto flex-1",
2096
+ placeholder: effectFormMessages().value,
2097
+ value,
2098
+ onBlur: field.onBlur,
2099
+ onChange: (event) => field.onChange(updateEntry(index, key, event.target.value)),
2100
+ "aria-invalid": Option.isSome(field.error)
2101
+ }, undefined, false, undefined, this),
2102
+ /* @__PURE__ */ jsxDEV14(Button, {
2103
+ type: "button",
2104
+ variant: "secondary",
2105
+ onClick: () => field.onChange(Object.fromEntries(entries.filter((_, currentIndex) => currentIndex !== index))),
2106
+ children: [
2107
+ /* @__PURE__ */ jsxDEV14(Trash, {
2108
+ "data-icon": "inline-start"
2109
+ }, undefined, false, undefined, this),
2110
+ effectFormMessages().delete
2111
+ ]
2112
+ }, undefined, true, undefined, this)
2113
+ ]
2114
+ }, index, true, undefined, this)),
2115
+ /* @__PURE__ */ jsxDEV14(Button, {
2116
+ type: "button",
2117
+ size: "sm",
2118
+ className: "self-start",
2119
+ onClick: () => field.onChange({ ...field.value, "": "" }),
2120
+ children: [
2121
+ /* @__PURE__ */ jsxDEV14(Plus, {
2122
+ "data-icon": "inline-start"
2123
+ }, undefined, false, undefined, this),
2124
+ effectFormMessages().add
2125
+ ]
2126
+ }, undefined, true, undefined, this),
2127
+ props.description && /* @__PURE__ */ jsxDEV14(FieldDescription, {
2128
+ children: props.description
2129
+ }, undefined, false, undefined, this),
2130
+ /* @__PURE__ */ jsxDEV14(FieldError, {
2131
+ error: field.error
2132
+ }, undefined, false, undefined, this)
2133
+ ]
2134
+ }, undefined, true, undefined, this);
2135
+ };
2136
+ var KeyValueField = ({
2137
+ field,
2138
+ props
2139
+ }) => {
2140
+ const entries = Object.entries(field.value);
2141
+ const updateEntry = (index, key, value) => Object.fromEntries(entries.map(([currentKey, currentValue], currentIndex) => currentIndex === index ? [key, value] : [currentKey, currentValue]));
2142
+ return /* @__PURE__ */ jsxDEV14(Field, {
2143
+ "data-invalid": Option.isSome(field.error),
2144
+ children: [
2145
+ /* @__PURE__ */ jsxDEV14(FieldLabel, {
2146
+ children: props.label
2147
+ }, undefined, false, undefined, this),
2148
+ entries.map(([key, value], index) => /* @__PURE__ */ jsxDEV14("div", {
2149
+ className: "flex w-full flex-row items-center gap-2",
2150
+ children: [
2151
+ /* @__PURE__ */ jsxDEV14(Input, {
2152
+ id: `${field.path}-${index}-key`,
2153
+ name: `${field.path}.${index}.key`,
2154
+ type: "text",
2155
+ className: "w-auto",
2156
+ placeholder: effectFormMessages().key,
2157
+ value: key,
2158
+ onBlur: field.onBlur,
2159
+ onChange: (event) => field.onChange(updateEntry(index, event.target.value, value)),
2160
+ "aria-invalid": Option.isSome(field.error)
2161
+ }, undefined, false, undefined, this),
2162
+ /* @__PURE__ */ jsxDEV14(Input, {
2163
+ id: `${field.path}-${index}-value`,
2164
+ name: `${field.path}.${index}.value`,
2165
+ type: "text",
2166
+ className: "w-auto flex-1",
2167
+ placeholder: effectFormMessages().value,
2168
+ value,
2169
+ onBlur: field.onBlur,
2170
+ onChange: (event) => field.onChange(updateEntry(index, key, event.target.value)),
2171
+ "aria-invalid": Option.isSome(field.error)
2172
+ }, undefined, false, undefined, this),
2173
+ /* @__PURE__ */ jsxDEV14(Button, {
2174
+ type: "button",
2175
+ variant: "secondary",
2176
+ onClick: () => field.onChange(Object.fromEntries(entries.filter((_, currentIndex) => currentIndex !== index))),
2177
+ children: [
2178
+ /* @__PURE__ */ jsxDEV14(Trash, {
2179
+ "data-icon": "inline-start"
2180
+ }, undefined, false, undefined, this),
2181
+ effectFormMessages().delete
2182
+ ]
2183
+ }, undefined, true, undefined, this)
2184
+ ]
2185
+ }, index, true, undefined, this)),
2186
+ /* @__PURE__ */ jsxDEV14(Button, {
2187
+ type: "button",
2188
+ size: "sm",
2189
+ className: "self-start",
2190
+ onClick: () => field.onChange({ ...field.value, "": "" }),
2191
+ children: [
2192
+ /* @__PURE__ */ jsxDEV14(Plus, {
2193
+ "data-icon": "inline-start"
2194
+ }, undefined, false, undefined, this),
2195
+ effectFormMessages().add
2196
+ ]
2197
+ }, undefined, true, undefined, this),
2198
+ props.description && /* @__PURE__ */ jsxDEV14(FieldDescription, {
2199
+ children: props.description
2200
+ }, undefined, false, undefined, this),
2201
+ /* @__PURE__ */ jsxDEV14(FieldError, {
2202
+ error: field.error
2203
+ }, undefined, false, undefined, this)
2204
+ ]
2205
+ }, undefined, true, undefined, this);
2206
+ };
2207
+ var RevertButton = ({
2208
+ field,
2209
+ props
2210
+ }) => field.value === props.original ? null : /* @__PURE__ */ jsxDEV14("div", {
2211
+ className: "flex flex-1 justify-end",
2212
+ children: /* @__PURE__ */ jsxDEV14(Button, {
2213
+ type: "button",
2214
+ variant: "link",
2215
+ className: "-mr-4 h-auto py-0",
2216
+ onClick: () => field.onChange(props.original),
2217
+ children: effectFormMessages().revert
2218
+ }, undefined, false, undefined, this)
2219
+ }, undefined, false, undefined, this);
2220
+ var ImageField = ({ field, props }) => {
2221
+ const imageUrl = typeof field.value === "string" ? field.value : undefined;
2222
+ const invalid = Option.isSome(field.error);
2223
+ return /* @__PURE__ */ jsxDEV14(Field, {
2224
+ "data-invalid": invalid,
2225
+ children: [
2226
+ /* @__PURE__ */ jsxDEV14(FieldLabel, {
2227
+ htmlFor: field.path,
2228
+ children: props.label
2229
+ }, undefined, false, undefined, this),
2230
+ /* @__PURE__ */ jsxDEV14(FilePicker, {
2231
+ accept: "image/*",
2232
+ onBlur: field.onBlur,
2233
+ canClear: Boolean(field.value),
2234
+ ...field.value instanceof File ? { file: field.value } : {},
2235
+ ...imageUrl ? {
2236
+ image: {
2237
+ alt: props.label,
2238
+ height: props.size.height,
2239
+ src: imageUrl,
2240
+ width: props.size.width
2241
+ }
2242
+ } : {},
2243
+ id: field.path,
2244
+ invalid,
2245
+ name: field.path,
2246
+ onChange: field.onChange,
2247
+ onClear: () => field.onChange(null),
2248
+ title: field.value instanceof File ? field.value.name : props.label
2249
+ }, undefined, false, undefined, this),
2250
+ props.size.suggestedWidth && props.size.suggestedHeight ? /* @__PURE__ */ jsxDEV14(FieldDescription, {
2251
+ children: effectFormMessages().suggestedImageSize(String(props.size.suggestedWidth), String(props.size.suggestedHeight))
2252
+ }, undefined, false, undefined, this) : null,
2253
+ /* @__PURE__ */ jsxDEV14(FieldError, {
2254
+ error: field.error
2255
+ }, undefined, false, undefined, this)
2256
+ ]
2257
+ }, undefined, true, undefined, this);
2258
+ };
2259
+ var NavigationBlock = ({ shouldBlock }) => /* @__PURE__ */ jsxDEV14(Block, {
2260
+ enableBeforeUnload: () => shouldBlock,
2261
+ shouldBlockFn: () => shouldBlock,
2262
+ withResolver: true,
2263
+ children: ({ status, proceed, reset }) => /* @__PURE__ */ jsxDEV14(AlertDialog, {
2264
+ open: status === "blocked",
2265
+ children: /* @__PURE__ */ jsxDEV14(AlertDialogContent, {
2266
+ children: [
2267
+ /* @__PURE__ */ jsxDEV14(AlertDialogHeader, {
2268
+ children: [
2269
+ /* @__PURE__ */ jsxDEV14(AlertDialogTitle, {
2270
+ children: effectFormMessages().blockNavigationTitle
2271
+ }, undefined, false, undefined, this),
2272
+ /* @__PURE__ */ jsxDEV14(AlertDialogDescription, {
2273
+ children: effectFormMessages().blockNavigationDescription
2274
+ }, undefined, false, undefined, this)
2275
+ ]
2276
+ }, undefined, true, undefined, this),
2277
+ /* @__PURE__ */ jsxDEV14(AlertDialogFooter, {
2278
+ children: [
2279
+ /* @__PURE__ */ jsxDEV14(AlertDialogCancel, {
2280
+ onClick: reset,
2281
+ children: effectFormMessages().blockNavigationCancel
2282
+ }, undefined, false, undefined, this),
2283
+ /* @__PURE__ */ jsxDEV14(AlertDialogAction, {
2284
+ onClick: proceed,
2285
+ children: effectFormMessages().blockNavigationConfirm
2286
+ }, undefined, false, undefined, this)
2287
+ ]
2288
+ }, undefined, true, undefined, this)
2289
+ ]
2290
+ }, undefined, true, undefined, this)
2291
+ }, undefined, false, undefined, this)
2292
+ }, undefined, false, undefined, this);
2293
+ var FormBlockNavigation = ({ form }) => {
2294
+ const submitResult = useAtomValue(form.submit);
2295
+ const isDirty = useAtomValue(form.isDirty);
2296
+ const hasChangedSinceSubmit = useAtomValue(form.hasChangedSinceSubmit);
2297
+ const lastSubmittedValues = useAtomValue(form.lastSubmittedValues);
2298
+ const shouldBlock = !submitResult.waiting && isDirty && (Option.isNone(lastSubmittedValues) || hasChangedSinceSubmit);
2299
+ return /* @__PURE__ */ jsxDEV14(NavigationBlock, {
2300
+ shouldBlock
2301
+ }, undefined, false, undefined, this);
2302
+ };
2303
+ var BlockNavigation = ({ form }) => /* @__PURE__ */ jsxDEV14(FormBlockNavigation, {
2304
+ form
2305
+ }, undefined, false, undefined, this);
2306
+ export {
2307
+ effectFormMessages,
2308
+ TextField,
2309
+ TextAreaField,
2310
+ SubmitError,
2311
+ SubmitButton,
2312
+ SingleSearchableSelectField,
2313
+ SelectField,
2314
+ SearchableSelectField,
2315
+ RevertButton,
2316
+ NullableTextAreaField,
2317
+ NullableMultiSelectField,
2318
+ NullableKeyValueField,
2319
+ NameField,
2320
+ MultiSelectField,
2321
+ KeyValueField,
2322
+ ImageField,
2323
+ FolderField,
2324
+ FileField,
2325
+ FieldWrapper,
2326
+ ErrorMessage,
2327
+ DescriptionField,
2328
+ CheckboxField,
2329
+ BlockNavigation
2330
+ };