@ht-rnd/json-schema-editor 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -302
- package/dist/lib/main.es.js +3 -3
- package/dist/lib/main.umd.js +3 -3
- package/dist/types/lib/index.d.ts +2 -1
- package/package.json +2 -10
package/README.md
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
# @ht-rnd/json-schema-editor
|
|
2
2
|
|
|
3
|
-
A headless JSON Schema editor
|
|
3
|
+
A powerful **headless** JSON Schema editor for React. Build fully customized editors with complete UI control while leveraging battle-tested logic, validation, and state management.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> **Headless Architecture**: Core logic via npm + optional copy-paste UI components. Use our pre-built Shadcn/ui components or build your own interface.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Features
|
|
8
8
|
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
9
|
+
- **JSON Schema Draft 2020-12** - Full specification support
|
|
10
|
+
- **All Types** - string, number, integer, boolean, object, array, $ref
|
|
11
|
+
- **Nested Schemas** - Unlimited depth for objects and arrays
|
|
12
|
+
- **$defs Support** - Reusable definitions with `$ref`
|
|
13
|
+
- **Validation** - AJV-powered real-time validation
|
|
14
|
+
- **Combinators** - allOf, anyOf, oneOf, not
|
|
15
|
+
- **TypeScript** - Full type safety
|
|
16
|
+
- **Headless** - Zero UI dependencies in core
|
|
11
17
|
|
|
12
18
|
## Installation
|
|
13
19
|
|
|
@@ -15,170 +21,47 @@ This library follows the **headless UI pattern**:
|
|
|
15
21
|
npm install @ht-rnd/json-schema-editor
|
|
16
22
|
```
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Copy the `components/json-schema-editor/` folder from this repository into your project. These components are designed to be customized and follow [shadcn/ui](https://ui.shadcn.com/) principles.
|
|
21
|
-
|
|
22
|
-
**Required peer dependencies for UI components:**
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npm install @radix-ui/react-alert-dialog @radix-ui/react-checkbox @radix-ui/react-dialog \
|
|
26
|
-
@radix-ui/react-label @radix-ui/react-radio-group @radix-ui/react-select \
|
|
27
|
-
@radix-ui/react-separator @radix-ui/react-slot @radix-ui/react-tooltip \
|
|
28
|
-
class-variance-authority clsx lucide-react tailwind-merge tailwindcss-animate
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Features
|
|
32
|
-
|
|
33
|
-
### Core Capabilities
|
|
34
|
-
|
|
35
|
-
- **JSON Schema 2020-12** - Full support for draft 2020-12 specification
|
|
36
|
-
- **Multiple Data Types** - string, number, integer, boolean, object, array, and $ref
|
|
37
|
-
- **Nested Schemas** - Support for nested objects and arrays with unlimited depth
|
|
38
|
-
- **Definitions ($defs)** - Create reusable schema definitions with $ref support
|
|
39
|
-
- **Validation Constraints** - min/max, length, format, pattern, enum, and more
|
|
40
|
-
- **Boolean Combinators** - allOf, anyOf, oneOf, not for complex schema logic
|
|
41
|
-
- **Real-time Validation** - AJV-based validation with inline error messages
|
|
42
|
-
- **Type Safety** - Full TypeScript support with comprehensive type definitions
|
|
43
|
-
|
|
44
|
-
### UI Features (Pre-built Components)
|
|
45
|
-
|
|
46
|
-
- **Responsive Layout** - Configurable form and output positioning (top/bottom/left/right)
|
|
47
|
-
- **Customizable Sizing** - Flexible width and height options (sm/md/lg/full)
|
|
48
|
-
- **Dark Mode Ready** - Theme prop support for dark/light mode
|
|
49
|
-
- **Read-only Mode** - View-only mode for displaying schemas
|
|
50
|
-
- **Settings Dialogs** - Rich settings for each field type with type-specific options
|
|
51
|
-
- **Inline Editing** - Direct field manipulation with instant feedback
|
|
52
|
-
|
|
53
|
-
## Usage
|
|
54
|
-
|
|
55
|
-
### Option 1: Using the Headless Hook (Full Control)
|
|
56
|
-
|
|
57
|
-
Use the `useJsonSchemaEditor` hook directly for complete control over the UI:
|
|
58
|
-
|
|
59
|
-
```tsx
|
|
60
|
-
import { useJsonSchemaEditor } from "@ht-rnd/json-schema-editor";
|
|
61
|
-
import { FormProvider } from "react-hook-form";
|
|
62
|
-
|
|
63
|
-
function MyCustomEditor() {
|
|
64
|
-
const editor = useJsonSchemaEditor({
|
|
65
|
-
rootType: "object",
|
|
66
|
-
onChange: (schema) => console.log("Schema changed:", schema),
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<FormProvider {...editor.form}>
|
|
71
|
-
<div>
|
|
72
|
-
{/* Your custom UI here */}
|
|
73
|
-
<pre>{JSON.stringify(editor.schema, null, 2)}</pre>
|
|
74
|
-
|
|
75
|
-
<button onClick={editor.addField}>Add Field</button>
|
|
76
|
-
<button onClick={editor.addDefinition}>Add Definition</button>
|
|
77
|
-
|
|
78
|
-
{editor.fields.map((field, index) => (
|
|
79
|
-
<div key={field.id}>
|
|
80
|
-
{/* Render your custom field UI */}
|
|
81
|
-
<input value={field.key} />
|
|
82
|
-
<button onClick={() => editor.removeField(index)}>Remove</button>
|
|
83
|
-
<button onClick={() => editor.openSettings(`properties.${index}`)}>Settings</button>
|
|
84
|
-
</div>
|
|
85
|
-
))}
|
|
86
|
-
|
|
87
|
-
{editor.definitions.map((def, index) => (
|
|
88
|
-
<div key={def.id}>
|
|
89
|
-
<input value={def.key} />
|
|
90
|
-
<button onClick={() => editor.removeDefinition(index)}>Remove</button>
|
|
91
|
-
</div>
|
|
92
|
-
))}
|
|
93
|
-
|
|
94
|
-
{editor.errors && (
|
|
95
|
-
<div>
|
|
96
|
-
{editor.errors.map((error, i) => (
|
|
97
|
-
<p key={i}>{error.message}</p>
|
|
98
|
-
))}
|
|
99
|
-
</div>
|
|
100
|
-
)}
|
|
101
|
-
</div>
|
|
102
|
-
</FormProvider>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
```
|
|
24
|
+
**Optional UI components**: Copy `components/ui/` from this repo to your project. Requires Radix UI and Tailwind CSS.
|
|
106
25
|
|
|
107
|
-
|
|
26
|
+
## Quick Start
|
|
108
27
|
|
|
109
|
-
|
|
28
|
+
### Option 1: Pre-built Components
|
|
110
29
|
|
|
111
30
|
```tsx
|
|
112
|
-
import { JsonSchemaEditor } from "@/components/json-schema-editor";
|
|
31
|
+
import { JsonSchemaEditor } from "@/components/ui/json-schema-editor";
|
|
113
32
|
|
|
114
33
|
function App() {
|
|
115
34
|
return (
|
|
116
35
|
<JsonSchemaEditor
|
|
117
36
|
rootType="object"
|
|
118
|
-
theme="light"
|
|
119
|
-
readOnly={false}
|
|
120
|
-
showOutput={true}
|
|
121
37
|
onChange={(schema) => console.log(schema)}
|
|
122
|
-
styles={{
|
|
123
|
-
form: { width: "full", height: "md" },
|
|
124
|
-
output: { position: "bottom", showJson: true, width: "full", height: "md" },
|
|
125
|
-
settings: { width: "md" },
|
|
126
|
-
spacing: "md",
|
|
127
|
-
}}
|
|
128
38
|
/>
|
|
129
39
|
);
|
|
130
40
|
}
|
|
131
41
|
```
|
|
132
42
|
|
|
133
|
-
### Option
|
|
134
|
-
|
|
135
|
-
Use the headless hook with some pre-built components:
|
|
43
|
+
### Option 2: Headless Hook
|
|
136
44
|
|
|
137
45
|
```tsx
|
|
138
46
|
import { useJsonSchemaEditor } from "@ht-rnd/json-schema-editor";
|
|
139
|
-
import { Root, FieldList, SettingsDialog } from "@/components/json-schema-editor";
|
|
140
47
|
import { FormProvider } from "react-hook-form";
|
|
141
48
|
|
|
142
|
-
function
|
|
143
|
-
const editor = useJsonSchemaEditor({
|
|
49
|
+
function App() {
|
|
50
|
+
const editor = useJsonSchemaEditor({
|
|
51
|
+
rootType: "object",
|
|
52
|
+
onChange: (schema) => console.log(schema),
|
|
53
|
+
});
|
|
144
54
|
|
|
145
55
|
return (
|
|
146
56
|
<FormProvider {...editor.form}>
|
|
147
|
-
<
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
fields={editor.fields}
|
|
156
|
-
onRemove={editor.removeField}
|
|
157
|
-
onOpenSettings={editor.openSettings}
|
|
158
|
-
/>
|
|
159
|
-
|
|
160
|
-
{/* Add definitions support */}
|
|
161
|
-
{editor.definitions.length > 0 && (
|
|
162
|
-
<div className="mt-4">
|
|
163
|
-
<h3>Definitions ($defs)</h3>
|
|
164
|
-
{editor.definitions.map((def, index) => (
|
|
165
|
-
<div key={def.id}>
|
|
166
|
-
<span>{def.key}</span>
|
|
167
|
-
<button onClick={() => editor.removeDefinition(index)}>Remove</button>
|
|
168
|
-
</div>
|
|
169
|
-
))}
|
|
170
|
-
</div>
|
|
171
|
-
)}
|
|
172
|
-
|
|
173
|
-
{/* Your custom JSON output */}
|
|
174
|
-
<textarea value={JSON.stringify(editor.schema, null, 2)} readOnly />
|
|
175
|
-
|
|
176
|
-
<SettingsDialog
|
|
177
|
-
isOpen={editor.settingsState.isOpen}
|
|
178
|
-
fieldPath={editor.settingsState.fieldPath}
|
|
179
|
-
onClose={editor.closeSettings}
|
|
180
|
-
/>
|
|
181
|
-
</div>
|
|
57
|
+
<button onClick={editor.addField}>Add Field</button>
|
|
58
|
+
{editor.fields.map((field, index) => (
|
|
59
|
+
<div key={field.id}>
|
|
60
|
+
<input value={field.key} />
|
|
61
|
+
<button onClick={() => editor.removeField(index)}>Remove</button>
|
|
62
|
+
</div>
|
|
63
|
+
))}
|
|
64
|
+
<pre>{JSON.stringify(editor.schema, null, 2)}</pre>
|
|
182
65
|
</FormProvider>
|
|
183
66
|
);
|
|
184
67
|
}
|
|
@@ -186,71 +69,53 @@ function HybridEditor() {
|
|
|
186
69
|
|
|
187
70
|
## API Reference
|
|
188
71
|
|
|
189
|
-
### `
|
|
190
|
-
|
|
191
|
-
The pre-built React component with full UI implementation.
|
|
192
|
-
|
|
193
|
-
#### Props
|
|
194
|
-
|
|
195
|
-
| Property | Type | Default | Description |
|
|
196
|
-
|----------|------|---------|-------------|
|
|
197
|
-
| `rootType` | `"object" \| "array"` | `"object"` | Root schema type |
|
|
198
|
-
| `defaultValue` | `JSONSchema` | - | Initial schema value |
|
|
199
|
-
| `onChange` | `(schema: JSONSchema) => void` | - | Callback when schema changes |
|
|
200
|
-
| `readOnly` | `boolean` | `false` | Make all inputs read-only |
|
|
201
|
-
| `showOutput` | `boolean` | `true` | Show/hide output panel |
|
|
202
|
-
| `theme` | `string` | `"light"` | Theme class for styling |
|
|
203
|
-
| `styles` | `Partial<Styles>` | - | Layout and sizing configuration |
|
|
204
|
-
| `className` | `string` | - | Additional CSS classes |
|
|
72
|
+
### `useJsonSchemaEditor(options)`
|
|
205
73
|
|
|
206
|
-
|
|
74
|
+
Main hook for editor state management.
|
|
207
75
|
|
|
76
|
+
**Options:**
|
|
208
77
|
```typescript
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
showJson: boolean;
|
|
214
|
-
width: "sm" | "md" | "lg" | "full";
|
|
215
|
-
height: "sm" | "md" | "lg" | "full";
|
|
216
|
-
};
|
|
217
|
-
settings: { width: "sm" | "md" | "lg" | "full" };
|
|
218
|
-
spacing: "sm" | "md" | "lg";
|
|
78
|
+
{
|
|
79
|
+
rootType?: "object" | "array"; // Default: "object"
|
|
80
|
+
defaultValue?: JSONSchema; // Load existing schema
|
|
81
|
+
onChange?: (schema: JSONSchema) => void;
|
|
219
82
|
}
|
|
220
83
|
```
|
|
221
84
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
85
|
+
**Returns:**
|
|
86
|
+
```typescript
|
|
87
|
+
{
|
|
88
|
+
// State
|
|
89
|
+
schema: JSONSchema;
|
|
90
|
+
errors: ErrorObject[] | null;
|
|
91
|
+
fields: FieldItem[];
|
|
92
|
+
definitions: DefinitionItem[];
|
|
93
|
+
form: UseFormReturn;
|
|
94
|
+
settingsState: { isOpen: boolean; fieldPath: string | null };
|
|
95
|
+
|
|
96
|
+
// Actions
|
|
97
|
+
addField: () => void;
|
|
98
|
+
removeField: (index: number) => void;
|
|
99
|
+
addDefinition: () => void;
|
|
100
|
+
removeDefinition: (index: number) => void;
|
|
101
|
+
openSettings: (path: string) => void;
|
|
102
|
+
closeSettings: () => void;
|
|
103
|
+
handleTypeChange: (path: string, type: string) => void;
|
|
104
|
+
addNestedField: (parentPath: string) => void;
|
|
105
|
+
reset: () => void;
|
|
106
|
+
}
|
|
107
|
+
```
|
|
225
108
|
|
|
226
|
-
|
|
109
|
+
### `JsonSchemaEditor` Component Props
|
|
227
110
|
|
|
228
|
-
|
|
|
229
|
-
|
|
111
|
+
| Prop | Type | Default | Description |
|
|
112
|
+
|------|------|---------|-------------|
|
|
230
113
|
| `rootType` | `"object" \| "array"` | `"object"` | Root schema type |
|
|
231
|
-
| `defaultValue` | `JSONSchema` | - | Initial schema
|
|
232
|
-
| `onChange` | `(schema
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
| Property | Type | Description |
|
|
237
|
-
|----------|------|-------------|
|
|
238
|
-
| `schema` | `JSONSchema` | Current JSON Schema output |
|
|
239
|
-
| `errors` | `ErrorObject[] \| null` | AJV validation errors |
|
|
240
|
-
| `fields` | `FieldItem[]` | Field array for iteration |
|
|
241
|
-
| `definitions` | `DefinitionItem[]` | Definition array for $defs |
|
|
242
|
-
| `form` | `UseFormReturn` | React Hook Form methods |
|
|
243
|
-
| `settingsState` | `{ isOpen, fieldPath }` | Settings dialog state |
|
|
244
|
-
| `addField()` | `() => void` | Add a new field |
|
|
245
|
-
| `removeField(index)` | `(index: number) => void` | Remove field by index |
|
|
246
|
-
| `addDefinition()` | `() => void` | Add a new definition to $defs |
|
|
247
|
-
| `removeDefinition(index)` | `(index: number) => void` | Remove definition by index |
|
|
248
|
-
| `updateReferences(oldKey, newKey)` | `(oldKey: string, newKey: string \| null) => void` | Update $ref references when definition key changes |
|
|
249
|
-
| `openSettings(path)` | `(path: string) => void` | Open settings for a field |
|
|
250
|
-
| `closeSettings()` | `() => void` | Close settings dialog |
|
|
251
|
-
| `handleTypeChange(path, type)` | `(path: string, type: string) => void` | Change field type |
|
|
252
|
-
| `addNestedField(parentPath)` | `(parentPath: string) => void` | Add a nested field to an object |
|
|
253
|
-
| `reset()` | `() => void` | Reset to default state |
|
|
114
|
+
| `defaultValue` | `JSONSchema` | - | Initial schema to load |
|
|
115
|
+
| `onChange` | `(schema) => void` | - | Callback on schema change |
|
|
116
|
+
| `readOnly` | `boolean` | `false` | View-only mode |
|
|
117
|
+
| `showOutput` | `boolean` | `true` | Show/hide JSON output |
|
|
118
|
+
| `className` | `string` | - | Additional CSS classes |
|
|
254
119
|
|
|
255
120
|
### Exports
|
|
256
121
|
|
|
@@ -259,124 +124,70 @@ The main headless hook for managing JSON Schema editor state.
|
|
|
259
124
|
export { useJsonSchemaEditor } from "@ht-rnd/json-schema-editor";
|
|
260
125
|
|
|
261
126
|
// Types
|
|
262
|
-
export type {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
SettingsState,
|
|
267
|
-
FieldItem,
|
|
268
|
-
DefinitionItem,
|
|
269
|
-
SchemaType,
|
|
270
|
-
SchemaTypeValue,
|
|
271
|
-
SchemaTypeWithRefValue,
|
|
272
|
-
UseJsonSchemaEditorReturn,
|
|
273
|
-
} from "@ht-rnd/json-schema-editor";
|
|
274
|
-
|
|
275
|
-
// Validation
|
|
276
|
-
export { validateSchema } from "@ht-rnd/json-schema-editor";
|
|
277
|
-
export { jsonSchemaZod } from "@ht-rnd/json-schema-editor";
|
|
127
|
+
export type { JSONSchema, FieldItem, DefinitionItem, UseJsonSchemaEditorReturn };
|
|
128
|
+
|
|
129
|
+
// Utilities
|
|
130
|
+
export { validateSchema, formToSchema, schemaToForm };
|
|
278
131
|
|
|
279
132
|
// Constants
|
|
280
|
-
export {
|
|
281
|
-
SCHEMA_TYPES,
|
|
282
|
-
SCHEMA_TYPES_WITH_REF,
|
|
283
|
-
INTEGER_FORMATS,
|
|
284
|
-
NUMBER_FORMATS,
|
|
285
|
-
STRING_FORMATS,
|
|
286
|
-
DEFAULT_SCHEMA_URI,
|
|
287
|
-
} from "@ht-rnd/json-schema-editor";
|
|
288
|
-
|
|
289
|
-
// Transforms and utilities
|
|
290
|
-
export { formToSchema, schemaToForm } from "@ht-rnd/json-schema-editor";
|
|
291
|
-
export {
|
|
292
|
-
createDefaultObjectSchema,
|
|
293
|
-
createDefaultArraySchema,
|
|
294
|
-
createDefaultField,
|
|
295
|
-
} from "@ht-rnd/json-schema-editor";
|
|
133
|
+
export { SCHEMA_TYPES, STRING_FORMATS, NUMBER_FORMATS, INTEGER_FORMATS };
|
|
296
134
|
```
|
|
297
135
|
|
|
298
|
-
##
|
|
136
|
+
## Examples
|
|
299
137
|
|
|
300
|
-
###
|
|
138
|
+
### Load Existing Schema
|
|
301
139
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
- `BoolCombSettings` - allOf/anyOf/oneOf/not settings
|
|
317
|
-
- `DefinitionsSettings` - $defs management
|
|
318
|
-
- `RootSettings` - Root schema settings
|
|
319
|
-
|
|
320
|
-
#### UI Primitives
|
|
321
|
-
All based on [shadcn/ui](https://ui.shadcn.com/): `Button`, `Input`, `Select`, `Checkbox`, `Dialog`, `Badge`, `Tooltip`, etc.
|
|
322
|
-
|
|
323
|
-
## Customizing Components
|
|
140
|
+
```tsx
|
|
141
|
+
const editor = useJsonSchemaEditor({
|
|
142
|
+
rootType: "object",
|
|
143
|
+
defaultValue: {
|
|
144
|
+
type: "object",
|
|
145
|
+
properties: {
|
|
146
|
+
username: { type: "string", minLength: 3 },
|
|
147
|
+
email: { type: "string", format: "email" },
|
|
148
|
+
age: { type: "integer", minimum: 18 }
|
|
149
|
+
},
|
|
150
|
+
required: ["username", "email"]
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
```
|
|
324
154
|
|
|
325
|
-
|
|
155
|
+
### Validate Data Against Schema
|
|
326
156
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
3. **`forwardRef`**: Components forward refs for DOM access
|
|
330
|
-
4. **Composable**: Use individual components or compose your own
|
|
331
|
-
5. **Copy & Modify**: Copy components into your project and customize as needed
|
|
157
|
+
```tsx
|
|
158
|
+
import Ajv from "ajv";
|
|
332
159
|
|
|
333
|
-
|
|
160
|
+
const ajv = new Ajv();
|
|
161
|
+
const validate = ajv.compile(editor.schema);
|
|
162
|
+
const valid = validate({ username: "john", email: "john@example.com" });
|
|
334
163
|
|
|
335
|
-
|
|
336
|
-
import { FieldRow } from "@/components/json-schema-editor";
|
|
337
|
-
|
|
338
|
-
<FieldRow
|
|
339
|
-
className="bg-slate-50 dark:bg-slate-900 rounded-lg"
|
|
340
|
-
fieldPath="properties.0"
|
|
341
|
-
theme="dark"
|
|
342
|
-
// ... other props
|
|
343
|
-
/>
|
|
164
|
+
if (!valid) console.log(validate.errors);
|
|
344
165
|
```
|
|
345
166
|
|
|
346
|
-
###
|
|
167
|
+
### Persist Schema Changes
|
|
347
168
|
|
|
348
169
|
```tsx
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
170
|
+
const editor = useJsonSchemaEditor({
|
|
171
|
+
onChange: (schema) => {
|
|
172
|
+
localStorage.setItem("schema", JSON.stringify(schema));
|
|
173
|
+
// Or send to API
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
```
|
|
353
177
|
|
|
354
|
-
|
|
355
|
-
fieldPath: string;
|
|
356
|
-
}
|
|
178
|
+
## Contributing
|
|
357
179
|
|
|
358
|
-
|
|
359
|
-
({ className, fieldPath, ...props }, ref) => {
|
|
360
|
-
const { control } = useFormContext();
|
|
361
|
-
|
|
362
|
-
return (
|
|
363
|
-
<div ref={ref} className={cn("flex gap-2", className)} {...props}>
|
|
364
|
-
<Controller
|
|
365
|
-
control={control}
|
|
366
|
-
name={`${fieldPath}.key`}
|
|
367
|
-
render={({ field }) => (
|
|
368
|
-
<Input {...field} placeholder="Field name" />
|
|
369
|
-
)}
|
|
370
|
-
/>
|
|
371
|
-
</div>
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
);
|
|
375
|
-
MyCustomField.displayName = "MyCustomField";
|
|
180
|
+
Contributions welcome! See [GitHub](https://github.com/ht-rnd/json-schema-editor) for issues and PRs.
|
|
376
181
|
|
|
377
|
-
|
|
182
|
+
```bash
|
|
183
|
+
git clone https://github.com/ht-rnd/json-schema-editor.git
|
|
184
|
+
npm install
|
|
185
|
+
npm test
|
|
186
|
+
npm run demo
|
|
378
187
|
```
|
|
379
188
|
|
|
380
189
|
## License
|
|
381
190
|
|
|
382
|
-
Apache-2.0
|
|
191
|
+
Apache-2.0 © [HT-RND]
|
|
192
|
+
|
|
193
|
+
See [LICENSE](./LICENSE) for more details.
|
package/dist/lib/main.es.js
CHANGED
|
@@ -870,7 +870,7 @@ class Wc {
|
|
|
870
870
|
const Yc = {
|
|
871
871
|
major: 4,
|
|
872
872
|
minor: 3,
|
|
873
|
-
patch:
|
|
873
|
+
patch: 6
|
|
874
874
|
}, ve = /* @__PURE__ */ V("$ZodType", (e, t) => {
|
|
875
875
|
var r;
|
|
876
876
|
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = Yc;
|
|
@@ -1521,7 +1521,7 @@ const Tu = /* @__PURE__ */ V("$ZodRecord", (e, t) => {
|
|
|
1521
1521
|
let c = t.keyType._zod.run({ value: i, issues: [] }, n);
|
|
1522
1522
|
if (c instanceof Promise)
|
|
1523
1523
|
throw new Error("Async schemas not supported in object keys currently");
|
|
1524
|
-
if (typeof i == "string" && Ma.test(i) && c.issues.length
|
|
1524
|
+
if (typeof i == "string" && Ma.test(i) && c.issues.length) {
|
|
1525
1525
|
const g = t.keyType._zod.run({ value: Number(i), issues: [] }, n);
|
|
1526
1526
|
if (g instanceof Promise)
|
|
1527
1527
|
throw new Error("Async schemas not supported in object keys currently");
|
|
@@ -2361,7 +2361,7 @@ function Qa(e, t) {
|
|
|
2361
2361
|
if (h.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (c.allOf = c.allOf ?? [], c.allOf.push(h)) : Object.assign(c, h), Object.assign(c, u), a._zod.parent === f)
|
|
2362
2362
|
for (const S in c)
|
|
2363
2363
|
S === "$ref" || S === "allOf" || S in u || delete c[S];
|
|
2364
|
-
if (h.$ref)
|
|
2364
|
+
if (h.$ref && m.def)
|
|
2365
2365
|
for (const S in c)
|
|
2366
2366
|
S === "$ref" || S === "allOf" || S in m.def && JSON.stringify(c[S]) === JSON.stringify(m.def[S]) && delete c[S];
|
|
2367
2367
|
}
|
package/dist/lib/main.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(Se,ee){typeof exports=="object"&&typeof module<"u"?ee(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],ee):(Se=typeof globalThis<"u"?globalThis:Se||self,ee(Se["json-schema-editor"]={},Se.React))})(this,(function(Se,ee){"use strict";const us=["string","integer","number","boolean","object","array"],Ia=[...us,"ref"],Ca=["int-32","int-64"],Da=["float","double","big-decimal"],Va=["date","date-time","local-date-time","time","duration","email","hostname","ipv4","ipv6","password","html","json","json-path","uri","uri-refrence","uri-template","relative-json-pointer","json-pointer","regex","uuid"],fn="http://json-schema.org/draft/2020-12/schema",Fa=()=>({type:"object",$schema:fn,additionalProperties:!0}),Ma=()=>({type:"array",$schema:fn,items:{type:"string"}}),qa=e=>({id:e,key:`field_${e}`,isRequired:!1,schema:{type:"string"}}),Za="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Qe=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Za[r[e]&63];return t};const hn=e=>{const t=i=>{if(i==null||i==="")return;if(typeof i!="object"||i instanceof Date)return i;if(Array.isArray(i))return i.map(t).filter(c=>c!==void 0);const a={};for(const c in i){const u=t(i[c]);u!==void 0&&(a[c]=u)}return a},r=i=>{if(i.type==="ref"&&i.$ref)return t({$ref:i.$ref,...i.title&&{title:i.title},...i.description&&{description:i.description}});const a={...i};if(a.type==="ref"&&delete a.type,Array.isArray(a.properties)){const c={},u=[];a.properties.forEach(f=>{f.key&&(c[f.key]=r(f.schema),f.isRequired&&u.push(f.key))}),a.properties=c,u.length>0&&(a.required=u)}return typeof a.items=="object"&&a.items!==null&&!Array.isArray(a.items)?a.items=r(a.items):Array.isArray(a.items)&&(a.items=a.items.map(c=>r(c))),t(a)},n={...r(e.root)},s={},o=[];if(e.properties.forEach(i=>{i.key&&(s[i.key]=r(i.schema),i.isRequired&&o.push(i.key))}),Object.keys(s).length>0&&(n.properties=s),o.length>0&&(n.required=o),e.definitions&&e.definitions.length>0){const i={};e.definitions.forEach(a=>{a.key&&(i[a.key]=r(a.schema))}),n.$defs=i}return n},ds=e=>{const t=u=>{const f={...u};if(f.$ref&&(f.type="ref"),typeof f.properties=="object"&&!Array.isArray(f.properties)){const g=[];Object.keys(f.properties).forEach(m=>{const h=f.properties[m];g.push({id:Qe(6),key:m,isRequired:f.required?.includes(m)||!1,schema:t(h)})}),f.properties=g}return typeof f.items=="object"&&f.items!==null&&!Array.isArray(f.items)?f.items=t(f.items):Array.isArray(f.items)&&(f.items=f.items.map(g=>t(g))),f},{properties:r,required:n,$defs:s,...o}=e,i=t(o),a=[];r&&Object.keys(r).forEach(u=>{a.push({id:Qe(6),key:u,isRequired:n?.includes(u)||!1,schema:t(r[u])})});const c=[];return s&&Object.keys(s).forEach(u=>{c.push({id:Qe(6),key:u,schema:t(s[u])})}),{root:i,properties:a,definitions:c}};function V(e,t,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=i.prototype,f=Object.keys(u);for(let g=0;g<f.length;g++){const m=f[g];m in a||(a[m]=u[m].bind(a))}}const s=r?.Parent??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function i(a){var c;const u=r?.Parent?new o:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const f of u._zod.deferred)f();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class vt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ls extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const fs={};function st(e){return fs}function hs(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}function mn(e,t){return typeof t=="bigint"?t.toString():t}function pn(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function yn(e){return e==null}function _n(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ua(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let s=(n.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(n)){const c=n.match(/\d?e-(\d?)/);c?.[1]&&(s=Number.parseInt(c[1]))}const o=r>s?r:s,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}const ms=Symbol("evaluating");function de(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ms)return n===void 0&&(n=ms,n=r()),n},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function ht(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ot(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function ps(e){return JSON.stringify(e)}function La(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ys="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Zt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ka=pn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function $t(e){if(Zt(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Zt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function _s(e){return $t(e)?{...e}:Array.isArray(e)?[...e]:e}const xa=new Set(["string","number","symbol"]);function Ut(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function it(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function te(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Ja(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Ha={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ga(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=ot(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return ht(this,"shape",i),i},checks:[]});return it(e,o)}function Ba(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=ot(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return ht(this,"shape",i),i},checks:[]});return it(e,o)}function Wa(e,t){if(!$t(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const o=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=ot(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return ht(this,"shape",o),o}});return it(e,s)}function Ya(e,t){if(!$t(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=ot(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return ht(this,"shape",n),n}});return it(e,r)}function Xa(e,t){const r=ot(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return ht(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return it(e,r)}function Qa(e,t,r){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=ot(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(r)for(const u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return ht(this,"shape",c),c},checks:[]});return it(t,i)}function ec(e,t,r){const n=ot(t._zod.def,{get shape(){const s=t._zod.def.shape,o={...s};if(r)for(const i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(o[i]=new e({type:"nonoptional",innerType:s[i]}))}else for(const i in s)o[i]=new e({type:"nonoptional",innerType:s[i]});return ht(this,"shape",o),o}});return it(t,n)}function bt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function wt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Lt(e){return typeof e=="string"?e:e?.message}function at(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const s=Lt(e.inst?._zod.def?.error?.(e))??Lt(t?.error?.(e))??Lt(r.customError?.(e))??Lt(r.localeError?.(e))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function gn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Tt(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const gs=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,mn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},vn=V("$ZodError",gs),Kt=V("$ZodError",gs,{Parent:Error});function tc(e,t=r=>r.message){const r={},n=[];for(const s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}function rc(e,t=r=>r.message){const r={_errors:[]},n=s=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(i=>n({issues:i}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let i=r,a=0;for(;a<o.path.length;){const c=o.path[a];a===o.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(o))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return n(e),r}const xt=e=>(t,r,n,s)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new vt;if(i.issues.length){const a=new(s?.Err??e)(i.issues.map(c=>at(c,o,st())));throw ys(a,s?.callee),a}return i.value},nc=xt(Kt),Jt=e=>async(t,r,n,s)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(s?.Err??e)(i.issues.map(c=>at(c,o,st())));throw ys(a,s?.callee),a}return i.value},sc=Jt(Kt),Ht=e=>(t,r,n)=>{const s=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new vt;return o.issues.length?{success:!1,error:new(e??vn)(o.issues.map(i=>at(i,s,st())))}:{success:!0,data:o.value}},oc=Ht(Kt),Gt=e=>async(t,r,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(i=>at(i,s,st())))}:{success:!0,data:o.value}},ic=Gt(Kt),ac=e=>(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return xt(e)(t,r,s)},cc=e=>(t,r,n)=>xt(e)(t,r,n),uc=e=>async(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Jt(e)(t,r,s)},dc=e=>async(t,r,n)=>Jt(e)(t,r,n),lc=e=>(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ht(e)(t,r,s)},fc=e=>(t,r,n)=>Ht(e)(t,r,n),hc=e=>async(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Gt(e)(t,r,s)},mc=e=>async(t,r,n)=>Gt(e)(t,r,n),pc=/^[cC][^\s-]{8,}$/,yc=/^[0-9a-z]+$/,_c=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,gc=/^[0-9a-vA-V]{20}$/,vc=/^[A-Za-z0-9]{27}$/,$c=/^[a-zA-Z0-9_-]{21}$/,bc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,wc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,vs=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Sc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ec="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function kc(){return new RegExp(Ec,"u")}const Pc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Oc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,zc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ac=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$s=/^[A-Za-z0-9_-]*$/,Nc=/^\+[1-9]\d{6,14}$/,bs="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Tc=new RegExp(`^${bs}$`);function ws(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Rc(e){return new RegExp(`^${ws(e)}$`)}function Ic(e){const t=ws({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${bs}T(?:${n})$`)}const Cc=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Dc=/^-?\d+$/,Ss=/^-?\d+(?:\.\d+)?$/,Vc=/^(?:true|false)$/i,Fc=/^[^A-Z]*$/,Mc=/^[^a-z]*$/,Ve=V("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Es={number:"number",bigint:"bigint",object:"date"},ks=V("$ZodCheckLessThan",(e,t)=>{Ve.init(e,t);const r=Es[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,o=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ps=V("$ZodCheckGreaterThan",(e,t)=>{Ve.init(e,t);const r=Es[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,o=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qc=V("$ZodCheckMultipleOf",(e,t)=>{Ve.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Ua(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Zc=V("$ZodCheckNumberFormat",(e,t)=>{Ve.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[s,o]=Ha[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=s,a.maximum=o,r&&(a.pattern=Dc)}),e._zod.check=i=>{const a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<s&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),a>o&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Uc=V("$ZodCheckMaxLength",(e,t)=>{var r;Ve.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!yn(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const s=n.value;if(s.length<=t.maximum)return;const i=gn(s);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Lc=V("$ZodCheckMinLength",(e,t)=>{var r;Ve.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!yn(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const s=n.value;if(s.length>=t.minimum)return;const i=gn(s);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Kc=V("$ZodCheckLengthEquals",(e,t)=>{var r;Ve.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!yn(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=n=>{const s=n.value,o=s.length;if(o===t.length)return;const i=gn(s),a=o>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Bt=V("$ZodCheckStringFormat",(e,t)=>{var r,n;Ve.init(e,t),e._zod.onattach.push(s=>{const o=s._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),xc=V("$ZodCheckRegex",(e,t)=>{Bt.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Jc=V("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Fc),Bt.init(e,t)}),Hc=V("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Mc),Bt.init(e,t)}),Gc=V("$ZodCheckIncludes",(e,t)=>{Ve.init(e,t);const r=Ut(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),Bc=V("$ZodCheckStartsWith",(e,t)=>{Ve.init(e,t);const r=new RegExp(`^${Ut(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Wc=V("$ZodCheckEndsWith",(e,t)=>{Ve.init(e,t);const r=new RegExp(`.*${Ut(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Yc=V("$ZodCheckOverwrite",(e,t)=>{Ve.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Xc{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
2
2
|
`).filter(i=>i),s=Math.min(...n.map(i=>i.length-i.trimStart().length)),o=n.map(i=>i.slice(s)).map(i=>" ".repeat(this.indent*2)+i);for(const i of o)this.content.push(i)}compile(){const t=Function,r=this?.args,s=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...r,s.join(`
|
|
3
|
-
`))}}const Qc={major:4,minor:3,patch:
|
|
3
|
+
`))}}const Qc={major:4,minor:3,patch:6},ve=V("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Qc;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const s of n)for(const o of s._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(i,a,c)=>{let u=bt(i),f;for(const g of a){if(g._zod.def.when){if(!g._zod.def.when(i))continue}else if(u)continue;const m=i.issues.length,h=g._zod.check(i);if(h instanceof Promise&&c?.async===!1)throw new vt;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await h,i.issues.length!==m&&(u||(u=bt(i,m)))});else{if(i.issues.length===m)continue;u||(u=bt(i,m))}}return f?f.then(()=>i):i},o=(i,a,c)=>{if(bt(i))return i.aborted=!0,i;const u=s(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new vt;return u.then(f=>e._zod.parse(f,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(f=>o(f,i,a)):o(u,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new vt;return c.then(u=>s(u,n,a))}return s(c,n,a)}}de(e,"~standard",()=>({validate:s=>{try{const o=oc(e,s);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return ic(e,s).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),$n=V("$ZodString",(e,t)=>{ve.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Cc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),$e=V("$ZodStringFormat",(e,t)=>{Bt.init(e,t),$n.init(e,t)}),eu=V("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=wc),$e.init(e,t)}),tu=V("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=vs(n))}else t.pattern??(t.pattern=vs());$e.init(e,t)}),ru=V("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Sc),$e.init(e,t)}),nu=V("$ZodURL",(e,t)=>{$e.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),s=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=s.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),su=V("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=kc()),$e.init(e,t)}),ou=V("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=$c),$e.init(e,t)}),iu=V("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=pc),$e.init(e,t)}),au=V("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=yc),$e.init(e,t)}),cu=V("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_c),$e.init(e,t)}),uu=V("$ZodXID",(e,t)=>{t.pattern??(t.pattern=gc),$e.init(e,t)}),du=V("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=vc),$e.init(e,t)}),lu=V("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ic(t)),$e.init(e,t)}),fu=V("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Tc),$e.init(e,t)}),hu=V("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Rc(t)),$e.init(e,t)}),mu=V("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=bc),$e.init(e,t)}),pu=V("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Pc),$e.init(e,t),e._zod.bag.format="ipv4"}),yu=V("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Oc),$e.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),_u=V("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=zc),$e.init(e,t)}),gu=V("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ac),$e.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[s,o]=n;if(!o)throw new Error;const i=Number(o);if(`${i}`!==o)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${s}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Os(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const vu=V("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=jc),$e.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Os(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function $u(e){if(!$s.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Os(r)}const bu=V("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=$s),$e.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{$u(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),wu=V("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Nc),$e.init(e,t)});function Su(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const s=JSON.parse(atob(n));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const Eu=V("$ZodJWT",(e,t)=>{$e.init(e,t),e._zod.check=r=>{Su(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),zs=V("$ZodNumber",(e,t)=>{ve.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ss,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;const o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),r}}),ku=V("$ZodNumberFormat",(e,t)=>{Zc.init(e,t),zs.init(e,t)}),Pu=V("$ZodBoolean",(e,t)=>{ve.init(e,t),e._zod.pattern=Vc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}}),Ou=V("$ZodAny",(e,t)=>{ve.init(e,t),e._zod.parse=r=>r}),zu=V("$ZodUnknown",(e,t)=>{ve.init(e,t),e._zod.parse=r=>r}),Au=V("$ZodNever",(e,t)=>{ve.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function As(e,t,r){e.issues.length&&t.issues.push(...wt(r,e.issues)),t.value[r]=e.value}const ju=V("$ZodArray",(e,t)=>{ve.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);const o=[];for(let i=0;i<s.length;i++){const a=s[i],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?o.push(c.then(u=>As(u,r,i))):As(c,r,i)}return o.length?Promise.all(o).then(()=>r):r}});function Wt(e,t,r,n,s){if(e.issues.length){if(s&&!(r in n))return;t.issues.push(...wt(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function js(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=Ja(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ns(e,t,r,n,s,o){const i=[],a=s.keySet,c=s.catchall._zod,u=c.def.type,f=c.optout==="optional";for(const g in t){if(a.has(g))continue;if(u==="never"){i.push(g);continue}const m=c.run({value:t[g],issues:[]},n);m instanceof Promise?e.push(m.then(h=>Wt(h,r,g,t,f))):Wt(m,r,g,t,f)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const Nu=V("$ZodObject",(e,t)=>{if(ve.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const n=pn(()=>js(t));de(e._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const f=a[u]._zod;if(f.values){c[u]??(c[u]=new Set);for(const g of f.values)c[u].add(g)}}return c});const s=Zt,o=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=n.value);const u=a.value;if(!s(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const f=[],g=i.shape;for(const m of i.keys){const h=g[m],w=h._zod.optout==="optional",S=h._zod.run({value:u[m],issues:[]},c);S instanceof Promise?f.push(S.then(p=>Wt(p,a,m,u,w))):Wt(S,a,m,u,w)}return o?Ns(f,u,a,c,n.value,e):f.length?Promise.all(f).then(()=>a):a}}),Tu=V("$ZodObjectJIT",(e,t)=>{Nu.init(e,t);const r=e._zod.parse,n=pn(()=>js(t)),s=m=>{const h=new Xc(["shape","payload","ctx"]),w=n.value,S=y=>{const _=ps(y);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};h.write("const input = payload.value;");const p=Object.create(null);let v=0;for(const y of w.keys)p[y]=`key_${v++}`;h.write("const newResult = {};");for(const y of w.keys){const _=p[y],d=ps(y),E=m[y]?._zod?.optout==="optional";h.write(`const ${_} = ${S(y)};`),E?h.write(`
|
|
4
4
|
if (${_}.issues.length) {
|
|
5
5
|
if (${d} in input) {
|
|
6
6
|
payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
newResult[${d}] = ${_}.value;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
`)}h.write("payload.value = newResult;"),h.write("return payload;");const l=h.compile();return(y,_)=>l(m,y,_)};let o;const i=Zt,a=!fs.jitless,u=a&&Ka.value,f=t.catchall;let g;e._zod.parse=(m,h)=>{g??(g=n.value);const w=m.value;return i(w)?a&&u&&h?.async===!1&&h.jitless!==!0?(o||(o=s(t.shape)),m=o(m,h),f?Ns([],w,m,h,g,e):m):r(m,h):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m)}});function Ts(e,t,r,n){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const s=e.filter(o=>!bt(o));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(i=>at(i,n,st())))}),t)}const Ru=V("$ZodUnion",(e,t)=>{ve.init(e,t),de(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),de(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),de(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),de(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>_n(o.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(s,o)=>{if(r)return n(s,o);let i=!1;const a=[];for(const c of t.options){const u=c._zod.run({value:s.value,issues:[]},o);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>Ts(c,s,e,o)):Ts(a,s,e,o)}}),Iu=V("$ZodIntersection",(e,t)=>{ve.init(e,t),e._zod.parse=(r,n)=>{const s=r.value,o=t.left._zod.run({value:s,issues:[]},n),i=t.right._zod.run({value:s,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([c,u])=>Rs(r,c,u)):Rs(r,o,i)}});function bn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if($t(e)&&$t(t)){const r=Object.keys(t),n=Object.keys(e).filter(o=>r.indexOf(o)!==-1),s={...e,...t};for(const o of n){const i=bn(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const s=e[n],o=t[n],i=bn(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Rs(e,t,r){const n=new Map;let s;for(const a of t.issues)if(a.code==="unrecognized_keys"){s??(s=a);for(const c of a.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(a);for(const a of r.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(a);const o=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(o.length&&s&&e.issues.push({...s,keys:o}),bt(e))return e;const i=bn(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Cu=V("$ZodRecord",(e,t)=>{ve.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!$t(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const o=[],i=t.keyType._zod.values;if(i){r.value={};const a=new Set;for(const u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);const f=t.valueType._zod.run({value:s[u],issues:[]},n);f instanceof Promise?o.push(f.then(g=>{g.issues.length&&r.issues.push(...wt(u,g.issues)),r.value[u]=g.value})):(f.issues.length&&r.issues.push(...wt(u,f.issues)),r.value[u]=f.value)}let c;for(const u in s)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c})}else{r.value={};for(const a of Reflect.ownKeys(s)){if(a==="__proto__")continue;let c=t.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Ss.test(a)&&c.issues.length&&c.issues.some(g=>g.code==="invalid_type"&&g.expected==="number")){const g=t.keyType._zod.run({value:Number(a),issues:[]},n);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(c=g)}if(c.issues.length){t.mode==="loose"?r.value[a]=s[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(g=>at(g,n,st())),input:a,path:[a],inst:e});continue}const f=t.valueType._zod.run({value:s[a],issues:[]},n);f instanceof Promise?o.push(f.then(g=>{g.issues.length&&r.issues.push(...wt(a,g.issues)),r.value[c.value]=g.value})):(f.issues.length&&r.issues.push(...wt(a,f.issues)),r.value[c.value]=f.value)}}return o.length?Promise.all(o).then(()=>r):r}}),Du=V("$ZodEnum",(e,t)=>{ve.init(e,t);const r=hs(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(s=>xa.has(typeof s)).map(s=>typeof s=="string"?Ut(s):s.toString()).join("|")})$`),e._zod.parse=(s,o)=>{const i=s.value;return n.has(i)||s.issues.push({code:"invalid_value",values:r,input:i,inst:e}),s}}),Vu=V("$ZodTransform",(e,t)=>{ve.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ls(e.constructor.name);const s=t.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(r.value=i,r));if(s instanceof Promise)throw new vt;return r.value=s,r}});function Is(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Cs=V("$ZodOptional",(e,t)=>{ve.init(e,t),e._zod.optin="optional",e._zod.optout="optional",de(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),de(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${_n(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Is(o,r.value)):Is(s,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),Fu=V("$ZodExactOptional",(e,t)=>{Cs.init(e,t),de(e._zod,"values",()=>t.innerType._zod.values),de(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Mu=V("$ZodNullable",(e,t)=>{ve.init(e,t),de(e._zod,"optin",()=>t.innerType._zod.optin),de(e._zod,"optout",()=>t.innerType._zod.optout),de(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${_n(r.source)}|null)$`):void 0}),de(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),qu=V("$ZodDefault",(e,t)=>{ve.init(e,t),e._zod.optin="optional",de(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Ds(o,t)):Ds(s,t)}});function Ds(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Zu=V("$ZodPrefault",(e,t)=>{ve.init(e,t),e._zod.optin="optional",de(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Uu=V("$ZodNonOptional",(e,t)=>{ve.init(e,t),de(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Vs(o,e)):Vs(s,e)}});function Vs(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Lu=V("$ZodCatch",(e,t)=>{ve.init(e,t),de(e._zod,"optin",()=>t.innerType._zod.optin),de(e._zod,"optout",()=>t.innerType._zod.optout),de(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>at(i,n,st()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(o=>at(o,n,st()))},input:r.value}),r.issues=[]),r)}}),Ku=V("$ZodPipe",(e,t)=>{ve.init(e,t),de(e._zod,"values",()=>t.in._zod.values),de(e._zod,"optin",()=>t.in._zod.optin),de(e._zod,"optout",()=>t.out._zod.optout),de(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const o=t.out._zod.run(r,n);return o instanceof Promise?o.then(i=>Yt(i,t.in,n)):Yt(o,t.in,n)}const s=t.in._zod.run(r,n);return s instanceof Promise?s.then(o=>Yt(o,t.out,n)):Yt(s,t.out,n)}});function Yt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const xu=V("$ZodReadonly",(e,t)=>{ve.init(e,t),de(e._zod,"propValues",()=>t.innerType._zod.propValues),de(e._zod,"values",()=>t.innerType._zod.values),de(e._zod,"optin",()=>t.innerType?._zod?.optin),de(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(Fs):Fs(s)}});function Fs(e){return e.value=Object.freeze(e.value),e}const Ju=V("$ZodLazy",(e,t)=>{ve.init(e,t),de(e._zod,"innerType",()=>t.getter()),de(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),de(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),de(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),de(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Hu=V("$ZodCustom",(e,t)=>{Ve.init(e,t),ve.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,s=t.fn(n);if(s instanceof Promise)return s.then(o=>Ms(o,r,n,e));Ms(s,r,n,e)}});function Ms(e,t,r,n){if(!e){const s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),t.issues.push(Tt(s))}}var qs;class Gu{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const s={...n,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Bu(){return new Gu}(qs=globalThis).__zod_globalRegistry??(qs.__zod_globalRegistry=Bu());const Rt=globalThis.__zod_globalRegistry;function Wu(e,t){return new e({type:"string",...te(t)})}function Yu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...te(t)})}function Zs(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...te(t)})}function Xu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...te(t)})}function Qu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...te(t)})}function ed(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...te(t)})}function td(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...te(t)})}function rd(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...te(t)})}function nd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...te(t)})}function sd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...te(t)})}function od(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...te(t)})}function id(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...te(t)})}function ad(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...te(t)})}function cd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...te(t)})}function ud(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...te(t)})}function dd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...te(t)})}function ld(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...te(t)})}function fd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...te(t)})}function hd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...te(t)})}function md(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...te(t)})}function pd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...te(t)})}function yd(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...te(t)})}function _d(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...te(t)})}function gd(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...te(t)})}function vd(e,t){return new e({type:"string",format:"date",check:"string_format",...te(t)})}function $d(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...te(t)})}function bd(e,t){return new e({type:"string",format:"duration",check:"string_format",...te(t)})}function wd(e,t){return new e({type:"number",checks:[],...te(t)})}function Sd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...te(t)})}function Ed(e,t){return new e({type:"boolean",...te(t)})}function kd(e){return new e({type:"any"})}function Pd(e){return new e({type:"unknown"})}function Od(e,t){return new e({type:"never",...te(t)})}function Us(e,t){return new ks({check:"less_than",...te(t),value:e,inclusive:!1})}function wn(e,t){return new ks({check:"less_than",...te(t),value:e,inclusive:!0})}function Ls(e,t){return new Ps({check:"greater_than",...te(t),value:e,inclusive:!1})}function Sn(e,t){return new Ps({check:"greater_than",...te(t),value:e,inclusive:!0})}function Ks(e,t){return new qc({check:"multiple_of",...te(t),value:e})}function xs(e,t){return new Uc({check:"max_length",...te(t),maximum:e})}function Xt(e,t){return new Lc({check:"min_length",...te(t),minimum:e})}function Js(e,t){return new Kc({check:"length_equals",...te(t),length:e})}function zd(e,t){return new xc({check:"string_format",format:"regex",...te(t),pattern:e})}function Ad(e){return new Jc({check:"string_format",format:"lowercase",...te(e)})}function jd(e){return new Hc({check:"string_format",format:"uppercase",...te(e)})}function Nd(e,t){return new Gc({check:"string_format",format:"includes",...te(t),includes:e})}function Td(e,t){return new Bc({check:"string_format",format:"starts_with",...te(t),prefix:e})}function Rd(e,t){return new Wc({check:"string_format",format:"ends_with",...te(t),suffix:e})}function St(e){return new Yc({check:"overwrite",tx:e})}function Id(e){return St(t=>t.normalize(e))}function Cd(){return St(e=>e.trim())}function Dd(){return St(e=>e.toLowerCase())}function Vd(){return St(e=>e.toUpperCase())}function Fd(){return St(e=>La(e))}function Md(e,t,r){return new e({type:"array",element:t,...te(r)})}function qd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...te(r)})}function Zd(e){const t=Ud(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Tt(n,r.value,t._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),r.issues.push(Tt(s))}},e(r.value,r)));return t}function Ud(e,t){const r=new Ve({check:"custom",...te(t)});return r._zod.check=e,r}function Hs(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Rt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Ee(e,t,r={path:[],schemaPath:[]}){var n;const s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;const i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const f={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,f);else{const m=i.schema,h=t.processors[s.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);h(e,t,m,f)}const g=e._zod.parent;g&&(i.ref||(i.ref=g),Ee(g,t,f),t.seen.get(g).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&Re(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Gs(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const c=n.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}const s=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(i[0])?.id,m=e.external.uri??(w=>w);if(g)return{ref:m(g)};const h=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=h,{defId:h,ref:`${m("__shared")}#/${a}/${h}`}}if(i[1]===r)return{ref:"#"};const u=`#/${a}/`,f=i[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:u+f}},o=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:u}=s(i);a.def={...a.schema},u&&(a.defId=u);const f=a.schema;for(const g in f)delete f[g];f.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
37
|
+
`)}h.write("payload.value = newResult;"),h.write("return payload;");const l=h.compile();return(y,_)=>l(m,y,_)};let o;const i=Zt,a=!fs.jitless,u=a&&Ka.value,f=t.catchall;let g;e._zod.parse=(m,h)=>{g??(g=n.value);const w=m.value;return i(w)?a&&u&&h?.async===!1&&h.jitless!==!0?(o||(o=s(t.shape)),m=o(m,h),f?Ns([],w,m,h,g,e):m):r(m,h):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m)}});function Ts(e,t,r,n){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const s=e.filter(o=>!bt(o));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(i=>at(i,n,st())))}),t)}const Ru=V("$ZodUnion",(e,t)=>{ve.init(e,t),de(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),de(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),de(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),de(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>_n(o.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(s,o)=>{if(r)return n(s,o);let i=!1;const a=[];for(const c of t.options){const u=c._zod.run({value:s.value,issues:[]},o);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>Ts(c,s,e,o)):Ts(a,s,e,o)}}),Iu=V("$ZodIntersection",(e,t)=>{ve.init(e,t),e._zod.parse=(r,n)=>{const s=r.value,o=t.left._zod.run({value:s,issues:[]},n),i=t.right._zod.run({value:s,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([c,u])=>Rs(r,c,u)):Rs(r,o,i)}});function bn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if($t(e)&&$t(t)){const r=Object.keys(t),n=Object.keys(e).filter(o=>r.indexOf(o)!==-1),s={...e,...t};for(const o of n){const i=bn(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const s=e[n],o=t[n],i=bn(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Rs(e,t,r){const n=new Map;let s;for(const a of t.issues)if(a.code==="unrecognized_keys"){s??(s=a);for(const c of a.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(a);for(const a of r.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(a);const o=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(o.length&&s&&e.issues.push({...s,keys:o}),bt(e))return e;const i=bn(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Cu=V("$ZodRecord",(e,t)=>{ve.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!$t(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const o=[],i=t.keyType._zod.values;if(i){r.value={};const a=new Set;for(const u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);const f=t.valueType._zod.run({value:s[u],issues:[]},n);f instanceof Promise?o.push(f.then(g=>{g.issues.length&&r.issues.push(...wt(u,g.issues)),r.value[u]=g.value})):(f.issues.length&&r.issues.push(...wt(u,f.issues)),r.value[u]=f.value)}let c;for(const u in s)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c})}else{r.value={};for(const a of Reflect.ownKeys(s)){if(a==="__proto__")continue;let c=t.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Ss.test(a)&&c.issues.length){const g=t.keyType._zod.run({value:Number(a),issues:[]},n);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(c=g)}if(c.issues.length){t.mode==="loose"?r.value[a]=s[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(g=>at(g,n,st())),input:a,path:[a],inst:e});continue}const f=t.valueType._zod.run({value:s[a],issues:[]},n);f instanceof Promise?o.push(f.then(g=>{g.issues.length&&r.issues.push(...wt(a,g.issues)),r.value[c.value]=g.value})):(f.issues.length&&r.issues.push(...wt(a,f.issues)),r.value[c.value]=f.value)}}return o.length?Promise.all(o).then(()=>r):r}}),Du=V("$ZodEnum",(e,t)=>{ve.init(e,t);const r=hs(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(s=>xa.has(typeof s)).map(s=>typeof s=="string"?Ut(s):s.toString()).join("|")})$`),e._zod.parse=(s,o)=>{const i=s.value;return n.has(i)||s.issues.push({code:"invalid_value",values:r,input:i,inst:e}),s}}),Vu=V("$ZodTransform",(e,t)=>{ve.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ls(e.constructor.name);const s=t.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(r.value=i,r));if(s instanceof Promise)throw new vt;return r.value=s,r}});function Is(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Cs=V("$ZodOptional",(e,t)=>{ve.init(e,t),e._zod.optin="optional",e._zod.optout="optional",de(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),de(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${_n(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Is(o,r.value)):Is(s,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),Fu=V("$ZodExactOptional",(e,t)=>{Cs.init(e,t),de(e._zod,"values",()=>t.innerType._zod.values),de(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Mu=V("$ZodNullable",(e,t)=>{ve.init(e,t),de(e._zod,"optin",()=>t.innerType._zod.optin),de(e._zod,"optout",()=>t.innerType._zod.optout),de(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${_n(r.source)}|null)$`):void 0}),de(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),qu=V("$ZodDefault",(e,t)=>{ve.init(e,t),e._zod.optin="optional",de(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Ds(o,t)):Ds(s,t)}});function Ds(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Zu=V("$ZodPrefault",(e,t)=>{ve.init(e,t),e._zod.optin="optional",de(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Uu=V("$ZodNonOptional",(e,t)=>{ve.init(e,t),de(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Vs(o,e)):Vs(s,e)}});function Vs(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Lu=V("$ZodCatch",(e,t)=>{ve.init(e,t),de(e._zod,"optin",()=>t.innerType._zod.optin),de(e._zod,"optout",()=>t.innerType._zod.optout),de(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>at(i,n,st()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(o=>at(o,n,st()))},input:r.value}),r.issues=[]),r)}}),Ku=V("$ZodPipe",(e,t)=>{ve.init(e,t),de(e._zod,"values",()=>t.in._zod.values),de(e._zod,"optin",()=>t.in._zod.optin),de(e._zod,"optout",()=>t.out._zod.optout),de(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const o=t.out._zod.run(r,n);return o instanceof Promise?o.then(i=>Yt(i,t.in,n)):Yt(o,t.in,n)}const s=t.in._zod.run(r,n);return s instanceof Promise?s.then(o=>Yt(o,t.out,n)):Yt(s,t.out,n)}});function Yt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const xu=V("$ZodReadonly",(e,t)=>{ve.init(e,t),de(e._zod,"propValues",()=>t.innerType._zod.propValues),de(e._zod,"values",()=>t.innerType._zod.values),de(e._zod,"optin",()=>t.innerType?._zod?.optin),de(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(Fs):Fs(s)}});function Fs(e){return e.value=Object.freeze(e.value),e}const Ju=V("$ZodLazy",(e,t)=>{ve.init(e,t),de(e._zod,"innerType",()=>t.getter()),de(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),de(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),de(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),de(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Hu=V("$ZodCustom",(e,t)=>{Ve.init(e,t),ve.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,s=t.fn(n);if(s instanceof Promise)return s.then(o=>Ms(o,r,n,e));Ms(s,r,n,e)}});function Ms(e,t,r,n){if(!e){const s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),t.issues.push(Tt(s))}}var qs;class Gu{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const s={...n,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Bu(){return new Gu}(qs=globalThis).__zod_globalRegistry??(qs.__zod_globalRegistry=Bu());const Rt=globalThis.__zod_globalRegistry;function Wu(e,t){return new e({type:"string",...te(t)})}function Yu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...te(t)})}function Zs(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...te(t)})}function Xu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...te(t)})}function Qu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...te(t)})}function ed(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...te(t)})}function td(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...te(t)})}function rd(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...te(t)})}function nd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...te(t)})}function sd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...te(t)})}function od(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...te(t)})}function id(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...te(t)})}function ad(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...te(t)})}function cd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...te(t)})}function ud(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...te(t)})}function dd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...te(t)})}function ld(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...te(t)})}function fd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...te(t)})}function hd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...te(t)})}function md(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...te(t)})}function pd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...te(t)})}function yd(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...te(t)})}function _d(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...te(t)})}function gd(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...te(t)})}function vd(e,t){return new e({type:"string",format:"date",check:"string_format",...te(t)})}function $d(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...te(t)})}function bd(e,t){return new e({type:"string",format:"duration",check:"string_format",...te(t)})}function wd(e,t){return new e({type:"number",checks:[],...te(t)})}function Sd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...te(t)})}function Ed(e,t){return new e({type:"boolean",...te(t)})}function kd(e){return new e({type:"any"})}function Pd(e){return new e({type:"unknown"})}function Od(e,t){return new e({type:"never",...te(t)})}function Us(e,t){return new ks({check:"less_than",...te(t),value:e,inclusive:!1})}function wn(e,t){return new ks({check:"less_than",...te(t),value:e,inclusive:!0})}function Ls(e,t){return new Ps({check:"greater_than",...te(t),value:e,inclusive:!1})}function Sn(e,t){return new Ps({check:"greater_than",...te(t),value:e,inclusive:!0})}function Ks(e,t){return new qc({check:"multiple_of",...te(t),value:e})}function xs(e,t){return new Uc({check:"max_length",...te(t),maximum:e})}function Xt(e,t){return new Lc({check:"min_length",...te(t),minimum:e})}function Js(e,t){return new Kc({check:"length_equals",...te(t),length:e})}function zd(e,t){return new xc({check:"string_format",format:"regex",...te(t),pattern:e})}function Ad(e){return new Jc({check:"string_format",format:"lowercase",...te(e)})}function jd(e){return new Hc({check:"string_format",format:"uppercase",...te(e)})}function Nd(e,t){return new Gc({check:"string_format",format:"includes",...te(t),includes:e})}function Td(e,t){return new Bc({check:"string_format",format:"starts_with",...te(t),prefix:e})}function Rd(e,t){return new Wc({check:"string_format",format:"ends_with",...te(t),suffix:e})}function St(e){return new Yc({check:"overwrite",tx:e})}function Id(e){return St(t=>t.normalize(e))}function Cd(){return St(e=>e.trim())}function Dd(){return St(e=>e.toLowerCase())}function Vd(){return St(e=>e.toUpperCase())}function Fd(){return St(e=>La(e))}function Md(e,t,r){return new e({type:"array",element:t,...te(r)})}function qd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...te(r)})}function Zd(e){const t=Ud(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Tt(n,r.value,t._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),r.issues.push(Tt(s))}},e(r.value,r)));return t}function Ud(e,t){const r=new Ve({check:"custom",...te(t)});return r._zod.check=e,r}function Hs(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Rt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Ee(e,t,r={path:[],schemaPath:[]}){var n;const s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;const i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const f={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,f);else{const m=i.schema,h=t.processors[s.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);h(e,t,m,f)}const g=e._zod.parent;g&&(i.ref||(i.ref=g),Ee(g,t,f),t.seen.get(g).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&Re(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Gs(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const c=n.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}const s=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(i[0])?.id,m=e.external.uri??(w=>w);if(g)return{ref:m(g)};const h=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=h,{defId:h,ref:`${m("__shared")}#/${a}/${h}`}}if(i[1]===r)return{ref:"#"};const u=`#/${a}/`,f=i[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:u+f}},o=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:u}=s(i);a.def={...a.schema},u&&(a.defId=u);const f=a.schema;for(const g in f)delete f[g];f.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
38
38
|
|
|
39
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){o(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){o(i);continue}}if(e.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}if(a.count>1&&e.reused==="ref"){o(i);continue}}}function Bs(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=i=>{const a=e.seen.get(i);if(a.ref===null)return;const c=a.def??a.schema,u={...c},f=a.ref;if(a.ref=null,f){n(f);const m=e.seen.get(f),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(h)):Object.assign(c,h),Object.assign(c,u),i._zod.parent===f)for(const S in c)S==="$ref"||S==="allOf"||S in u||delete c[S];if(h.$ref)for(const S in c)S==="$ref"||S==="allOf"||S in m.def&&JSON.stringify(c[S])===JSON.stringify(m.def[S])&&delete c[S]}const g=i._zod.parent;if(g&&g!==f){n(g);const m=e.seen.get(g);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(const h in c)h==="$ref"||h==="allOf"||h in m.def&&JSON.stringify(c[h])===JSON.stringify(m.def[h])&&delete c[h]}e.override({zodSchema:i,jsonSchema:c,path:a.path??[]})};for(const i of[...e.seen.entries()].reverse())n(i[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(i)}Object.assign(s,r.def??r.schema);const o=e.external?.defs??{};for(const i of e.seen.entries()){const a=i[1];a.def&&a.defId&&(o[a.defId]=a.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const i=JSON.parse(JSON.stringify(s));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:Qt(t,"input",e.processors),output:Qt(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function Re(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Re(n.element,r);if(n.type==="set")return Re(n.valueType,r);if(n.type==="lazy")return Re(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Re(n.innerType,r);if(n.type==="intersection")return Re(n.left,r)||Re(n.right,r);if(n.type==="record"||n.type==="map")return Re(n.keyType,r)||Re(n.valueType,r);if(n.type==="pipe")return Re(n.in,r)||Re(n.out,r);if(n.type==="object"){for(const s in n.shape)if(Re(n.shape[s],r))return!0;return!1}if(n.type==="union"){for(const s of n.options)if(Re(s,r))return!0;return!1}if(n.type==="tuple"){for(const s of n.items)if(Re(s,r))return!0;return!!(n.rest&&Re(n.rest,r))}return!1}const Ld=(e,t={})=>r=>{const n=Hs({...r,processors:t});return Ee(e,n),Gs(n,e),Bs(n,e)},Qt=(e,t,r={})=>n=>{const{libraryOptions:s,target:o}=n??{},i=Hs({...s??{},target:o,io:t,processors:r});return Ee(e,i),Gs(i,e),Bs(i,e)},Kd={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},xd=(e,t,r,n)=>{const s=r;s.type="string";const{minimum:o,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof i=="number"&&(s.maxLength=i),a&&(s.format=Kd[a]??a,s.format===""&&delete s.format,a==="time"&&delete s.format),u&&(s.contentEncoding=u),c&&c.size>0){const f=[...c];f.length===1?s.pattern=f[0].source:f.length>1&&(s.allOf=[...f.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},Jd=(e,t,r,n)=>{const s=r,{minimum:o,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:f}=e._zod.bag;typeof a=="string"&&a.includes("int")?s.type="integer":s.type="number",typeof f=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=f,s.exclusiveMinimum=!0):s.exclusiveMinimum=f),typeof o=="number"&&(s.minimum=o,typeof f=="number"&&t.target!=="draft-04"&&(f>=o?delete s.minimum:delete s.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=u,s.exclusiveMaximum=!0):s.exclusiveMaximum=u),typeof i=="number"&&(s.maximum=i,typeof u=="number"&&t.target!=="draft-04"&&(u<=i?delete s.maximum:delete s.exclusiveMaximum)),typeof c=="number"&&(s.multipleOf=c)},Hd=(e,t,r,n)=>{r.type="boolean"},Gd=(e,t,r,n)=>{r.not={}},Bd=(e,t,r,n)=>{},Wd=(e,t,r,n)=>{},Yd=(e,t,r,n)=>{const s=e._zod.def,o=hs(s.entries);o.every(i=>typeof i=="number")&&(r.type="number"),o.every(i=>typeof i=="string")&&(r.type="string"),r.enum=o},Xd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Qd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},el=(e,t,r,n)=>{const s=r,o=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(s.minItems=i),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=Ee(o.element,t,{...n,path:[...n.path,"items"]})},tl=(e,t,r,n)=>{const s=r,o=e._zod.def;s.type="object",s.properties={};const i=o.shape;for(const u in i)s.properties[u]=Ee(i[u],t,{...n,path:[...n.path,"properties",u]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{const f=o.shape[u]._zod;return t.io==="input"?f.optin===void 0:f.optout===void 0}));c.size>0&&(s.required=Array.from(c)),o.catchall?._zod.def.type==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=Ee(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},rl=(e,t,r,n)=>{const s=e._zod.def,o=s.inclusive===!1,i=s.options.map((a,c)=>Ee(a,t,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=i:r.anyOf=i},nl=(e,t,r,n)=>{const s=e._zod.def,o=Ee(s.left,t,{...n,path:[...n.path,"allOf",0]}),i=Ee(s.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(o)?o.allOf:[o],...a(i)?i.allOf:[i]];r.allOf=c},sl=(e,t,r,n)=>{const s=r,o=e._zod.def;s.type="object";const i=o.keyType,c=i._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){const f=Ee(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});s.patternProperties={};for(const g of c)s.patternProperties[g.source]=f}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=Ee(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),s.additionalProperties=Ee(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});const u=i._zod.values;if(u){const f=[...u].filter(g=>typeof g=="string"||typeof g=="number");f.length>0&&(s.required=f)}},ol=(e,t,r,n)=>{const s=e._zod.def,o=Ee(s.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=s.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},il=(e,t,r,n)=>{const s=e._zod.def;Ee(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType},al=(e,t,r,n)=>{const s=e._zod.def;Ee(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType,r.default=JSON.parse(JSON.stringify(s.defaultValue))},cl=(e,t,r,n)=>{const s=e._zod.def;Ee(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},ul=(e,t,r,n)=>{const s=e._zod.def;Ee(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},dl=(e,t,r,n)=>{const s=e._zod.def,o=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;Ee(o,t,n);const i=t.seen.get(e);i.ref=o},ll=(e,t,r,n)=>{const s=e._zod.def;Ee(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType,r.readOnly=!0},Ws=(e,t,r,n)=>{const s=e._zod.def;Ee(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType},fl=(e,t,r,n)=>{const s=e._zod.innerType;Ee(s,t,n);const o=t.seen.get(e);o.ref=s},hl=V("ZodISODateTime",(e,t)=>{lu.init(e,t),we.init(e,t)});function ml(e){return gd(hl,e)}const pl=V("ZodISODate",(e,t)=>{fu.init(e,t),we.init(e,t)});function yl(e){return vd(pl,e)}const _l=V("ZodISOTime",(e,t)=>{hu.init(e,t),we.init(e,t)});function gl(e){return $d(_l,e)}const vl=V("ZodISODuration",(e,t)=>{mu.init(e,t),we.init(e,t)});function $l(e){return bd(vl,e)}const xe=V("ZodError",(e,t)=>{vn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>rc(e,r)},flatten:{value:r=>tc(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,mn,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,mn,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),bl=xt(xe),wl=Jt(xe),Sl=Ht(xe),El=Gt(xe),kl=ac(xe),Pl=cc(xe),Ol=uc(xe),zl=dc(xe),Al=lc(xe),jl=fc(xe),Nl=hc(xe),Tl=mc(xe),be=V("ZodType",(e,t)=>(ve.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Qt(e,"input"),output:Qt(e,"output")}}),e.toJSONSchema=Ld(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(ot(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>it(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>bl(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Sl(e,r,n),e.parseAsync=async(r,n)=>wl(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>El(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>kl(e,r,n),e.decode=(r,n)=>Pl(e,r,n),e.encodeAsync=async(r,n)=>Ol(e,r,n),e.decodeAsync=async(r,n)=>zl(e,r,n),e.safeEncode=(r,n)=>Al(e,r,n),e.safeDecode=(r,n)=>jl(e,r,n),e.safeEncodeAsync=async(r,n)=>Nl(e,r,n),e.safeDecodeAsync=async(r,n)=>Tl(e,r,n),e.refine=(r,n)=>e.check(Of(r,n)),e.superRefine=r=>e.check(zf(r)),e.overwrite=r=>e.check(St(r)),e.optional=()=>io(e),e.exactOptional=()=>hf(e),e.nullable=()=>ao(e),e.nullish=()=>io(ao(e)),e.nonoptional=r=>vf(e,r),e.array=()=>Ye(e),e.or=r=>En([e,r]),e.and=r=>cf(e,r),e.transform=r=>uo(e,lf(r)),e.default=r=>yf(e,r),e.prefault=r=>gf(e,r),e.catch=r=>bf(e,r),e.pipe=r=>uo(e,r),e.readonly=()=>Ef(e),e.describe=r=>{const n=e.clone();return Rt.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Rt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Rt.get(e);const n=e.clone();return Rt.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Ys=V("_ZodString",(e,t)=>{$n.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,s,o)=>xd(e,n,s);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(zd(...n)),e.includes=(...n)=>e.check(Nd(...n)),e.startsWith=(...n)=>e.check(Td(...n)),e.endsWith=(...n)=>e.check(Rd(...n)),e.min=(...n)=>e.check(Xt(...n)),e.max=(...n)=>e.check(xs(...n)),e.length=(...n)=>e.check(Js(...n)),e.nonempty=(...n)=>e.check(Xt(1,...n)),e.lowercase=n=>e.check(Ad(n)),e.uppercase=n=>e.check(jd(n)),e.trim=()=>e.check(Cd()),e.normalize=(...n)=>e.check(Id(...n)),e.toLowerCase=()=>e.check(Dd()),e.toUpperCase=()=>e.check(Vd()),e.slugify=()=>e.check(Fd())}),Rl=V("ZodString",(e,t)=>{$n.init(e,t),Ys.init(e,t),e.email=r=>e.check(Yu(Il,r)),e.url=r=>e.check(rd(Cl,r)),e.jwt=r=>e.check(_d(Wl,r)),e.emoji=r=>e.check(nd(Dl,r)),e.guid=r=>e.check(Zs(Xs,r)),e.uuid=r=>e.check(Xu(er,r)),e.uuidv4=r=>e.check(Qu(er,r)),e.uuidv6=r=>e.check(ed(er,r)),e.uuidv7=r=>e.check(td(er,r)),e.nanoid=r=>e.check(sd(Vl,r)),e.guid=r=>e.check(Zs(Xs,r)),e.cuid=r=>e.check(od(Fl,r)),e.cuid2=r=>e.check(id(Ml,r)),e.ulid=r=>e.check(ad(ql,r)),e.base64=r=>e.check(md(Hl,r)),e.base64url=r=>e.check(pd(Gl,r)),e.xid=r=>e.check(cd(Zl,r)),e.ksuid=r=>e.check(ud(Ul,r)),e.ipv4=r=>e.check(dd(Ll,r)),e.ipv6=r=>e.check(ld(Kl,r)),e.cidrv4=r=>e.check(fd(xl,r)),e.cidrv6=r=>e.check(hd(Jl,r)),e.e164=r=>e.check(yd(Bl,r)),e.datetime=r=>e.check(ml(r)),e.date=r=>e.check(yl(r)),e.time=r=>e.check(gl(r)),e.duration=r=>e.check($l(r))});function Ie(e){return Wu(Rl,e)}const we=V("ZodStringFormat",(e,t)=>{$e.init(e,t),Ys.init(e,t)}),Il=V("ZodEmail",(e,t)=>{ru.init(e,t),we.init(e,t)}),Xs=V("ZodGUID",(e,t)=>{eu.init(e,t),we.init(e,t)}),er=V("ZodUUID",(e,t)=>{tu.init(e,t),we.init(e,t)}),Cl=V("ZodURL",(e,t)=>{nu.init(e,t),we.init(e,t)}),Dl=V("ZodEmoji",(e,t)=>{su.init(e,t),we.init(e,t)}),Vl=V("ZodNanoID",(e,t)=>{ou.init(e,t),we.init(e,t)}),Fl=V("ZodCUID",(e,t)=>{iu.init(e,t),we.init(e,t)}),Ml=V("ZodCUID2",(e,t)=>{au.init(e,t),we.init(e,t)}),ql=V("ZodULID",(e,t)=>{cu.init(e,t),we.init(e,t)}),Zl=V("ZodXID",(e,t)=>{uu.init(e,t),we.init(e,t)}),Ul=V("ZodKSUID",(e,t)=>{du.init(e,t),we.init(e,t)}),Ll=V("ZodIPv4",(e,t)=>{pu.init(e,t),we.init(e,t)}),Kl=V("ZodIPv6",(e,t)=>{yu.init(e,t),we.init(e,t)}),xl=V("ZodCIDRv4",(e,t)=>{_u.init(e,t),we.init(e,t)}),Jl=V("ZodCIDRv6",(e,t)=>{gu.init(e,t),we.init(e,t)}),Hl=V("ZodBase64",(e,t)=>{vu.init(e,t),we.init(e,t)}),Gl=V("ZodBase64URL",(e,t)=>{bu.init(e,t),we.init(e,t)}),Bl=V("ZodE164",(e,t)=>{wu.init(e,t),we.init(e,t)}),Wl=V("ZodJWT",(e,t)=>{Eu.init(e,t),we.init(e,t)}),Qs=V("ZodNumber",(e,t)=>{zs.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Jd(e,n,s),e.gt=(n,s)=>e.check(Ls(n,s)),e.gte=(n,s)=>e.check(Sn(n,s)),e.min=(n,s)=>e.check(Sn(n,s)),e.lt=(n,s)=>e.check(Us(n,s)),e.lte=(n,s)=>e.check(wn(n,s)),e.max=(n,s)=>e.check(wn(n,s)),e.int=n=>e.check(eo(n)),e.safe=n=>e.check(eo(n)),e.positive=n=>e.check(Ls(0,n)),e.nonnegative=n=>e.check(Sn(0,n)),e.negative=n=>e.check(Us(0,n)),e.nonpositive=n=>e.check(wn(0,n)),e.multipleOf=(n,s)=>e.check(Ks(n,s)),e.step=(n,s)=>e.check(Ks(n,s)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function qe(e){return wd(Qs,e)}const Yl=V("ZodNumberFormat",(e,t)=>{ku.init(e,t),Qs.init(e,t)});function eo(e){return Sd(Yl,e)}const Xl=V("ZodBoolean",(e,t)=>{Pu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Hd(e,r,n)});function tr(e){return Ed(Xl,e)}const Ql=V("ZodAny",(e,t)=>{Ou.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Bd()});function to(){return kd(Ql)}const ef=V("ZodUnknown",(e,t)=>{zu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Wd()});function ro(){return Pd(ef)}const tf=V("ZodNever",(e,t)=>{Au.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Gd(e,r,n)});function rf(e){return Od(tf,e)}const nf=V("ZodArray",(e,t)=>{ju.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>el(e,r,n,s),e.element=t.element,e.min=(r,n)=>e.check(Xt(r,n)),e.nonempty=r=>e.check(Xt(1,r)),e.max=(r,n)=>e.check(xs(r,n)),e.length=(r,n)=>e.check(Js(r,n)),e.unwrap=()=>e.element});function Ye(e,t){return Md(nf,e,t)}const sf=V("ZodObject",(e,t)=>{Tu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>tl(e,r,n,s),de(e,"shape",()=>t.shape),e.keyof=()=>so(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ro()}),e.loose=()=>e.clone({...e._zod.def,catchall:ro()}),e.strict=()=>e.clone({...e._zod.def,catchall:rf()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Wa(e,r),e.safeExtend=r=>Ya(e,r),e.merge=r=>Xa(e,r),e.pick=r=>Ga(e,r),e.omit=r=>Ba(e,r),e.partial=(...r)=>Qa(oo,e,r[0]),e.required=(...r)=>ec(co,e,r[0])});function rr(e,t){const r={type:"object",shape:e??{},...te(t)};return new sf(r)}const of=V("ZodUnion",(e,t)=>{Ru.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>rl(e,r,n,s),e.options=t.options});function En(e,t){return new of({type:"union",options:e,...te(t)})}const af=V("ZodIntersection",(e,t)=>{Iu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>nl(e,r,n,s)});function cf(e,t){return new af({type:"intersection",left:e,right:t})}const uf=V("ZodRecord",(e,t)=>{Cu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>sl(e,r,n,s),e.keyType=t.keyType,e.valueType=t.valueType});function no(e,t,r){return new uf({type:"record",keyType:e,valueType:t,...te(r)})}const kn=V("ZodEnum",(e,t)=>{Du.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Yd(e,n,s),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,s)=>{const o={};for(const i of n)if(r.has(i))o[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new kn({...t,checks:[],...te(s),entries:o})},e.exclude=(n,s)=>{const o={...t.entries};for(const i of n)if(r.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new kn({...t,checks:[],...te(s),entries:o})}});function so(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new kn({type:"enum",entries:r,...te(t)})}const df=V("ZodTransform",(e,t)=>{Vu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Qd(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ls(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(Tt(o,r.value,t));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Tt(i))}};const s=t.transform(r.value,r);return s instanceof Promise?s.then(o=>(r.value=o,r)):(r.value=s,r)}});function lf(e){return new df({type:"transform",transform:e})}const oo=V("ZodOptional",(e,t)=>{Cs.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ws(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function io(e){return new oo({type:"optional",innerType:e})}const ff=V("ZodExactOptional",(e,t)=>{Fu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ws(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function hf(e){return new ff({type:"optional",innerType:e})}const mf=V("ZodNullable",(e,t)=>{Mu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ol(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function ao(e){return new mf({type:"nullable",innerType:e})}const pf=V("ZodDefault",(e,t)=>{qu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>al(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function yf(e,t){return new pf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():_s(t)}})}const _f=V("ZodPrefault",(e,t)=>{Zu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>cl(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function gf(e,t){return new _f({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():_s(t)}})}const co=V("ZodNonOptional",(e,t)=>{Uu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>il(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function vf(e,t){return new co({type:"nonoptional",innerType:e,...te(t)})}const $f=V("ZodCatch",(e,t)=>{Lu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ul(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function bf(e,t){return new $f({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const wf=V("ZodPipe",(e,t)=>{Ku.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>dl(e,r,n,s),e.in=t.in,e.out=t.out});function uo(e,t){return new wf({type:"pipe",in:e,out:t})}const Sf=V("ZodReadonly",(e,t)=>{xu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ll(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function Ef(e){return new Sf({type:"readonly",innerType:e})}const kf=V("ZodLazy",(e,t)=>{Ju.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>fl(e,r,n,s),e.unwrap=()=>e._zod.def.getter()});function ct(e){return new kf({type:"lazy",getter:e})}const Pf=V("ZodCustom",(e,t)=>{Hu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Xd(e,r)});function Of(e,t={}){return qd(Pf,e,t)}function zf(e){return Zd(e)}const Ze=rr({type:so(["string","number","integer","boolean","object","array","ref"]).optional(),title:Ie().optional(),description:Ie().optional(),default:to().optional(),minimum:qe().optional(),maximum:qe().optional(),exclusiveMin:qe().optional(),exclusiveMax:qe().optional(),multipleOf:qe().optional(),minLength:qe().optional(),maxLength:qe().optional(),minContains:qe().optional(),maxContains:qe().optional(),minProperties:qe().optional(),maxProperties:qe().optional(),isModifiable:tr().optional(),"x-modifiable":Ye(Ie()).optional(),pattern:Ie().optional(),format:Ie().optional(),minItems:qe().optional(),maxItems:qe().optional(),uniqueItems:tr().optional(),enum:Ye(to()).optional(),$id:Ie().optional(),$schema:Ie().optional(),$ref:Ie().optional()}).extend({properties:ct(()=>no(Ie(),Ze)).optional(),items:ct(()=>En([Ze,Ye(Ze)])).optional(),required:Ye(Ie()).optional(),additionalProperties:ct(()=>En([tr(),Ze])).optional(),allOf:ct(()=>Ye(Ze)).optional(),anyOf:ct(()=>Ye(Ze)).optional(),oneOf:ct(()=>Ye(Ze)).optional(),not:ct(()=>Ze).optional(),$defs:ct(()=>no(Ie(),Ze)).optional()}),lo=rr({root:Ze,properties:Ye(rr({id:Ie(),key:Ie().min(1),isRequired:tr(),schema:Ze})),definitions:Ye(rr({id:Ie(),key:Ie().min(1),schema:Ze}))});var It=e=>e.type==="checkbox",mt=e=>e instanceof Date,Fe=e=>e==null;const fo=e=>typeof e=="object";var Pe=e=>!Fe(e)&&!Array.isArray(e)&&fo(e)&&!mt(e),Af=e=>Pe(e)&&e.target?It(e.target)?e.target.checked:e.target.value:e,jf=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Nf=(e,t)=>e.has(jf(t)),Tf=e=>{const t=e.constructor&&e.constructor.prototype;return Pe(t)&&t.hasOwnProperty("isPrototypeOf")},Pn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ge(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Pn&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Pe(e)&&Tf(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=ge(e[s]));return n}var nr=e=>/^\w*$/.test(e),_e=e=>e===void 0,sr=e=>Array.isArray(e)?e.filter(Boolean):[],On=e=>sr(e.replace(/["|']|\]/g,"").split(/\.|\[/)),W=(e,t,r)=>{if(!t||!Pe(e))return r;const n=(nr(t)?[t]:On(t)).reduce((s,o)=>Fe(s)?s:s[o],e);return _e(n)||n===e?_e(e[t])?r:e[t]:n},Xe=e=>typeof e=="boolean",He=e=>typeof e=="function",me=(e,t,r)=>{let n=-1;const s=nr(t)?[t]:On(t),o=s.length,i=o-1;for(;++n<o;){const a=s[n];let c=r;if(n!==i){const u=e[a];c=Pe(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}};const ho={BLUR:"blur",FOCUS_OUT:"focusout"},Je={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},et={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},mo=ee.createContext(null);mo.displayName="HookFormControlContext";const Rf=()=>ee.useContext(mo);var If=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Je.all&&(t._proxyFormState[i]=!n||Je.all),e[i]}});return s};const po=typeof window<"u"?ee.useLayoutEffect:ee.useEffect;var Ue=e=>typeof e=="string",Cf=(e,t,r,n,s)=>Ue(e)?(n&&t.watch.add(e),W(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),W(r,o))):(n&&(t.watchAll=!0),r),zn=e=>Fe(e)||!fo(e);function ut(e,t,r=new WeakSet){if(zn(e)||zn(t))return Object.is(e,t);if(mt(e)&&mt(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const o of n){const i=e[o];if(!s.includes(o))return!1;if(o!=="ref"){const a=t[o];if(mt(i)&&mt(a)||Pe(i)&&Pe(a)||Array.isArray(i)&&Array.isArray(a)?!ut(i,a,r):!Object.is(i,a))return!1}}return!0}const Df=ee.createContext(null);Df.displayName="HookFormContext";var An=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Me=e=>Array.isArray(e)?e:[e],yo=()=>{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}};function _o(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],o=t[n];if(s&&Pe(s)&&o){const i=_o(s,o);Pe(i)&&(r[n]=i)}else e[n]&&(r[n]=o)}return r}var Te=e=>Pe(e)&&!Object.keys(e).length,jn=e=>e.type==="file",or=e=>{if(!Pn)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},go=e=>e.type==="select-multiple",Nn=e=>e.type==="radio",Vf=e=>Nn(e)||It(e),Tn=e=>or(e)&&e.isConnected;function Ff(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=_e(e)?n++:e[t[n++]];return e}function Mf(e){for(const t in e)if(e.hasOwnProperty(t)&&!_e(e[t]))return!1;return!0}function ke(e,t){const r=Array.isArray(t)?t:nr(t)?[t]:On(t),n=r.length===1?e:Ff(e,r),s=r.length-1,o=r[s];return n&&delete n[o],s!==0&&(Pe(n)&&Te(n)||Array.isArray(n)&&Mf(n))&&ke(e,r.slice(0,-1)),e}var qf=e=>{for(const t in e)if(He(e[t]))return!0;return!1};function vo(e){return Array.isArray(e)||Pe(e)&&!qf(e)}function Rn(e,t={}){for(const r in e){const n=e[r];vo(n)?(t[r]=Array.isArray(n)?[]:{},Rn(n,t[r])):_e(n)||(t[r]=!0)}return t}function Et(e,t,r){r||(r=Rn(t));for(const n in e){const s=e[n];if(vo(s))_e(t)||zn(r[n])?r[n]=Rn(s,Array.isArray(s)?[]:{}):Et(s,Fe(t)?{}:t[n],r[n]);else{const o=t[n];r[n]=!ut(s,o)}}return r}const $o={value:!1,isValid:!1},bo={value:!0,isValid:!0};var wo=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!_e(e[0].attributes.value)?_e(e[0].value)||e[0].value===""?bo:{value:e[0].value,isValid:!0}:bo:$o}return $o},So=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>_e(e)?e:t?e===""?NaN:e&&+e:r&&Ue(e)?new Date(e):n?n(e):e;const Eo={isValid:!1,value:null};var ko=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Eo):Eo;function Po(e){const t=e.ref;return jn(t)?t.files:Nn(t)?ko(e.refs).value:go(t)?[...t.selectedOptions].map(({value:r})=>r):It(t)?wo(e.refs).value:So(_e(t.value)?e.ref.value:t.value,e)}var Zf=(e,t,r,n)=>{const s={};for(const o of e){const i=W(t,o);i&&me(s,o,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},ir=e=>e instanceof RegExp,Ct=e=>_e(e)?e:ir(e)?e.source:Pe(e)?ir(e.value)?e.value.source:e.value:e,kt=e=>({isOnSubmit:!e||e===Je.onSubmit,isOnBlur:e===Je.onBlur,isOnChange:e===Je.onChange,isOnAll:e===Je.all,isOnTouch:e===Je.onTouched});const Oo="AsyncFunction";var Uf=e=>!!e&&!!e.validate&&!!(He(e.validate)&&e.validate.constructor.name===Oo||Pe(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Oo)),Lf=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),In=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Pt=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=W(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)return!0;if(i.ref&&t(i.ref,i.name)&&!n)return!0;if(Pt(a,t))break}else if(Pe(a)&&Pt(a,t))break}}};function zo(e,t,r){const n=W(e,r);if(n||nr(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),i=W(t,o),a=W(e,o);if(i&&!Array.isArray(i)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};if(a&&a.root&&a.root.type)return{name:`${o}.root`,error:a.root};s.pop()}return{name:r}}var Kf=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return Te(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!n||Je.all))},xf=(e,t,r)=>!e||!t||e===t||Me(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),Jf=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,Hf=(e,t)=>!sr(W(e,t)).length&&ke(e,t),Ao=(e,t,r)=>{const n=Me(W(e,r));return me(n,"root",t[r]),me(e,r,n),e};function jo(e,t,r="validate"){if(Ue(e)||Array.isArray(e)&&e.every(Ue)||Xe(e)&&!e)return{type:r,message:Ue(e)?e:"",ref:t}}var Ot=e=>Pe(e)&&!ir(e)?e:{value:e,message:""},Cn=async(e,t,r,n,s,o)=>{const{ref:i,refs:a,required:c,maxLength:u,minLength:f,min:g,max:m,pattern:h,validate:w,name:S,valueAsNumber:p,mount:v}=e._f,l=W(r,S);if(!v||t.has(S))return{};const y=a?a[0]:i,_=F=>{s&&y.reportValidity&&(y.setCustomValidity(Xe(F)?"":F||""),y.reportValidity())},d={},$=Nn(i),E=It(i),T=$||E,Z=(p||jn(i))&&_e(i.value)&&_e(l)||or(i)&&i.value===""||l===""||Array.isArray(l)&&!l.length,K=An.bind(null,S,n,d),M=(F,U,x,re=et.maxLength,ye=et.minLength)=>{const he=F?U:x;d[S]={type:F?re:ye,message:he,ref:i,...K(F?re:ye,he)}};if(o?!Array.isArray(l)||!l.length:c&&(!T&&(Z||Fe(l))||Xe(l)&&!l||E&&!wo(a).isValid||$&&!ko(a).isValid)){const{value:F,message:U}=Ue(c)?{value:!!c,message:c}:Ot(c);if(F&&(d[S]={type:et.required,message:U,ref:y,...K(et.required,U)},!n))return _(U),d}if(!Z&&(!Fe(g)||!Fe(m))){let F,U;const x=Ot(m),re=Ot(g);if(!Fe(l)&&!isNaN(l)){const ye=i.valueAsNumber||l&&+l;Fe(x.value)||(F=ye>x.value),Fe(re.value)||(U=ye<re.value)}else{const ye=i.valueAsDate||new Date(l),he=D=>new Date(new Date().toDateString()+" "+D),ue=i.type=="time",Oe=i.type=="week";Ue(x.value)&&l&&(F=ue?he(l)>he(x.value):Oe?l>x.value:ye>new Date(x.value)),Ue(re.value)&&l&&(U=ue?he(l)<he(re.value):Oe?l<re.value:ye<new Date(re.value))}if((F||U)&&(M(!!F,x.message,re.message,et.max,et.min),!n))return _(d[S].message),d}if((u||f)&&!Z&&(Ue(l)||o&&Array.isArray(l))){const F=Ot(u),U=Ot(f),x=!Fe(F.value)&&l.length>+F.value,re=!Fe(U.value)&&l.length<+U.value;if((x||re)&&(M(x,F.message,U.message),!n))return _(d[S].message),d}if(h&&!Z&&Ue(l)){const{value:F,message:U}=Ot(h);if(ir(F)&&!l.match(F)&&(d[S]={type:et.pattern,message:U,ref:i,...K(et.pattern,U)},!n))return _(U),d}if(w){if(He(w)){const F=await w(l,r),U=jo(F,y);if(U&&(d[S]={...U,...K(et.validate,U.message)},!n))return _(U.message),d}else if(Pe(w)){let F={};for(const U in w){if(!Te(F)&&!n)break;const x=jo(await w[U](l,r),y,U);x&&(F={...x,...K(U,x.message)},_(x.message),n&&(d[S]=F))}if(!Te(F)&&(d[S]={ref:y,...F},!n))return d}}return _(!0),d};const Gf={mode:Je.onSubmit,reValidateMode:Je.onChange,shouldFocusError:!0};function Bf(e={}){let t={...Gf,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:He(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=Pe(t.defaultValues)||Pe(t.values)?ge(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:ge(s),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},g={...f};let m={...g};const h={array:yo(),state:yo()},w=t.criteriaMode===Je.all,S=k=>A=>{clearTimeout(u),u=setTimeout(k,A)},p=async k=>{if(!i.keepIsValid&&!t.disabled&&(g.isValid||m.isValid||k)){let A;t.resolver?(A=Te((await T()).errors),v()):A=await K(n,!0),A!==r.isValid&&h.state.next({isValid:A})}},v=(k,A)=>{!t.disabled&&(g.isValidating||g.validatingFields||m.isValidating||m.validatingFields)&&((k||Array.from(a.mount)).forEach(R=>{R&&(A?me(r.validatingFields,R,A):ke(r.validatingFields,R))}),h.state.next({validatingFields:r.validatingFields,isValidating:!Te(r.validatingFields)}))},l=(k,A=[],R,B,J=!0,L=!0)=>{if(B&&R&&!t.disabled){if(i.action=!0,L&&Array.isArray(W(n,k))){const Q=R(W(n,k),B.argA,B.argB);J&&me(n,k,Q)}if(L&&Array.isArray(W(r.errors,k))){const Q=R(W(r.errors,k),B.argA,B.argB);J&&me(r.errors,k,Q),Hf(r.errors,k)}if((g.touchedFields||m.touchedFields)&&L&&Array.isArray(W(r.touchedFields,k))){const Q=R(W(r.touchedFields,k),B.argA,B.argB);J&&me(r.touchedFields,k,Q)}(g.dirtyFields||m.dirtyFields)&&(r.dirtyFields=Et(s,o)),h.state.next({name:k,isDirty:F(k,A),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else me(o,k,A)},y=(k,A)=>{me(r.errors,k,A),h.state.next({errors:r.errors})},_=k=>{r.errors=k,h.state.next({errors:r.errors,isValid:!1})},d=(k,A,R,B)=>{const J=W(n,k);if(J){const L=W(o,k,_e(R)?W(s,k):R);_e(L)||B&&B.defaultChecked||A?me(o,k,A?L:Po(J._f)):re(k,L),i.mount&&!i.action&&p()}},$=(k,A,R,B,J)=>{let L=!1,Q=!1;const le={name:k};if(!t.disabled){if(!R||B){(g.isDirty||m.isDirty)&&(Q=r.isDirty,r.isDirty=le.isDirty=F(),L=Q!==le.isDirty);const fe=ut(W(s,k),A);Q=!!W(r.dirtyFields,k),fe?ke(r.dirtyFields,k):me(r.dirtyFields,k,!0),le.dirtyFields=r.dirtyFields,L=L||(g.dirtyFields||m.dirtyFields)&&Q!==!fe}if(R){const fe=W(r.touchedFields,k);fe||(me(r.touchedFields,k,R),le.touchedFields=r.touchedFields,L=L||(g.touchedFields||m.touchedFields)&&fe!==R)}L&&J&&h.state.next(le)}return L?le:{}},E=(k,A,R,B)=>{const J=W(r.errors,k),L=(g.isValid||m.isValid)&&Xe(A)&&r.isValid!==A;if(t.delayError&&R?(c=S(()=>y(k,R)),c(t.delayError)):(clearTimeout(u),c=null,R?me(r.errors,k,R):ke(r.errors,k)),(R?!ut(J,R):J)||!Te(B)||L){const Q={...B,...L&&Xe(A)?{isValid:A}:{},errors:r.errors,name:k};r={...r,...Q},h.state.next(Q)}},T=async k=>(v(k,!0),await t.resolver(o,t.context,Zf(k||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),Z=async k=>{const{errors:A}=await T(k);if(v(k),k)for(const R of k){const B=W(A,R);B?me(r.errors,R,B):ke(r.errors,R)}else r.errors=A;return A},K=async(k,A,R={valid:!0})=>{for(const B in k){const J=k[B];if(J){const{_f:L,...Q}=J;if(L){const le=a.array.has(L.name),fe=J._f&&Uf(J._f);fe&&g.validatingFields&&v([L.name],!0);const Ne=await Cn(J,a.disabled,o,w,t.shouldUseNativeValidation&&!A,le);if(fe&&g.validatingFields&&v([L.name]),Ne[L.name]&&(R.valid=!1,A||e.shouldUseNativeValidation))break;!A&&(W(Ne,L.name)?le?Ao(r.errors,Ne,L.name):me(r.errors,L.name,Ne[L.name]):ke(r.errors,L.name))}!Te(Q)&&await K(Q,A,R)}}return R.valid},M=()=>{for(const k of a.unMount){const A=W(n,k);A&&(A._f.refs?A._f.refs.every(R=>!Tn(R)):!Tn(A._f.ref))&&Y(k)}a.unMount=new Set},F=(k,A)=>!t.disabled&&(k&&A&&me(o,k,A),!ut(O(),s)),U=(k,A,R)=>Cf(k,a,{...i.mount?o:_e(A)?s:Ue(k)?{[k]:A}:A},R,A),x=k=>sr(W(i.mount?o:s,k,t.shouldUnregister?W(s,k,[]):[])),re=(k,A,R={})=>{const B=W(n,k);let J=A;if(B){const L=B._f;L&&(!L.disabled&&me(o,k,So(A,L)),J=or(L.ref)&&Fe(A)?"":A,go(L.ref)?[...L.ref.options].forEach(Q=>Q.selected=J.includes(Q.value)):L.refs?It(L.ref)?L.refs.forEach(Q=>{(!Q.defaultChecked||!Q.disabled)&&(Array.isArray(J)?Q.checked=!!J.find(le=>le===Q.value):Q.checked=J===Q.value||!!J)}):L.refs.forEach(Q=>Q.checked=Q.value===J):jn(L.ref)?L.ref.value="":(L.ref.value=J,L.ref.type||h.state.next({name:k,values:ge(o)})))}(R.shouldDirty||R.shouldTouch)&&$(k,J,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&D(k)},ye=(k,A,R)=>{for(const B in A){if(!A.hasOwnProperty(B))return;const J=A[B],L=k+"."+B,Q=W(n,L);(a.array.has(k)||Pe(J)||Q&&!Q._f)&&!mt(J)?ye(L,J,R):re(L,J,R)}},he=(k,A,R={})=>{const B=W(n,k),J=a.array.has(k),L=ge(A);me(o,k,L),J?(h.array.next({name:k,values:ge(o)}),(g.isDirty||g.dirtyFields||m.isDirty||m.dirtyFields)&&R.shouldDirty&&h.state.next({name:k,dirtyFields:Et(s,o),isDirty:F(k,L)})):B&&!B._f&&!Fe(L)?ye(k,L,R):re(k,L,R),In(k,a)?h.state.next({...r,name:k,values:ge(o)}):h.state.next({name:i.mount?k:void 0,values:ge(o)})},ue=async k=>{i.mount=!0;const A=k.target;let R=A.name,B=!0;const J=W(n,R),L=fe=>{B=Number.isNaN(fe)||mt(fe)&&isNaN(fe.getTime())||ut(fe,W(o,R,fe))},Q=kt(t.mode),le=kt(t.reValidateMode);if(J){let fe,Ne;const gt=A.type?Po(J._f):Af(k),ft=k.type===ho.BLUR||k.type===ho.FOCUS_OUT,ym=!Lf(J._f)&&!t.resolver&&!W(r.errors,R)&&!J._f.deps||Jf(ft,W(r.touchedFields,R),r.isSubmitted,le,Q),as=In(R,a,ft);me(o,R,gt),ft?(!A||!A.readOnly)&&(J._f.onBlur&&J._f.onBlur(k),c&&c(0)):J._f.onChange&&J._f.onChange(k);const cs=$(R,gt,ft),_m=!Te(cs)||as;if(!ft&&h.state.next({name:R,type:k.type,values:ge(o)}),ym)return(g.isValid||m.isValid)&&(t.mode==="onBlur"?ft&&p():ft||p()),_m&&h.state.next({name:R,...as?{}:cs});if(!ft&&as&&h.state.next({...r}),t.resolver){const{errors:Ta}=await T([R]);if(v([R]),L(gt),B){const gm=zo(r.errors,n,R),Ra=zo(Ta,n,gm.name||R);fe=Ra.error,R=Ra.name,Ne=Te(Ta)}}else v([R],!0),fe=(await Cn(J,a.disabled,o,w,t.shouldUseNativeValidation))[R],v([R]),L(gt),B&&(fe?Ne=!1:(g.isValid||m.isValid)&&(Ne=await K(n,!0)));B&&(J._f.deps&&(!Array.isArray(J._f.deps)||J._f.deps.length>0)&&D(J._f.deps),E(R,Ne,fe,cs))}},Oe=(k,A)=>{if(W(r.errors,A)&&k.focus)return k.focus(),1},D=async(k,A={})=>{let R,B;const J=Me(k);if(t.resolver){const L=await Z(_e(k)?k:J);R=Te(L),B=k?!J.some(Q=>W(L,Q)):R}else k?(B=(await Promise.all(J.map(async L=>{const Q=W(n,L);return await K(Q&&Q._f?{[L]:Q}:Q)}))).every(Boolean),!(!B&&!r.isValid)&&p()):B=R=await K(n);return h.state.next({...!Ue(k)||(g.isValid||m.isValid)&&R!==r.isValid?{}:{name:k},...t.resolver||!k?{isValid:R}:{},errors:r.errors}),A.shouldFocus&&!B&&Pt(n,Oe,k?J:a.mount),B},O=(k,A)=>{let R={...i.mount?o:s};return A&&(R=_o(A.dirtyFields?r.dirtyFields:r.touchedFields,R)),_e(k)?R:Ue(k)?W(R,k):k.map(B=>W(R,B))},C=(k,A)=>({invalid:!!W((A||r).errors,k),isDirty:!!W((A||r).dirtyFields,k),error:W((A||r).errors,k),isValidating:!!W(r.validatingFields,k),isTouched:!!W((A||r).touchedFields,k)}),j=k=>{k&&Me(k).forEach(A=>ke(r.errors,A)),h.state.next({errors:k?r.errors:{}})},b=(k,A,R)=>{const B=(W(n,k,{_f:{}})._f||{}).ref,J=W(r.errors,k)||{},{ref:L,message:Q,type:le,...fe}=J;me(r.errors,k,{...fe,...A,ref:B}),h.state.next({name:k,errors:r.errors,isValid:!1}),R&&R.shouldFocus&&B&&B.focus&&B.focus()},P=(k,A)=>He(k)?h.state.subscribe({next:R=>"values"in R&&k(U(void 0,A),R)}):U(k,A,!0),I=k=>h.state.subscribe({next:A=>{xf(k.name,A.name,k.exact)&&Kf(A,k.formState||g,Ke,k.reRenderRoot)&&k.callback({values:{...o},...r,...A,defaultValues:s})}}).unsubscribe,G=k=>(i.mount=!0,m={...m,...k.formState},I({...k,formState:{...f,...k.formState}})),Y=(k,A={})=>{for(const R of k?Me(k):a.mount)a.mount.delete(R),a.array.delete(R),A.keepValue||(ke(n,R),ke(o,R)),!A.keepError&&ke(r.errors,R),!A.keepDirty&&ke(r.dirtyFields,R),!A.keepTouched&&ke(r.touchedFields,R),!A.keepIsValidating&&ke(r.validatingFields,R),!t.shouldUnregister&&!A.keepDefaultValue&&ke(s,R);h.state.next({values:ge(o)}),h.state.next({...r,...A.keepDirty?{isDirty:F()}:{}}),!A.keepIsValid&&p()},ie=({disabled:k,name:A})=>{if(Xe(k)&&i.mount||k||a.disabled.has(A)){const J=a.disabled.has(A)!==!!k;k?a.disabled.add(A):a.disabled.delete(A),J&&i.mount&&!i.action&&p()}},ae=(k,A={})=>{let R=W(n,k);const B=Xe(A.disabled)||Xe(t.disabled);return me(n,k,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:k}},name:k,mount:!0,...A}}),a.mount.add(k),R?ie({disabled:Xe(A.disabled)?A.disabled:t.disabled,name:k}):d(k,!0,A.value),{...B?{disabled:A.disabled||t.disabled}:{},...t.progressive?{required:!!A.required,min:Ct(A.min),max:Ct(A.max),minLength:Ct(A.minLength),maxLength:Ct(A.maxLength),pattern:Ct(A.pattern)}:{},name:k,onChange:ue,onBlur:ue,ref:J=>{if(J){ae(k,A),R=W(n,k);const L=_e(J.value)&&J.querySelectorAll&&J.querySelectorAll("input,select,textarea")[0]||J,Q=Vf(L),le=R._f.refs||[];if(Q?le.find(fe=>fe===L):L===R._f.ref)return;me(n,k,{_f:{...R._f,...Q?{refs:[...le.filter(Tn),L,...Array.isArray(W(s,k))?[{}]:[]],ref:{type:L.type,name:k}}:{ref:L}}}),d(k,!1,void 0,L)}else R=W(n,k,{}),R._f&&(R._f.mount=!1),(t.shouldUnregister||A.shouldUnregister)&&!(Nf(a.array,k)&&i.action)&&a.unMount.add(k)}}},z=()=>t.shouldFocusError&&Pt(n,Oe,a.mount),N=k=>{Xe(k)&&(h.state.next({disabled:k}),Pt(n,(A,R)=>{const B=W(n,R);B&&(A.disabled=B._f.disabled||k,Array.isArray(B._f.refs)&&B._f.refs.forEach(J=>{J.disabled=B._f.disabled||k}))},0,!1))},q=(k,A)=>async R=>{let B;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let J=ge(o);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:L,values:Q}=await T();v(),r.errors=L,J=ge(Q)}else await K(n);if(a.disabled.size)for(const L of a.disabled)ke(J,L);if(ke(r.errors,"root"),Te(r.errors)){h.state.next({errors:{}});try{await k(J,R)}catch(L){B=L}}else A&&await A({...r.errors},R),z(),setTimeout(z);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Te(r.errors)&&!B,submitCount:r.submitCount+1,errors:r.errors}),B)throw B},H=(k,A={})=>{W(n,k)&&(_e(A.defaultValue)?he(k,ge(W(s,k))):(he(k,A.defaultValue),me(s,k,ge(A.defaultValue))),A.keepTouched||ke(r.touchedFields,k),A.keepDirty||(ke(r.dirtyFields,k),r.isDirty=A.defaultValue?F(k,ge(W(s,k))):F()),A.keepError||(ke(r.errors,k),g.isValid&&p()),h.state.next({...r}))},X=(k,A={})=>{const R=k?ge(k):s,B=ge(R),J=Te(k),L=J?s:B;if(A.keepDefaultValues||(s=R),!A.keepValues){if(A.keepDirtyValues){const Q=new Set([...a.mount,...Object.keys(Et(s,o))]);for(const le of Array.from(Q)){const fe=W(r.dirtyFields,le),Ne=W(o,le),gt=W(L,le);fe&&!_e(Ne)?me(L,le,Ne):!fe&&!_e(gt)&&he(le,gt)}}else{if(Pn&&_e(k))for(const Q of a.mount){const le=W(n,Q);if(le&&le._f){const fe=Array.isArray(le._f.refs)?le._f.refs[0]:le._f.ref;if(or(fe)){const Ne=fe.closest("form");if(Ne){Ne.reset();break}}}}if(A.keepFieldsRef)for(const Q of a.mount)he(Q,W(L,Q));else n={}}o=t.shouldUnregister?A.keepDefaultValues?ge(s):{}:ge(L),h.array.next({values:{...L}}),h.state.next({values:{...L}})}a={mount:A.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!g.isValid||!!A.keepIsValid||!!A.keepDirtyValues||!t.shouldUnregister&&!Te(L),i.watch=!!t.shouldUnregister,i.keepIsValid=!!A.keepIsValid,i.action=!1,A.keepErrors||(r.errors={}),h.state.next({submitCount:A.keepSubmitCount?r.submitCount:0,isDirty:J?!1:A.keepDirty?r.isDirty:!!(A.keepDefaultValues&&!ut(k,s)),isSubmitted:A.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:J?{}:A.keepDirtyValues?A.keepDefaultValues&&o?Et(s,o):r.dirtyFields:A.keepDefaultValues&&k?Et(s,k):A.keepDirty?r.dirtyFields:{},touchedFields:A.keepTouched?r.touchedFields:{},errors:A.keepErrors?r.errors:{},isSubmitSuccessful:A.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},se=(k,A)=>X(He(k)?k(o):k,{...t.resetOptions,...A}),ze=(k,A={})=>{const R=W(n,k),B=R&&R._f;if(B){const J=B.refs?B.refs[0]:B.ref;J.focus&&setTimeout(()=>{J.focus(),A.shouldSelect&&He(J.select)&&J.select()})}},Ke=k=>{r={...r,...k}},je={control:{register:ae,unregister:Y,getFieldState:C,handleSubmit:q,setError:b,_subscribe:I,_runSchema:T,_updateIsValidating:v,_focusError:z,_getWatch:U,_getDirty:F,_setValid:p,_setFieldArray:l,_setDisabledField:ie,_setErrors:_,_getFieldArray:x,_reset:X,_resetDefaultValues:()=>He(t.defaultValues)&&t.defaultValues().then(k=>{se(k,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:M,_disableForm:N,_subjects:h,_proxyFormState:g,get _fields(){return n},get _formValues(){return o},get _state(){return i},set _state(k){i=k},get _defaultValues(){return s},get _names(){return a},set _names(k){a=k},get _formState(){return r},get _options(){return t},set _options(k){t={...t,...k}}},subscribe:G,trigger:D,register:ae,handleSubmit:q,watch:P,setValue:he,getValues:O,reset:se,resetField:H,clearErrors:j,unregister:Y,setError:b,setFocus:ze,getFieldState:C};return{...je,formControl:je}}var dt=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=(Math.random()*16+e)%16|0;return(t=="x"?r:r&3|8).toString(16)})},Dn=(e,t,r={})=>r.shouldFocus||_e(r.shouldFocus)?r.focusName||`${e}.${_e(r.focusIndex)?t:r.focusIndex}.`:"",Vn=(e,t)=>[...e,...Me(t)],Fn=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Mn(e,t,r){return[...e.slice(0,t),...Me(r),...e.slice(t)]}var qn=(e,t,r)=>Array.isArray(e)?(_e(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],Zn=(e,t)=>[...Me(t),...Me(e)];function Wf(e,t){let r=0;const n=[...e];for(const s of t)n.splice(s-r,1),r++;return sr(n).length?n:[]}var Un=(e,t)=>_e(t)?[]:Wf(e,Me(t).sort((r,n)=>r-n)),Ln=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]},No=(e,t,r)=>(e[t]=r,e);function To(e){const t=Rf(),{control:r=t,name:n,keyName:s="id",shouldUnregister:o,rules:i}=e,[a,c]=ee.useState(r._getFieldArray(n)),u=ee.useRef(r._getFieldArray(n).map(dt)),f=ee.useRef(!1);r._names.array.add(n),ee.useMemo(()=>i&&a.length>=0&&r.register(n,i),[r,n,a.length,i]),po(()=>r._subjects.array.subscribe({next:({values:_,name:d})=>{if(d===n||!d){const $=W(_,n);Array.isArray($)&&(c($),u.current=$.map(dt))}}}).unsubscribe,[r,n]);const g=ee.useCallback(_=>{f.current=!0,r._setFieldArray(n,_)},[r,n]),m=(_,d)=>{const $=Me(ge(_)),E=Vn(r._getFieldArray(n),$);r._names.focus=Dn(n,E.length-1,d),u.current=Vn(u.current,$.map(dt)),g(E),c(E),r._setFieldArray(n,E,Vn,{argA:Fn(_)})},h=(_,d)=>{const $=Me(ge(_)),E=Zn(r._getFieldArray(n),$);r._names.focus=Dn(n,0,d),u.current=Zn(u.current,$.map(dt)),g(E),c(E),r._setFieldArray(n,E,Zn,{argA:Fn(_)})},w=_=>{const d=Un(r._getFieldArray(n),_);u.current=Un(u.current,_),g(d),c(d),!Array.isArray(W(r._fields,n))&&me(r._fields,n,void 0),r._setFieldArray(n,d,Un,{argA:_})},S=(_,d,$)=>{const E=Me(ge(d)),T=Mn(r._getFieldArray(n),_,E);r._names.focus=Dn(n,_,$),u.current=Mn(u.current,_,E.map(dt)),g(T),c(T),r._setFieldArray(n,T,Mn,{argA:_,argB:Fn(d)})},p=(_,d)=>{const $=r._getFieldArray(n);Ln($,_,d),Ln(u.current,_,d),g($),c($),r._setFieldArray(n,$,Ln,{argA:_,argB:d},!1)},v=(_,d)=>{const $=r._getFieldArray(n);qn($,_,d),qn(u.current,_,d),g($),c($),r._setFieldArray(n,$,qn,{argA:_,argB:d},!1)},l=(_,d)=>{const $=ge(d),E=No(r._getFieldArray(n),_,$);u.current=[...E].map((T,Z)=>!T||Z===_?dt():u.current[Z]),g(E),c([...E]),r._setFieldArray(n,E,No,{argA:_,argB:$},!0,!1)},y=_=>{const d=Me(ge(_));u.current=d.map(dt),g([...d]),c([...d]),r._setFieldArray(n,[...d],$=>$,{},!0,!1)};return ee.useEffect(()=>{if(r._state.action=!1,In(n,r._names)&&r._subjects.state.next({...r._formState}),f.current&&(!kt(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!kt(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([n]).then(_=>{r._updateIsValidating([n]);const d=W(_.errors,n),$=W(r._formState.errors,n);($?!d&&$.type||d&&($.type!==d.type||$.message!==d.message):d&&d.type)&&(d?me(r._formState.errors,n,d):ke(r._formState.errors,n),r._subjects.state.next({errors:r._formState.errors}))});else{const _=W(r._fields,n);_&&_._f&&!(kt(r._options.reValidateMode).isOnSubmit&&kt(r._options.mode).isOnSubmit)&&Cn(_,r._names.disabled,r._formValues,r._options.criteriaMode===Je.all,r._options.shouldUseNativeValidation,!0).then(d=>!Te(d)&&r._subjects.state.next({errors:Ao(r._formState.errors,d,n)}))}r._subjects.state.next({name:n,values:ge(r._formValues)}),r._names.focus&&Pt(r._fields,(_,d)=>{if(r._names.focus&&d.startsWith(r._names.focus)&&_.focus)return _.focus(),1}),r._names.focus="",r._setValid(),f.current=!1},[a,n,r]),ee.useEffect(()=>(!W(r._formValues,n)&&r._setFieldArray(n),()=>{const _=(d,$)=>{const E=W(r._fields,d);E&&E._f&&(E._f.mount=$)};r._options.shouldUnregister||o?r.unregister(n):_(n,!1)}),[n,r,s,o]),{swap:ee.useCallback(p,[g,n,r]),move:ee.useCallback(v,[g,n,r]),prepend:ee.useCallback(h,[g,n,r]),append:ee.useCallback(m,[g,n,r]),remove:ee.useCallback(w,[g,n,r]),insert:ee.useCallback(S,[g,n,r]),update:ee.useCallback(l,[g,n,r]),replace:ee.useCallback(y,[g,n,r]),fields:ee.useMemo(()=>a.map((_,d)=>({..._,[s]:u.current[d]||dt()})),[a,s])}}function Yf(e={}){const t=ee.useRef(void 0),r=ee.useRef(void 0),[n,s]=ee.useState({isDirty:!1,isValidating:!1,isLoading:He(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:He(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!He(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...a}=Bf(e);t.current={...a,formState:n}}const o=t.current.control;return o._options=e,po(()=>{const i=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(a=>({...a,isReady:!0})),o._formState.isReady=!0,i},[o]),ee.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),ee.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),ee.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),ee.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),ee.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==n.isDirty&&o._subjects.state.next({isDirty:i})}},[o,n.isDirty]),ee.useEffect(()=>{var i;e.values&&!ut(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((i=o._options.resetOptions)===null||i===void 0)&&i.keepIsValid||o._setValid(),r.current=e.values,s(a=>({...a}))):o._resetDefaultValues()},[o,e.values]),ee.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=ee.useMemo(()=>If(n,o),[o,n]),t.current}const Ro=(e,t,r)=>{if(e&&"reportValidity"in e){const n=W(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Kn=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Ro(n.ref,r,e):n&&n.refs&&n.refs.forEach(s=>Ro(s,r,e))}},Io=(e,t)=>{t.shouldUseNativeValidation&&Kn(e,t);const r={};for(const n in e){const s=W(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(Xf(t.names||Object.keys(e),n)){const i=Object.assign({},W(r,n));me(i,"root",o),me(r,n,i)}else me(r,n,o)}return r},Xf=(e,t)=>{const r=Co(t);return e.some(n=>Co(n).match(`^${r}\\.\\d+`))};function Co(e){return e.replace(/\]|\[/g,"")}function Do(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function Qf(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(f){return f.errors.forEach(function(g){return e.push(g)})}),t){var c=r[i].types,u=c&&c[n.code];r[i]=An(i,t,r,s,u?[].concat(u,n.message):n.message)}e.shift()}return r}function eh(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if(n.code==="invalid_union"&&n.errors.forEach(function(f){return f.forEach(function(g){return e.push(g)})}),t){var c=r[i].types,u=c&&c[n.code];r[i]=An(i,t,r,s,u?[].concat(u,n.message):n.message)}e.shift()}return r}function th(e,t,r){if(r===void 0&&(r={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,s,o){try{return Promise.resolve(Do(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(i){return o.shouldUseNativeValidation&&Kn({},o),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:Io(Qf(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,s,o){try{return Promise.resolve(Do(function(){return Promise.resolve((r.mode==="sync"?nc:sc)(e,n,t)).then(function(i){return o.shouldUseNativeValidation&&Kn({},o),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof vn})(i))return{values:{},errors:Io(eh(i.issues,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}};throw new Error("Invalid input: not a Zod schema")}function Vo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ar={exports:{}},xn={},tt={},pt={},Jn={},Hn={},Gn={},Fo;function cr(){return Fo||(Fo=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(l){if(super(),!e.IDENTIFIER.test(l))throw new Error("CodeGen: name must be a valid identifier");this.str=l}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(l){super(),this._items=typeof l=="string"?[l]:l}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const l=this._items[0];return l===""||l==='""'}get str(){var l;return(l=this._str)!==null&&l!==void 0?l:this._str=this._items.reduce((y,_)=>`${y}${_}`,"")}get names(){var l;return(l=this._names)!==null&&l!==void 0?l:this._names=this._items.reduce((y,_)=>(_ instanceof r&&(y[_.str]=(y[_.str]||0)+1),y),{})}}e._Code=n,e.nil=new n("");function s(v,...l){const y=[v[0]];let _=0;for(;_<l.length;)a(y,l[_]),y.push(v[++_]);return new n(y)}e._=s;const o=new n("+");function i(v,...l){const y=[h(v[0])];let _=0;for(;_<l.length;)y.push(o),a(y,l[_]),y.push(o,h(v[++_]));return c(y),new n(y)}e.str=i;function a(v,l){l instanceof n?v.push(...l._items):l instanceof r?v.push(l):v.push(g(l))}e.addCodeArg=a;function c(v){let l=1;for(;l<v.length-1;){if(v[l]===o){const y=u(v[l-1],v[l+1]);if(y!==void 0){v.splice(l-1,3,y);continue}v[l++]="+"}l++}}function u(v,l){if(l==='""')return v;if(v==='""')return l;if(typeof v=="string")return l instanceof r||v[v.length-1]!=='"'?void 0:typeof l!="string"?`${v.slice(0,-1)}${l}"`:l[0]==='"'?v.slice(0,-1)+l.slice(1):void 0;if(typeof l=="string"&&l[0]==='"'&&!(v instanceof r))return`"${v}${l.slice(1)}`}function f(v,l){return l.emptyStr()?v:v.emptyStr()?l:i`${v}${l}`}e.strConcat=f;function g(v){return typeof v=="number"||typeof v=="boolean"||v===null?v:h(Array.isArray(v)?v.join(","):v)}function m(v){return new n(h(v))}e.stringify=m;function h(v){return JSON.stringify(v).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=h;function w(v){return typeof v=="string"&&e.IDENTIFIER.test(v)?new n(`.${v}`):s`[${v}]`}e.getProperty=w;function S(v){if(typeof v=="string"&&e.IDENTIFIER.test(v))return new n(`${v}`);throw new Error(`CodeGen: invalid export name: ${v}, use explicit $id name mapping`)}e.getEsmExportName=S;function p(v){return new n(v.toString())}e.regexpCode=p})(Gn)),Gn}var Bn={},Mo;function qo(){return Mo||(Mo=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=cr();class r extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var n;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{constructor({prefixes:u,parent:f}={}){this._names={},this._prefixes=u,this._parent=f}toName(u){return u instanceof t.Name?u:this.name(u)}name(u){return new t.Name(this._newName(u))}_newName(u){const f=this._names[u]||this._nameGroup(u);return`${u}${f.index++}`}_nameGroup(u){var f,g;if(!((g=(f=this._parent)===null||f===void 0?void 0:f._prefixes)===null||g===void 0)&&g.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}e.Scope=s;class o extends t.Name{constructor(u,f){super(f),this.prefix=u}setValue(u,{property:f,itemIndex:g}){this.value=u,this.scopePath=(0,t._)`.${new t.Name(f)}[${g}]`}}e.ValueScopeName=o;const i=(0,t._)`\n`;class a extends s{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?i:t.nil}}get(){return this._scope}name(u){return new o(u,this._newName(u))}value(u,f){var g;if(f.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const m=this.toName(u),{prefix:h}=m,w=(g=f.key)!==null&&g!==void 0?g:f.ref;let S=this._values[h];if(S){const l=S.get(w);if(l)return l}else S=this._values[h]=new Map;S.set(w,m);const p=this._scope[h]||(this._scope[h]=[]),v=p.length;return p[v]=f.ref,m.setValue(f,{property:h,itemIndex:v}),m}getValue(u,f){const g=this._values[u];if(g)return g.get(f)}scopeRefs(u,f=this._values){return this._reduceValues(f,g=>{if(g.scopePath===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return(0,t._)`${u}${g.scopePath}`})}scopeCode(u=this._values,f,g){return this._reduceValues(u,m=>{if(m.value===void 0)throw new Error(`CodeGen: name "${m}" has no value`);return m.value.code},f,g)}_reduceValues(u,f,g={},m){let h=t.nil;for(const w in u){const S=u[w];if(!S)continue;const p=g[w]=g[w]||new Map;S.forEach(v=>{if(p.has(v))return;p.set(v,n.Started);let l=f(v);if(l){const y=this.opts.es5?e.varKinds.var:e.varKinds.const;h=(0,t._)`${h}${y} ${v} = ${l};${this.opts._n}`}else if(l=m?.(v))h=(0,t._)`${h}${l}${this.opts._n}`;else throw new r(v);p.set(v,n.Completed)})}return h}}e.ValueScope=a})(Bn)),Bn}var Zo;function ne(){return Zo||(Zo=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=cr(),r=qo();var n=cr();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var s=qo();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(b,P){return this}}class i extends o{constructor(b,P,I){super(),this.varKind=b,this.name=P,this.rhs=I}render({es5:b,_n:P}){const I=b?r.varKinds.var:this.varKind,G=this.rhs===void 0?"":` = ${this.rhs}`;return`${I} ${this.name}${G};`+P}optimizeNames(b,P){if(b[this.name.str])return this.rhs&&(this.rhs=x(this.rhs,b,P)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class a extends o{constructor(b,P,I){super(),this.lhs=b,this.rhs=P,this.sideEffects=I}render({_n:b}){return`${this.lhs} = ${this.rhs};`+b}optimizeNames(b,P){if(!(this.lhs instanceof t.Name&&!b[this.lhs.str]&&!this.sideEffects))return this.rhs=x(this.rhs,b,P),this}get names(){const b=this.lhs instanceof t.Name?{}:{...this.lhs.names};return U(b,this.rhs)}}class c extends a{constructor(b,P,I,G){super(b,I,G),this.op=P}render({_n:b}){return`${this.lhs} ${this.op}= ${this.rhs};`+b}}class u extends o{constructor(b){super(),this.label=b,this.names={}}render({_n:b}){return`${this.label}:`+b}}class f extends o{constructor(b){super(),this.label=b,this.names={}}render({_n:b}){return`break${this.label?` ${this.label}`:""};`+b}}class g extends o{constructor(b){super(),this.error=b}render({_n:b}){return`throw ${this.error};`+b}get names(){return this.error.names}}class m extends o{constructor(b){super(),this.code=b}render({_n:b}){return`${this.code};`+b}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(b,P){return this.code=x(this.code,b,P),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class h extends o{constructor(b=[]){super(),this.nodes=b}render(b){return this.nodes.reduce((P,I)=>P+I.render(b),"")}optimizeNodes(){const{nodes:b}=this;let P=b.length;for(;P--;){const I=b[P].optimizeNodes();Array.isArray(I)?b.splice(P,1,...I):I?b[P]=I:b.splice(P,1)}return b.length>0?this:void 0}optimizeNames(b,P){const{nodes:I}=this;let G=I.length;for(;G--;){const Y=I[G];Y.optimizeNames(b,P)||(re(b,Y.names),I.splice(G,1))}return I.length>0?this:void 0}get names(){return this.nodes.reduce((b,P)=>F(b,P.names),{})}}class w extends h{render(b){return"{"+b._n+super.render(b)+"}"+b._n}}class S extends h{}class p extends w{}p.kind="else";class v extends w{constructor(b,P){super(P),this.condition=b}render(b){let P=`if(${this.condition})`+super.render(b);return this.else&&(P+="else "+this.else.render(b)),P}optimizeNodes(){super.optimizeNodes();const b=this.condition;if(b===!0)return this.nodes;let P=this.else;if(P){const I=P.optimizeNodes();P=this.else=Array.isArray(I)?new p(I):I}if(P)return b===!1?P instanceof v?P:P.nodes:this.nodes.length?this:new v(ye(b),P instanceof v?[P]:P.nodes);if(!(b===!1||!this.nodes.length))return this}optimizeNames(b,P){var I;if(this.else=(I=this.else)===null||I===void 0?void 0:I.optimizeNames(b,P),!!(super.optimizeNames(b,P)||this.else))return this.condition=x(this.condition,b,P),this}get names(){const b=super.names;return U(b,this.condition),this.else&&F(b,this.else.names),b}}v.kind="if";class l extends w{}l.kind="for";class y extends l{constructor(b){super(),this.iteration=b}render(b){return`for(${this.iteration})`+super.render(b)}optimizeNames(b,P){if(super.optimizeNames(b,P))return this.iteration=x(this.iteration,b,P),this}get names(){return F(super.names,this.iteration.names)}}class _ extends l{constructor(b,P,I,G){super(),this.varKind=b,this.name=P,this.from=I,this.to=G}render(b){const P=b.es5?r.varKinds.var:this.varKind,{name:I,from:G,to:Y}=this;return`for(${P} ${I}=${G}; ${I}<${Y}; ${I}++)`+super.render(b)}get names(){const b=U(super.names,this.from);return U(b,this.to)}}class d extends l{constructor(b,P,I,G){super(),this.loop=b,this.varKind=P,this.name=I,this.iterable=G}render(b){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(b)}optimizeNames(b,P){if(super.optimizeNames(b,P))return this.iterable=x(this.iterable,b,P),this}get names(){return F(super.names,this.iterable.names)}}class $ extends w{constructor(b,P,I){super(),this.name=b,this.args=P,this.async=I}render(b){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(b)}}$.kind="func";class E extends h{render(b){return"return "+super.render(b)}}E.kind="return";class T extends w{render(b){let P="try"+super.render(b);return this.catch&&(P+=this.catch.render(b)),this.finally&&(P+=this.finally.render(b)),P}optimizeNodes(){var b,P;return super.optimizeNodes(),(b=this.catch)===null||b===void 0||b.optimizeNodes(),(P=this.finally)===null||P===void 0||P.optimizeNodes(),this}optimizeNames(b,P){var I,G;return super.optimizeNames(b,P),(I=this.catch)===null||I===void 0||I.optimizeNames(b,P),(G=this.finally)===null||G===void 0||G.optimizeNames(b,P),this}get names(){const b=super.names;return this.catch&&F(b,this.catch.names),this.finally&&F(b,this.finally.names),b}}class Z extends w{constructor(b){super(),this.error=b}render(b){return`catch(${this.error})`+super.render(b)}}Z.kind="catch";class K extends w{render(b){return"finally"+super.render(b)}}K.kind="finally";class M{constructor(b,P={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...P,_n:P.lines?`
|
|
39
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){o(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){o(i);continue}}if(e.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}if(a.count>1&&e.reused==="ref"){o(i);continue}}}function Bs(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=i=>{const a=e.seen.get(i);if(a.ref===null)return;const c=a.def??a.schema,u={...c},f=a.ref;if(a.ref=null,f){n(f);const m=e.seen.get(f),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(h)):Object.assign(c,h),Object.assign(c,u),i._zod.parent===f)for(const S in c)S==="$ref"||S==="allOf"||S in u||delete c[S];if(h.$ref&&m.def)for(const S in c)S==="$ref"||S==="allOf"||S in m.def&&JSON.stringify(c[S])===JSON.stringify(m.def[S])&&delete c[S]}const g=i._zod.parent;if(g&&g!==f){n(g);const m=e.seen.get(g);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(const h in c)h==="$ref"||h==="allOf"||h in m.def&&JSON.stringify(c[h])===JSON.stringify(m.def[h])&&delete c[h]}e.override({zodSchema:i,jsonSchema:c,path:a.path??[]})};for(const i of[...e.seen.entries()].reverse())n(i[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(i)}Object.assign(s,r.def??r.schema);const o=e.external?.defs??{};for(const i of e.seen.entries()){const a=i[1];a.def&&a.defId&&(o[a.defId]=a.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const i=JSON.parse(JSON.stringify(s));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:Qt(t,"input",e.processors),output:Qt(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function Re(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Re(n.element,r);if(n.type==="set")return Re(n.valueType,r);if(n.type==="lazy")return Re(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Re(n.innerType,r);if(n.type==="intersection")return Re(n.left,r)||Re(n.right,r);if(n.type==="record"||n.type==="map")return Re(n.keyType,r)||Re(n.valueType,r);if(n.type==="pipe")return Re(n.in,r)||Re(n.out,r);if(n.type==="object"){for(const s in n.shape)if(Re(n.shape[s],r))return!0;return!1}if(n.type==="union"){for(const s of n.options)if(Re(s,r))return!0;return!1}if(n.type==="tuple"){for(const s of n.items)if(Re(s,r))return!0;return!!(n.rest&&Re(n.rest,r))}return!1}const Ld=(e,t={})=>r=>{const n=Hs({...r,processors:t});return Ee(e,n),Gs(n,e),Bs(n,e)},Qt=(e,t,r={})=>n=>{const{libraryOptions:s,target:o}=n??{},i=Hs({...s??{},target:o,io:t,processors:r});return Ee(e,i),Gs(i,e),Bs(i,e)},Kd={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},xd=(e,t,r,n)=>{const s=r;s.type="string";const{minimum:o,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof i=="number"&&(s.maxLength=i),a&&(s.format=Kd[a]??a,s.format===""&&delete s.format,a==="time"&&delete s.format),u&&(s.contentEncoding=u),c&&c.size>0){const f=[...c];f.length===1?s.pattern=f[0].source:f.length>1&&(s.allOf=[...f.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},Jd=(e,t,r,n)=>{const s=r,{minimum:o,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:f}=e._zod.bag;typeof a=="string"&&a.includes("int")?s.type="integer":s.type="number",typeof f=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=f,s.exclusiveMinimum=!0):s.exclusiveMinimum=f),typeof o=="number"&&(s.minimum=o,typeof f=="number"&&t.target!=="draft-04"&&(f>=o?delete s.minimum:delete s.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=u,s.exclusiveMaximum=!0):s.exclusiveMaximum=u),typeof i=="number"&&(s.maximum=i,typeof u=="number"&&t.target!=="draft-04"&&(u<=i?delete s.maximum:delete s.exclusiveMaximum)),typeof c=="number"&&(s.multipleOf=c)},Hd=(e,t,r,n)=>{r.type="boolean"},Gd=(e,t,r,n)=>{r.not={}},Bd=(e,t,r,n)=>{},Wd=(e,t,r,n)=>{},Yd=(e,t,r,n)=>{const s=e._zod.def,o=hs(s.entries);o.every(i=>typeof i=="number")&&(r.type="number"),o.every(i=>typeof i=="string")&&(r.type="string"),r.enum=o},Xd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Qd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},el=(e,t,r,n)=>{const s=r,o=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(s.minItems=i),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=Ee(o.element,t,{...n,path:[...n.path,"items"]})},tl=(e,t,r,n)=>{const s=r,o=e._zod.def;s.type="object",s.properties={};const i=o.shape;for(const u in i)s.properties[u]=Ee(i[u],t,{...n,path:[...n.path,"properties",u]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{const f=o.shape[u]._zod;return t.io==="input"?f.optin===void 0:f.optout===void 0}));c.size>0&&(s.required=Array.from(c)),o.catchall?._zod.def.type==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=Ee(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},rl=(e,t,r,n)=>{const s=e._zod.def,o=s.inclusive===!1,i=s.options.map((a,c)=>Ee(a,t,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=i:r.anyOf=i},nl=(e,t,r,n)=>{const s=e._zod.def,o=Ee(s.left,t,{...n,path:[...n.path,"allOf",0]}),i=Ee(s.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(o)?o.allOf:[o],...a(i)?i.allOf:[i]];r.allOf=c},sl=(e,t,r,n)=>{const s=r,o=e._zod.def;s.type="object";const i=o.keyType,c=i._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){const f=Ee(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});s.patternProperties={};for(const g of c)s.patternProperties[g.source]=f}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=Ee(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),s.additionalProperties=Ee(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});const u=i._zod.values;if(u){const f=[...u].filter(g=>typeof g=="string"||typeof g=="number");f.length>0&&(s.required=f)}},ol=(e,t,r,n)=>{const s=e._zod.def,o=Ee(s.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=s.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},il=(e,t,r,n)=>{const s=e._zod.def;Ee(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType},al=(e,t,r,n)=>{const s=e._zod.def;Ee(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType,r.default=JSON.parse(JSON.stringify(s.defaultValue))},cl=(e,t,r,n)=>{const s=e._zod.def;Ee(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},ul=(e,t,r,n)=>{const s=e._zod.def;Ee(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},dl=(e,t,r,n)=>{const s=e._zod.def,o=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;Ee(o,t,n);const i=t.seen.get(e);i.ref=o},ll=(e,t,r,n)=>{const s=e._zod.def;Ee(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType,r.readOnly=!0},Ws=(e,t,r,n)=>{const s=e._zod.def;Ee(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType},fl=(e,t,r,n)=>{const s=e._zod.innerType;Ee(s,t,n);const o=t.seen.get(e);o.ref=s},hl=V("ZodISODateTime",(e,t)=>{lu.init(e,t),we.init(e,t)});function ml(e){return gd(hl,e)}const pl=V("ZodISODate",(e,t)=>{fu.init(e,t),we.init(e,t)});function yl(e){return vd(pl,e)}const _l=V("ZodISOTime",(e,t)=>{hu.init(e,t),we.init(e,t)});function gl(e){return $d(_l,e)}const vl=V("ZodISODuration",(e,t)=>{mu.init(e,t),we.init(e,t)});function $l(e){return bd(vl,e)}const xe=V("ZodError",(e,t)=>{vn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>rc(e,r)},flatten:{value:r=>tc(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,mn,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,mn,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),bl=xt(xe),wl=Jt(xe),Sl=Ht(xe),El=Gt(xe),kl=ac(xe),Pl=cc(xe),Ol=uc(xe),zl=dc(xe),Al=lc(xe),jl=fc(xe),Nl=hc(xe),Tl=mc(xe),be=V("ZodType",(e,t)=>(ve.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Qt(e,"input"),output:Qt(e,"output")}}),e.toJSONSchema=Ld(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(ot(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>it(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>bl(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Sl(e,r,n),e.parseAsync=async(r,n)=>wl(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>El(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>kl(e,r,n),e.decode=(r,n)=>Pl(e,r,n),e.encodeAsync=async(r,n)=>Ol(e,r,n),e.decodeAsync=async(r,n)=>zl(e,r,n),e.safeEncode=(r,n)=>Al(e,r,n),e.safeDecode=(r,n)=>jl(e,r,n),e.safeEncodeAsync=async(r,n)=>Nl(e,r,n),e.safeDecodeAsync=async(r,n)=>Tl(e,r,n),e.refine=(r,n)=>e.check(Of(r,n)),e.superRefine=r=>e.check(zf(r)),e.overwrite=r=>e.check(St(r)),e.optional=()=>io(e),e.exactOptional=()=>hf(e),e.nullable=()=>ao(e),e.nullish=()=>io(ao(e)),e.nonoptional=r=>vf(e,r),e.array=()=>Ye(e),e.or=r=>En([e,r]),e.and=r=>cf(e,r),e.transform=r=>uo(e,lf(r)),e.default=r=>yf(e,r),e.prefault=r=>gf(e,r),e.catch=r=>bf(e,r),e.pipe=r=>uo(e,r),e.readonly=()=>Ef(e),e.describe=r=>{const n=e.clone();return Rt.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Rt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Rt.get(e);const n=e.clone();return Rt.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Ys=V("_ZodString",(e,t)=>{$n.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,s,o)=>xd(e,n,s);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(zd(...n)),e.includes=(...n)=>e.check(Nd(...n)),e.startsWith=(...n)=>e.check(Td(...n)),e.endsWith=(...n)=>e.check(Rd(...n)),e.min=(...n)=>e.check(Xt(...n)),e.max=(...n)=>e.check(xs(...n)),e.length=(...n)=>e.check(Js(...n)),e.nonempty=(...n)=>e.check(Xt(1,...n)),e.lowercase=n=>e.check(Ad(n)),e.uppercase=n=>e.check(jd(n)),e.trim=()=>e.check(Cd()),e.normalize=(...n)=>e.check(Id(...n)),e.toLowerCase=()=>e.check(Dd()),e.toUpperCase=()=>e.check(Vd()),e.slugify=()=>e.check(Fd())}),Rl=V("ZodString",(e,t)=>{$n.init(e,t),Ys.init(e,t),e.email=r=>e.check(Yu(Il,r)),e.url=r=>e.check(rd(Cl,r)),e.jwt=r=>e.check(_d(Wl,r)),e.emoji=r=>e.check(nd(Dl,r)),e.guid=r=>e.check(Zs(Xs,r)),e.uuid=r=>e.check(Xu(er,r)),e.uuidv4=r=>e.check(Qu(er,r)),e.uuidv6=r=>e.check(ed(er,r)),e.uuidv7=r=>e.check(td(er,r)),e.nanoid=r=>e.check(sd(Vl,r)),e.guid=r=>e.check(Zs(Xs,r)),e.cuid=r=>e.check(od(Fl,r)),e.cuid2=r=>e.check(id(Ml,r)),e.ulid=r=>e.check(ad(ql,r)),e.base64=r=>e.check(md(Hl,r)),e.base64url=r=>e.check(pd(Gl,r)),e.xid=r=>e.check(cd(Zl,r)),e.ksuid=r=>e.check(ud(Ul,r)),e.ipv4=r=>e.check(dd(Ll,r)),e.ipv6=r=>e.check(ld(Kl,r)),e.cidrv4=r=>e.check(fd(xl,r)),e.cidrv6=r=>e.check(hd(Jl,r)),e.e164=r=>e.check(yd(Bl,r)),e.datetime=r=>e.check(ml(r)),e.date=r=>e.check(yl(r)),e.time=r=>e.check(gl(r)),e.duration=r=>e.check($l(r))});function Ie(e){return Wu(Rl,e)}const we=V("ZodStringFormat",(e,t)=>{$e.init(e,t),Ys.init(e,t)}),Il=V("ZodEmail",(e,t)=>{ru.init(e,t),we.init(e,t)}),Xs=V("ZodGUID",(e,t)=>{eu.init(e,t),we.init(e,t)}),er=V("ZodUUID",(e,t)=>{tu.init(e,t),we.init(e,t)}),Cl=V("ZodURL",(e,t)=>{nu.init(e,t),we.init(e,t)}),Dl=V("ZodEmoji",(e,t)=>{su.init(e,t),we.init(e,t)}),Vl=V("ZodNanoID",(e,t)=>{ou.init(e,t),we.init(e,t)}),Fl=V("ZodCUID",(e,t)=>{iu.init(e,t),we.init(e,t)}),Ml=V("ZodCUID2",(e,t)=>{au.init(e,t),we.init(e,t)}),ql=V("ZodULID",(e,t)=>{cu.init(e,t),we.init(e,t)}),Zl=V("ZodXID",(e,t)=>{uu.init(e,t),we.init(e,t)}),Ul=V("ZodKSUID",(e,t)=>{du.init(e,t),we.init(e,t)}),Ll=V("ZodIPv4",(e,t)=>{pu.init(e,t),we.init(e,t)}),Kl=V("ZodIPv6",(e,t)=>{yu.init(e,t),we.init(e,t)}),xl=V("ZodCIDRv4",(e,t)=>{_u.init(e,t),we.init(e,t)}),Jl=V("ZodCIDRv6",(e,t)=>{gu.init(e,t),we.init(e,t)}),Hl=V("ZodBase64",(e,t)=>{vu.init(e,t),we.init(e,t)}),Gl=V("ZodBase64URL",(e,t)=>{bu.init(e,t),we.init(e,t)}),Bl=V("ZodE164",(e,t)=>{wu.init(e,t),we.init(e,t)}),Wl=V("ZodJWT",(e,t)=>{Eu.init(e,t),we.init(e,t)}),Qs=V("ZodNumber",(e,t)=>{zs.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Jd(e,n,s),e.gt=(n,s)=>e.check(Ls(n,s)),e.gte=(n,s)=>e.check(Sn(n,s)),e.min=(n,s)=>e.check(Sn(n,s)),e.lt=(n,s)=>e.check(Us(n,s)),e.lte=(n,s)=>e.check(wn(n,s)),e.max=(n,s)=>e.check(wn(n,s)),e.int=n=>e.check(eo(n)),e.safe=n=>e.check(eo(n)),e.positive=n=>e.check(Ls(0,n)),e.nonnegative=n=>e.check(Sn(0,n)),e.negative=n=>e.check(Us(0,n)),e.nonpositive=n=>e.check(wn(0,n)),e.multipleOf=(n,s)=>e.check(Ks(n,s)),e.step=(n,s)=>e.check(Ks(n,s)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function qe(e){return wd(Qs,e)}const Yl=V("ZodNumberFormat",(e,t)=>{ku.init(e,t),Qs.init(e,t)});function eo(e){return Sd(Yl,e)}const Xl=V("ZodBoolean",(e,t)=>{Pu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Hd(e,r,n)});function tr(e){return Ed(Xl,e)}const Ql=V("ZodAny",(e,t)=>{Ou.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Bd()});function to(){return kd(Ql)}const ef=V("ZodUnknown",(e,t)=>{zu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Wd()});function ro(){return Pd(ef)}const tf=V("ZodNever",(e,t)=>{Au.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Gd(e,r,n)});function rf(e){return Od(tf,e)}const nf=V("ZodArray",(e,t)=>{ju.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>el(e,r,n,s),e.element=t.element,e.min=(r,n)=>e.check(Xt(r,n)),e.nonempty=r=>e.check(Xt(1,r)),e.max=(r,n)=>e.check(xs(r,n)),e.length=(r,n)=>e.check(Js(r,n)),e.unwrap=()=>e.element});function Ye(e,t){return Md(nf,e,t)}const sf=V("ZodObject",(e,t)=>{Tu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>tl(e,r,n,s),de(e,"shape",()=>t.shape),e.keyof=()=>so(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ro()}),e.loose=()=>e.clone({...e._zod.def,catchall:ro()}),e.strict=()=>e.clone({...e._zod.def,catchall:rf()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Wa(e,r),e.safeExtend=r=>Ya(e,r),e.merge=r=>Xa(e,r),e.pick=r=>Ga(e,r),e.omit=r=>Ba(e,r),e.partial=(...r)=>Qa(oo,e,r[0]),e.required=(...r)=>ec(co,e,r[0])});function rr(e,t){const r={type:"object",shape:e??{},...te(t)};return new sf(r)}const of=V("ZodUnion",(e,t)=>{Ru.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>rl(e,r,n,s),e.options=t.options});function En(e,t){return new of({type:"union",options:e,...te(t)})}const af=V("ZodIntersection",(e,t)=>{Iu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>nl(e,r,n,s)});function cf(e,t){return new af({type:"intersection",left:e,right:t})}const uf=V("ZodRecord",(e,t)=>{Cu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>sl(e,r,n,s),e.keyType=t.keyType,e.valueType=t.valueType});function no(e,t,r){return new uf({type:"record",keyType:e,valueType:t,...te(r)})}const kn=V("ZodEnum",(e,t)=>{Du.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Yd(e,n,s),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,s)=>{const o={};for(const i of n)if(r.has(i))o[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new kn({...t,checks:[],...te(s),entries:o})},e.exclude=(n,s)=>{const o={...t.entries};for(const i of n)if(r.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new kn({...t,checks:[],...te(s),entries:o})}});function so(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new kn({type:"enum",entries:r,...te(t)})}const df=V("ZodTransform",(e,t)=>{Vu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Qd(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ls(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(Tt(o,r.value,t));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Tt(i))}};const s=t.transform(r.value,r);return s instanceof Promise?s.then(o=>(r.value=o,r)):(r.value=s,r)}});function lf(e){return new df({type:"transform",transform:e})}const oo=V("ZodOptional",(e,t)=>{Cs.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ws(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function io(e){return new oo({type:"optional",innerType:e})}const ff=V("ZodExactOptional",(e,t)=>{Fu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ws(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function hf(e){return new ff({type:"optional",innerType:e})}const mf=V("ZodNullable",(e,t)=>{Mu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ol(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function ao(e){return new mf({type:"nullable",innerType:e})}const pf=V("ZodDefault",(e,t)=>{qu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>al(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function yf(e,t){return new pf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():_s(t)}})}const _f=V("ZodPrefault",(e,t)=>{Zu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>cl(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function gf(e,t){return new _f({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():_s(t)}})}const co=V("ZodNonOptional",(e,t)=>{Uu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>il(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function vf(e,t){return new co({type:"nonoptional",innerType:e,...te(t)})}const $f=V("ZodCatch",(e,t)=>{Lu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ul(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function bf(e,t){return new $f({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const wf=V("ZodPipe",(e,t)=>{Ku.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>dl(e,r,n,s),e.in=t.in,e.out=t.out});function uo(e,t){return new wf({type:"pipe",in:e,out:t})}const Sf=V("ZodReadonly",(e,t)=>{xu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ll(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function Ef(e){return new Sf({type:"readonly",innerType:e})}const kf=V("ZodLazy",(e,t)=>{Ju.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>fl(e,r,n,s),e.unwrap=()=>e._zod.def.getter()});function ct(e){return new kf({type:"lazy",getter:e})}const Pf=V("ZodCustom",(e,t)=>{Hu.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Xd(e,r)});function Of(e,t={}){return qd(Pf,e,t)}function zf(e){return Zd(e)}const Ze=rr({type:so(["string","number","integer","boolean","object","array","ref"]).optional(),title:Ie().optional(),description:Ie().optional(),default:to().optional(),minimum:qe().optional(),maximum:qe().optional(),exclusiveMin:qe().optional(),exclusiveMax:qe().optional(),multipleOf:qe().optional(),minLength:qe().optional(),maxLength:qe().optional(),minContains:qe().optional(),maxContains:qe().optional(),minProperties:qe().optional(),maxProperties:qe().optional(),isModifiable:tr().optional(),"x-modifiable":Ye(Ie()).optional(),pattern:Ie().optional(),format:Ie().optional(),minItems:qe().optional(),maxItems:qe().optional(),uniqueItems:tr().optional(),enum:Ye(to()).optional(),$id:Ie().optional(),$schema:Ie().optional(),$ref:Ie().optional()}).extend({properties:ct(()=>no(Ie(),Ze)).optional(),items:ct(()=>En([Ze,Ye(Ze)])).optional(),required:Ye(Ie()).optional(),additionalProperties:ct(()=>En([tr(),Ze])).optional(),allOf:ct(()=>Ye(Ze)).optional(),anyOf:ct(()=>Ye(Ze)).optional(),oneOf:ct(()=>Ye(Ze)).optional(),not:ct(()=>Ze).optional(),$defs:ct(()=>no(Ie(),Ze)).optional()}),lo=rr({root:Ze,properties:Ye(rr({id:Ie(),key:Ie().min(1),isRequired:tr(),schema:Ze})),definitions:Ye(rr({id:Ie(),key:Ie().min(1),schema:Ze}))});var It=e=>e.type==="checkbox",mt=e=>e instanceof Date,Fe=e=>e==null;const fo=e=>typeof e=="object";var Pe=e=>!Fe(e)&&!Array.isArray(e)&&fo(e)&&!mt(e),Af=e=>Pe(e)&&e.target?It(e.target)?e.target.checked:e.target.value:e,jf=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Nf=(e,t)=>e.has(jf(t)),Tf=e=>{const t=e.constructor&&e.constructor.prototype;return Pe(t)&&t.hasOwnProperty("isPrototypeOf")},Pn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ge(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Pn&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Pe(e)&&Tf(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=ge(e[s]));return n}var nr=e=>/^\w*$/.test(e),_e=e=>e===void 0,sr=e=>Array.isArray(e)?e.filter(Boolean):[],On=e=>sr(e.replace(/["|']|\]/g,"").split(/\.|\[/)),W=(e,t,r)=>{if(!t||!Pe(e))return r;const n=(nr(t)?[t]:On(t)).reduce((s,o)=>Fe(s)?s:s[o],e);return _e(n)||n===e?_e(e[t])?r:e[t]:n},Xe=e=>typeof e=="boolean",He=e=>typeof e=="function",me=(e,t,r)=>{let n=-1;const s=nr(t)?[t]:On(t),o=s.length,i=o-1;for(;++n<o;){const a=s[n];let c=r;if(n!==i){const u=e[a];c=Pe(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}};const ho={BLUR:"blur",FOCUS_OUT:"focusout"},Je={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},et={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},mo=ee.createContext(null);mo.displayName="HookFormControlContext";const Rf=()=>ee.useContext(mo);var If=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Je.all&&(t._proxyFormState[i]=!n||Je.all),e[i]}});return s};const po=typeof window<"u"?ee.useLayoutEffect:ee.useEffect;var Ue=e=>typeof e=="string",Cf=(e,t,r,n,s)=>Ue(e)?(n&&t.watch.add(e),W(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),W(r,o))):(n&&(t.watchAll=!0),r),zn=e=>Fe(e)||!fo(e);function ut(e,t,r=new WeakSet){if(zn(e)||zn(t))return Object.is(e,t);if(mt(e)&&mt(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const o of n){const i=e[o];if(!s.includes(o))return!1;if(o!=="ref"){const a=t[o];if(mt(i)&&mt(a)||Pe(i)&&Pe(a)||Array.isArray(i)&&Array.isArray(a)?!ut(i,a,r):!Object.is(i,a))return!1}}return!0}const Df=ee.createContext(null);Df.displayName="HookFormContext";var An=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Me=e=>Array.isArray(e)?e:[e],yo=()=>{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}};function _o(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],o=t[n];if(s&&Pe(s)&&o){const i=_o(s,o);Pe(i)&&(r[n]=i)}else e[n]&&(r[n]=o)}return r}var Te=e=>Pe(e)&&!Object.keys(e).length,jn=e=>e.type==="file",or=e=>{if(!Pn)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},go=e=>e.type==="select-multiple",Nn=e=>e.type==="radio",Vf=e=>Nn(e)||It(e),Tn=e=>or(e)&&e.isConnected;function Ff(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=_e(e)?n++:e[t[n++]];return e}function Mf(e){for(const t in e)if(e.hasOwnProperty(t)&&!_e(e[t]))return!1;return!0}function ke(e,t){const r=Array.isArray(t)?t:nr(t)?[t]:On(t),n=r.length===1?e:Ff(e,r),s=r.length-1,o=r[s];return n&&delete n[o],s!==0&&(Pe(n)&&Te(n)||Array.isArray(n)&&Mf(n))&&ke(e,r.slice(0,-1)),e}var qf=e=>{for(const t in e)if(He(e[t]))return!0;return!1};function vo(e){return Array.isArray(e)||Pe(e)&&!qf(e)}function Rn(e,t={}){for(const r in e){const n=e[r];vo(n)?(t[r]=Array.isArray(n)?[]:{},Rn(n,t[r])):_e(n)||(t[r]=!0)}return t}function Et(e,t,r){r||(r=Rn(t));for(const n in e){const s=e[n];if(vo(s))_e(t)||zn(r[n])?r[n]=Rn(s,Array.isArray(s)?[]:{}):Et(s,Fe(t)?{}:t[n],r[n]);else{const o=t[n];r[n]=!ut(s,o)}}return r}const $o={value:!1,isValid:!1},bo={value:!0,isValid:!0};var wo=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!_e(e[0].attributes.value)?_e(e[0].value)||e[0].value===""?bo:{value:e[0].value,isValid:!0}:bo:$o}return $o},So=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>_e(e)?e:t?e===""?NaN:e&&+e:r&&Ue(e)?new Date(e):n?n(e):e;const Eo={isValid:!1,value:null};var ko=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Eo):Eo;function Po(e){const t=e.ref;return jn(t)?t.files:Nn(t)?ko(e.refs).value:go(t)?[...t.selectedOptions].map(({value:r})=>r):It(t)?wo(e.refs).value:So(_e(t.value)?e.ref.value:t.value,e)}var Zf=(e,t,r,n)=>{const s={};for(const o of e){const i=W(t,o);i&&me(s,o,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},ir=e=>e instanceof RegExp,Ct=e=>_e(e)?e:ir(e)?e.source:Pe(e)?ir(e.value)?e.value.source:e.value:e,kt=e=>({isOnSubmit:!e||e===Je.onSubmit,isOnBlur:e===Je.onBlur,isOnChange:e===Je.onChange,isOnAll:e===Je.all,isOnTouch:e===Je.onTouched});const Oo="AsyncFunction";var Uf=e=>!!e&&!!e.validate&&!!(He(e.validate)&&e.validate.constructor.name===Oo||Pe(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Oo)),Lf=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),In=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Pt=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=W(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)return!0;if(i.ref&&t(i.ref,i.name)&&!n)return!0;if(Pt(a,t))break}else if(Pe(a)&&Pt(a,t))break}}};function zo(e,t,r){const n=W(e,r);if(n||nr(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),i=W(t,o),a=W(e,o);if(i&&!Array.isArray(i)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};if(a&&a.root&&a.root.type)return{name:`${o}.root`,error:a.root};s.pop()}return{name:r}}var Kf=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return Te(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!n||Je.all))},xf=(e,t,r)=>!e||!t||e===t||Me(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),Jf=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,Hf=(e,t)=>!sr(W(e,t)).length&&ke(e,t),Ao=(e,t,r)=>{const n=Me(W(e,r));return me(n,"root",t[r]),me(e,r,n),e};function jo(e,t,r="validate"){if(Ue(e)||Array.isArray(e)&&e.every(Ue)||Xe(e)&&!e)return{type:r,message:Ue(e)?e:"",ref:t}}var Ot=e=>Pe(e)&&!ir(e)?e:{value:e,message:""},Cn=async(e,t,r,n,s,o)=>{const{ref:i,refs:a,required:c,maxLength:u,minLength:f,min:g,max:m,pattern:h,validate:w,name:S,valueAsNumber:p,mount:v}=e._f,l=W(r,S);if(!v||t.has(S))return{};const y=a?a[0]:i,_=F=>{s&&y.reportValidity&&(y.setCustomValidity(Xe(F)?"":F||""),y.reportValidity())},d={},$=Nn(i),E=It(i),T=$||E,Z=(p||jn(i))&&_e(i.value)&&_e(l)||or(i)&&i.value===""||l===""||Array.isArray(l)&&!l.length,K=An.bind(null,S,n,d),M=(F,U,x,re=et.maxLength,ye=et.minLength)=>{const he=F?U:x;d[S]={type:F?re:ye,message:he,ref:i,...K(F?re:ye,he)}};if(o?!Array.isArray(l)||!l.length:c&&(!T&&(Z||Fe(l))||Xe(l)&&!l||E&&!wo(a).isValid||$&&!ko(a).isValid)){const{value:F,message:U}=Ue(c)?{value:!!c,message:c}:Ot(c);if(F&&(d[S]={type:et.required,message:U,ref:y,...K(et.required,U)},!n))return _(U),d}if(!Z&&(!Fe(g)||!Fe(m))){let F,U;const x=Ot(m),re=Ot(g);if(!Fe(l)&&!isNaN(l)){const ye=i.valueAsNumber||l&&+l;Fe(x.value)||(F=ye>x.value),Fe(re.value)||(U=ye<re.value)}else{const ye=i.valueAsDate||new Date(l),he=D=>new Date(new Date().toDateString()+" "+D),ue=i.type=="time",Oe=i.type=="week";Ue(x.value)&&l&&(F=ue?he(l)>he(x.value):Oe?l>x.value:ye>new Date(x.value)),Ue(re.value)&&l&&(U=ue?he(l)<he(re.value):Oe?l<re.value:ye<new Date(re.value))}if((F||U)&&(M(!!F,x.message,re.message,et.max,et.min),!n))return _(d[S].message),d}if((u||f)&&!Z&&(Ue(l)||o&&Array.isArray(l))){const F=Ot(u),U=Ot(f),x=!Fe(F.value)&&l.length>+F.value,re=!Fe(U.value)&&l.length<+U.value;if((x||re)&&(M(x,F.message,U.message),!n))return _(d[S].message),d}if(h&&!Z&&Ue(l)){const{value:F,message:U}=Ot(h);if(ir(F)&&!l.match(F)&&(d[S]={type:et.pattern,message:U,ref:i,...K(et.pattern,U)},!n))return _(U),d}if(w){if(He(w)){const F=await w(l,r),U=jo(F,y);if(U&&(d[S]={...U,...K(et.validate,U.message)},!n))return _(U.message),d}else if(Pe(w)){let F={};for(const U in w){if(!Te(F)&&!n)break;const x=jo(await w[U](l,r),y,U);x&&(F={...x,...K(U,x.message)},_(x.message),n&&(d[S]=F))}if(!Te(F)&&(d[S]={ref:y,...F},!n))return d}}return _(!0),d};const Gf={mode:Je.onSubmit,reValidateMode:Je.onChange,shouldFocusError:!0};function Bf(e={}){let t={...Gf,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:He(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=Pe(t.defaultValues)||Pe(t.values)?ge(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:ge(s),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},g={...f};let m={...g};const h={array:yo(),state:yo()},w=t.criteriaMode===Je.all,S=k=>A=>{clearTimeout(u),u=setTimeout(k,A)},p=async k=>{if(!i.keepIsValid&&!t.disabled&&(g.isValid||m.isValid||k)){let A;t.resolver?(A=Te((await T()).errors),v()):A=await K(n,!0),A!==r.isValid&&h.state.next({isValid:A})}},v=(k,A)=>{!t.disabled&&(g.isValidating||g.validatingFields||m.isValidating||m.validatingFields)&&((k||Array.from(a.mount)).forEach(R=>{R&&(A?me(r.validatingFields,R,A):ke(r.validatingFields,R))}),h.state.next({validatingFields:r.validatingFields,isValidating:!Te(r.validatingFields)}))},l=(k,A=[],R,B,J=!0,L=!0)=>{if(B&&R&&!t.disabled){if(i.action=!0,L&&Array.isArray(W(n,k))){const Q=R(W(n,k),B.argA,B.argB);J&&me(n,k,Q)}if(L&&Array.isArray(W(r.errors,k))){const Q=R(W(r.errors,k),B.argA,B.argB);J&&me(r.errors,k,Q),Hf(r.errors,k)}if((g.touchedFields||m.touchedFields)&&L&&Array.isArray(W(r.touchedFields,k))){const Q=R(W(r.touchedFields,k),B.argA,B.argB);J&&me(r.touchedFields,k,Q)}(g.dirtyFields||m.dirtyFields)&&(r.dirtyFields=Et(s,o)),h.state.next({name:k,isDirty:F(k,A),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else me(o,k,A)},y=(k,A)=>{me(r.errors,k,A),h.state.next({errors:r.errors})},_=k=>{r.errors=k,h.state.next({errors:r.errors,isValid:!1})},d=(k,A,R,B)=>{const J=W(n,k);if(J){const L=W(o,k,_e(R)?W(s,k):R);_e(L)||B&&B.defaultChecked||A?me(o,k,A?L:Po(J._f)):re(k,L),i.mount&&!i.action&&p()}},$=(k,A,R,B,J)=>{let L=!1,Q=!1;const le={name:k};if(!t.disabled){if(!R||B){(g.isDirty||m.isDirty)&&(Q=r.isDirty,r.isDirty=le.isDirty=F(),L=Q!==le.isDirty);const fe=ut(W(s,k),A);Q=!!W(r.dirtyFields,k),fe?ke(r.dirtyFields,k):me(r.dirtyFields,k,!0),le.dirtyFields=r.dirtyFields,L=L||(g.dirtyFields||m.dirtyFields)&&Q!==!fe}if(R){const fe=W(r.touchedFields,k);fe||(me(r.touchedFields,k,R),le.touchedFields=r.touchedFields,L=L||(g.touchedFields||m.touchedFields)&&fe!==R)}L&&J&&h.state.next(le)}return L?le:{}},E=(k,A,R,B)=>{const J=W(r.errors,k),L=(g.isValid||m.isValid)&&Xe(A)&&r.isValid!==A;if(t.delayError&&R?(c=S(()=>y(k,R)),c(t.delayError)):(clearTimeout(u),c=null,R?me(r.errors,k,R):ke(r.errors,k)),(R?!ut(J,R):J)||!Te(B)||L){const Q={...B,...L&&Xe(A)?{isValid:A}:{},errors:r.errors,name:k};r={...r,...Q},h.state.next(Q)}},T=async k=>(v(k,!0),await t.resolver(o,t.context,Zf(k||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),Z=async k=>{const{errors:A}=await T(k);if(v(k),k)for(const R of k){const B=W(A,R);B?me(r.errors,R,B):ke(r.errors,R)}else r.errors=A;return A},K=async(k,A,R={valid:!0})=>{for(const B in k){const J=k[B];if(J){const{_f:L,...Q}=J;if(L){const le=a.array.has(L.name),fe=J._f&&Uf(J._f);fe&&g.validatingFields&&v([L.name],!0);const Ne=await Cn(J,a.disabled,o,w,t.shouldUseNativeValidation&&!A,le);if(fe&&g.validatingFields&&v([L.name]),Ne[L.name]&&(R.valid=!1,A||e.shouldUseNativeValidation))break;!A&&(W(Ne,L.name)?le?Ao(r.errors,Ne,L.name):me(r.errors,L.name,Ne[L.name]):ke(r.errors,L.name))}!Te(Q)&&await K(Q,A,R)}}return R.valid},M=()=>{for(const k of a.unMount){const A=W(n,k);A&&(A._f.refs?A._f.refs.every(R=>!Tn(R)):!Tn(A._f.ref))&&Y(k)}a.unMount=new Set},F=(k,A)=>!t.disabled&&(k&&A&&me(o,k,A),!ut(O(),s)),U=(k,A,R)=>Cf(k,a,{...i.mount?o:_e(A)?s:Ue(k)?{[k]:A}:A},R,A),x=k=>sr(W(i.mount?o:s,k,t.shouldUnregister?W(s,k,[]):[])),re=(k,A,R={})=>{const B=W(n,k);let J=A;if(B){const L=B._f;L&&(!L.disabled&&me(o,k,So(A,L)),J=or(L.ref)&&Fe(A)?"":A,go(L.ref)?[...L.ref.options].forEach(Q=>Q.selected=J.includes(Q.value)):L.refs?It(L.ref)?L.refs.forEach(Q=>{(!Q.defaultChecked||!Q.disabled)&&(Array.isArray(J)?Q.checked=!!J.find(le=>le===Q.value):Q.checked=J===Q.value||!!J)}):L.refs.forEach(Q=>Q.checked=Q.value===J):jn(L.ref)?L.ref.value="":(L.ref.value=J,L.ref.type||h.state.next({name:k,values:ge(o)})))}(R.shouldDirty||R.shouldTouch)&&$(k,J,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&D(k)},ye=(k,A,R)=>{for(const B in A){if(!A.hasOwnProperty(B))return;const J=A[B],L=k+"."+B,Q=W(n,L);(a.array.has(k)||Pe(J)||Q&&!Q._f)&&!mt(J)?ye(L,J,R):re(L,J,R)}},he=(k,A,R={})=>{const B=W(n,k),J=a.array.has(k),L=ge(A);me(o,k,L),J?(h.array.next({name:k,values:ge(o)}),(g.isDirty||g.dirtyFields||m.isDirty||m.dirtyFields)&&R.shouldDirty&&h.state.next({name:k,dirtyFields:Et(s,o),isDirty:F(k,L)})):B&&!B._f&&!Fe(L)?ye(k,L,R):re(k,L,R),In(k,a)?h.state.next({...r,name:k,values:ge(o)}):h.state.next({name:i.mount?k:void 0,values:ge(o)})},ue=async k=>{i.mount=!0;const A=k.target;let R=A.name,B=!0;const J=W(n,R),L=fe=>{B=Number.isNaN(fe)||mt(fe)&&isNaN(fe.getTime())||ut(fe,W(o,R,fe))},Q=kt(t.mode),le=kt(t.reValidateMode);if(J){let fe,Ne;const gt=A.type?Po(J._f):Af(k),ft=k.type===ho.BLUR||k.type===ho.FOCUS_OUT,ym=!Lf(J._f)&&!t.resolver&&!W(r.errors,R)&&!J._f.deps||Jf(ft,W(r.touchedFields,R),r.isSubmitted,le,Q),as=In(R,a,ft);me(o,R,gt),ft?(!A||!A.readOnly)&&(J._f.onBlur&&J._f.onBlur(k),c&&c(0)):J._f.onChange&&J._f.onChange(k);const cs=$(R,gt,ft),_m=!Te(cs)||as;if(!ft&&h.state.next({name:R,type:k.type,values:ge(o)}),ym)return(g.isValid||m.isValid)&&(t.mode==="onBlur"?ft&&p():ft||p()),_m&&h.state.next({name:R,...as?{}:cs});if(!ft&&as&&h.state.next({...r}),t.resolver){const{errors:Ta}=await T([R]);if(v([R]),L(gt),B){const gm=zo(r.errors,n,R),Ra=zo(Ta,n,gm.name||R);fe=Ra.error,R=Ra.name,Ne=Te(Ta)}}else v([R],!0),fe=(await Cn(J,a.disabled,o,w,t.shouldUseNativeValidation))[R],v([R]),L(gt),B&&(fe?Ne=!1:(g.isValid||m.isValid)&&(Ne=await K(n,!0)));B&&(J._f.deps&&(!Array.isArray(J._f.deps)||J._f.deps.length>0)&&D(J._f.deps),E(R,Ne,fe,cs))}},Oe=(k,A)=>{if(W(r.errors,A)&&k.focus)return k.focus(),1},D=async(k,A={})=>{let R,B;const J=Me(k);if(t.resolver){const L=await Z(_e(k)?k:J);R=Te(L),B=k?!J.some(Q=>W(L,Q)):R}else k?(B=(await Promise.all(J.map(async L=>{const Q=W(n,L);return await K(Q&&Q._f?{[L]:Q}:Q)}))).every(Boolean),!(!B&&!r.isValid)&&p()):B=R=await K(n);return h.state.next({...!Ue(k)||(g.isValid||m.isValid)&&R!==r.isValid?{}:{name:k},...t.resolver||!k?{isValid:R}:{},errors:r.errors}),A.shouldFocus&&!B&&Pt(n,Oe,k?J:a.mount),B},O=(k,A)=>{let R={...i.mount?o:s};return A&&(R=_o(A.dirtyFields?r.dirtyFields:r.touchedFields,R)),_e(k)?R:Ue(k)?W(R,k):k.map(B=>W(R,B))},C=(k,A)=>({invalid:!!W((A||r).errors,k),isDirty:!!W((A||r).dirtyFields,k),error:W((A||r).errors,k),isValidating:!!W(r.validatingFields,k),isTouched:!!W((A||r).touchedFields,k)}),j=k=>{k&&Me(k).forEach(A=>ke(r.errors,A)),h.state.next({errors:k?r.errors:{}})},b=(k,A,R)=>{const B=(W(n,k,{_f:{}})._f||{}).ref,J=W(r.errors,k)||{},{ref:L,message:Q,type:le,...fe}=J;me(r.errors,k,{...fe,...A,ref:B}),h.state.next({name:k,errors:r.errors,isValid:!1}),R&&R.shouldFocus&&B&&B.focus&&B.focus()},P=(k,A)=>He(k)?h.state.subscribe({next:R=>"values"in R&&k(U(void 0,A),R)}):U(k,A,!0),I=k=>h.state.subscribe({next:A=>{xf(k.name,A.name,k.exact)&&Kf(A,k.formState||g,Ke,k.reRenderRoot)&&k.callback({values:{...o},...r,...A,defaultValues:s})}}).unsubscribe,G=k=>(i.mount=!0,m={...m,...k.formState},I({...k,formState:{...f,...k.formState}})),Y=(k,A={})=>{for(const R of k?Me(k):a.mount)a.mount.delete(R),a.array.delete(R),A.keepValue||(ke(n,R),ke(o,R)),!A.keepError&&ke(r.errors,R),!A.keepDirty&&ke(r.dirtyFields,R),!A.keepTouched&&ke(r.touchedFields,R),!A.keepIsValidating&&ke(r.validatingFields,R),!t.shouldUnregister&&!A.keepDefaultValue&&ke(s,R);h.state.next({values:ge(o)}),h.state.next({...r,...A.keepDirty?{isDirty:F()}:{}}),!A.keepIsValid&&p()},ie=({disabled:k,name:A})=>{if(Xe(k)&&i.mount||k||a.disabled.has(A)){const J=a.disabled.has(A)!==!!k;k?a.disabled.add(A):a.disabled.delete(A),J&&i.mount&&!i.action&&p()}},ae=(k,A={})=>{let R=W(n,k);const B=Xe(A.disabled)||Xe(t.disabled);return me(n,k,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:k}},name:k,mount:!0,...A}}),a.mount.add(k),R?ie({disabled:Xe(A.disabled)?A.disabled:t.disabled,name:k}):d(k,!0,A.value),{...B?{disabled:A.disabled||t.disabled}:{},...t.progressive?{required:!!A.required,min:Ct(A.min),max:Ct(A.max),minLength:Ct(A.minLength),maxLength:Ct(A.maxLength),pattern:Ct(A.pattern)}:{},name:k,onChange:ue,onBlur:ue,ref:J=>{if(J){ae(k,A),R=W(n,k);const L=_e(J.value)&&J.querySelectorAll&&J.querySelectorAll("input,select,textarea")[0]||J,Q=Vf(L),le=R._f.refs||[];if(Q?le.find(fe=>fe===L):L===R._f.ref)return;me(n,k,{_f:{...R._f,...Q?{refs:[...le.filter(Tn),L,...Array.isArray(W(s,k))?[{}]:[]],ref:{type:L.type,name:k}}:{ref:L}}}),d(k,!1,void 0,L)}else R=W(n,k,{}),R._f&&(R._f.mount=!1),(t.shouldUnregister||A.shouldUnregister)&&!(Nf(a.array,k)&&i.action)&&a.unMount.add(k)}}},z=()=>t.shouldFocusError&&Pt(n,Oe,a.mount),N=k=>{Xe(k)&&(h.state.next({disabled:k}),Pt(n,(A,R)=>{const B=W(n,R);B&&(A.disabled=B._f.disabled||k,Array.isArray(B._f.refs)&&B._f.refs.forEach(J=>{J.disabled=B._f.disabled||k}))},0,!1))},q=(k,A)=>async R=>{let B;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let J=ge(o);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:L,values:Q}=await T();v(),r.errors=L,J=ge(Q)}else await K(n);if(a.disabled.size)for(const L of a.disabled)ke(J,L);if(ke(r.errors,"root"),Te(r.errors)){h.state.next({errors:{}});try{await k(J,R)}catch(L){B=L}}else A&&await A({...r.errors},R),z(),setTimeout(z);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Te(r.errors)&&!B,submitCount:r.submitCount+1,errors:r.errors}),B)throw B},H=(k,A={})=>{W(n,k)&&(_e(A.defaultValue)?he(k,ge(W(s,k))):(he(k,A.defaultValue),me(s,k,ge(A.defaultValue))),A.keepTouched||ke(r.touchedFields,k),A.keepDirty||(ke(r.dirtyFields,k),r.isDirty=A.defaultValue?F(k,ge(W(s,k))):F()),A.keepError||(ke(r.errors,k),g.isValid&&p()),h.state.next({...r}))},X=(k,A={})=>{const R=k?ge(k):s,B=ge(R),J=Te(k),L=J?s:B;if(A.keepDefaultValues||(s=R),!A.keepValues){if(A.keepDirtyValues){const Q=new Set([...a.mount,...Object.keys(Et(s,o))]);for(const le of Array.from(Q)){const fe=W(r.dirtyFields,le),Ne=W(o,le),gt=W(L,le);fe&&!_e(Ne)?me(L,le,Ne):!fe&&!_e(gt)&&he(le,gt)}}else{if(Pn&&_e(k))for(const Q of a.mount){const le=W(n,Q);if(le&&le._f){const fe=Array.isArray(le._f.refs)?le._f.refs[0]:le._f.ref;if(or(fe)){const Ne=fe.closest("form");if(Ne){Ne.reset();break}}}}if(A.keepFieldsRef)for(const Q of a.mount)he(Q,W(L,Q));else n={}}o=t.shouldUnregister?A.keepDefaultValues?ge(s):{}:ge(L),h.array.next({values:{...L}}),h.state.next({values:{...L}})}a={mount:A.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!g.isValid||!!A.keepIsValid||!!A.keepDirtyValues||!t.shouldUnregister&&!Te(L),i.watch=!!t.shouldUnregister,i.keepIsValid=!!A.keepIsValid,i.action=!1,A.keepErrors||(r.errors={}),h.state.next({submitCount:A.keepSubmitCount?r.submitCount:0,isDirty:J?!1:A.keepDirty?r.isDirty:!!(A.keepDefaultValues&&!ut(k,s)),isSubmitted:A.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:J?{}:A.keepDirtyValues?A.keepDefaultValues&&o?Et(s,o):r.dirtyFields:A.keepDefaultValues&&k?Et(s,k):A.keepDirty?r.dirtyFields:{},touchedFields:A.keepTouched?r.touchedFields:{},errors:A.keepErrors?r.errors:{},isSubmitSuccessful:A.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},se=(k,A)=>X(He(k)?k(o):k,{...t.resetOptions,...A}),ze=(k,A={})=>{const R=W(n,k),B=R&&R._f;if(B){const J=B.refs?B.refs[0]:B.ref;J.focus&&setTimeout(()=>{J.focus(),A.shouldSelect&&He(J.select)&&J.select()})}},Ke=k=>{r={...r,...k}},je={control:{register:ae,unregister:Y,getFieldState:C,handleSubmit:q,setError:b,_subscribe:I,_runSchema:T,_updateIsValidating:v,_focusError:z,_getWatch:U,_getDirty:F,_setValid:p,_setFieldArray:l,_setDisabledField:ie,_setErrors:_,_getFieldArray:x,_reset:X,_resetDefaultValues:()=>He(t.defaultValues)&&t.defaultValues().then(k=>{se(k,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:M,_disableForm:N,_subjects:h,_proxyFormState:g,get _fields(){return n},get _formValues(){return o},get _state(){return i},set _state(k){i=k},get _defaultValues(){return s},get _names(){return a},set _names(k){a=k},get _formState(){return r},get _options(){return t},set _options(k){t={...t,...k}}},subscribe:G,trigger:D,register:ae,handleSubmit:q,watch:P,setValue:he,getValues:O,reset:se,resetField:H,clearErrors:j,unregister:Y,setError:b,setFocus:ze,getFieldState:C};return{...je,formControl:je}}var dt=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=(Math.random()*16+e)%16|0;return(t=="x"?r:r&3|8).toString(16)})},Dn=(e,t,r={})=>r.shouldFocus||_e(r.shouldFocus)?r.focusName||`${e}.${_e(r.focusIndex)?t:r.focusIndex}.`:"",Vn=(e,t)=>[...e,...Me(t)],Fn=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Mn(e,t,r){return[...e.slice(0,t),...Me(r),...e.slice(t)]}var qn=(e,t,r)=>Array.isArray(e)?(_e(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],Zn=(e,t)=>[...Me(t),...Me(e)];function Wf(e,t){let r=0;const n=[...e];for(const s of t)n.splice(s-r,1),r++;return sr(n).length?n:[]}var Un=(e,t)=>_e(t)?[]:Wf(e,Me(t).sort((r,n)=>r-n)),Ln=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]},No=(e,t,r)=>(e[t]=r,e);function To(e){const t=Rf(),{control:r=t,name:n,keyName:s="id",shouldUnregister:o,rules:i}=e,[a,c]=ee.useState(r._getFieldArray(n)),u=ee.useRef(r._getFieldArray(n).map(dt)),f=ee.useRef(!1);r._names.array.add(n),ee.useMemo(()=>i&&a.length>=0&&r.register(n,i),[r,n,a.length,i]),po(()=>r._subjects.array.subscribe({next:({values:_,name:d})=>{if(d===n||!d){const $=W(_,n);Array.isArray($)&&(c($),u.current=$.map(dt))}}}).unsubscribe,[r,n]);const g=ee.useCallback(_=>{f.current=!0,r._setFieldArray(n,_)},[r,n]),m=(_,d)=>{const $=Me(ge(_)),E=Vn(r._getFieldArray(n),$);r._names.focus=Dn(n,E.length-1,d),u.current=Vn(u.current,$.map(dt)),g(E),c(E),r._setFieldArray(n,E,Vn,{argA:Fn(_)})},h=(_,d)=>{const $=Me(ge(_)),E=Zn(r._getFieldArray(n),$);r._names.focus=Dn(n,0,d),u.current=Zn(u.current,$.map(dt)),g(E),c(E),r._setFieldArray(n,E,Zn,{argA:Fn(_)})},w=_=>{const d=Un(r._getFieldArray(n),_);u.current=Un(u.current,_),g(d),c(d),!Array.isArray(W(r._fields,n))&&me(r._fields,n,void 0),r._setFieldArray(n,d,Un,{argA:_})},S=(_,d,$)=>{const E=Me(ge(d)),T=Mn(r._getFieldArray(n),_,E);r._names.focus=Dn(n,_,$),u.current=Mn(u.current,_,E.map(dt)),g(T),c(T),r._setFieldArray(n,T,Mn,{argA:_,argB:Fn(d)})},p=(_,d)=>{const $=r._getFieldArray(n);Ln($,_,d),Ln(u.current,_,d),g($),c($),r._setFieldArray(n,$,Ln,{argA:_,argB:d},!1)},v=(_,d)=>{const $=r._getFieldArray(n);qn($,_,d),qn(u.current,_,d),g($),c($),r._setFieldArray(n,$,qn,{argA:_,argB:d},!1)},l=(_,d)=>{const $=ge(d),E=No(r._getFieldArray(n),_,$);u.current=[...E].map((T,Z)=>!T||Z===_?dt():u.current[Z]),g(E),c([...E]),r._setFieldArray(n,E,No,{argA:_,argB:$},!0,!1)},y=_=>{const d=Me(ge(_));u.current=d.map(dt),g([...d]),c([...d]),r._setFieldArray(n,[...d],$=>$,{},!0,!1)};return ee.useEffect(()=>{if(r._state.action=!1,In(n,r._names)&&r._subjects.state.next({...r._formState}),f.current&&(!kt(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!kt(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([n]).then(_=>{r._updateIsValidating([n]);const d=W(_.errors,n),$=W(r._formState.errors,n);($?!d&&$.type||d&&($.type!==d.type||$.message!==d.message):d&&d.type)&&(d?me(r._formState.errors,n,d):ke(r._formState.errors,n),r._subjects.state.next({errors:r._formState.errors}))});else{const _=W(r._fields,n);_&&_._f&&!(kt(r._options.reValidateMode).isOnSubmit&&kt(r._options.mode).isOnSubmit)&&Cn(_,r._names.disabled,r._formValues,r._options.criteriaMode===Je.all,r._options.shouldUseNativeValidation,!0).then(d=>!Te(d)&&r._subjects.state.next({errors:Ao(r._formState.errors,d,n)}))}r._subjects.state.next({name:n,values:ge(r._formValues)}),r._names.focus&&Pt(r._fields,(_,d)=>{if(r._names.focus&&d.startsWith(r._names.focus)&&_.focus)return _.focus(),1}),r._names.focus="",r._setValid(),f.current=!1},[a,n,r]),ee.useEffect(()=>(!W(r._formValues,n)&&r._setFieldArray(n),()=>{const _=(d,$)=>{const E=W(r._fields,d);E&&E._f&&(E._f.mount=$)};r._options.shouldUnregister||o?r.unregister(n):_(n,!1)}),[n,r,s,o]),{swap:ee.useCallback(p,[g,n,r]),move:ee.useCallback(v,[g,n,r]),prepend:ee.useCallback(h,[g,n,r]),append:ee.useCallback(m,[g,n,r]),remove:ee.useCallback(w,[g,n,r]),insert:ee.useCallback(S,[g,n,r]),update:ee.useCallback(l,[g,n,r]),replace:ee.useCallback(y,[g,n,r]),fields:ee.useMemo(()=>a.map((_,d)=>({..._,[s]:u.current[d]||dt()})),[a,s])}}function Yf(e={}){const t=ee.useRef(void 0),r=ee.useRef(void 0),[n,s]=ee.useState({isDirty:!1,isValidating:!1,isLoading:He(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:He(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!He(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...a}=Bf(e);t.current={...a,formState:n}}const o=t.current.control;return o._options=e,po(()=>{const i=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(a=>({...a,isReady:!0})),o._formState.isReady=!0,i},[o]),ee.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),ee.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),ee.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),ee.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),ee.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==n.isDirty&&o._subjects.state.next({isDirty:i})}},[o,n.isDirty]),ee.useEffect(()=>{var i;e.values&&!ut(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((i=o._options.resetOptions)===null||i===void 0)&&i.keepIsValid||o._setValid(),r.current=e.values,s(a=>({...a}))):o._resetDefaultValues()},[o,e.values]),ee.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=ee.useMemo(()=>If(n,o),[o,n]),t.current}const Ro=(e,t,r)=>{if(e&&"reportValidity"in e){const n=W(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Kn=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Ro(n.ref,r,e):n&&n.refs&&n.refs.forEach(s=>Ro(s,r,e))}},Io=(e,t)=>{t.shouldUseNativeValidation&&Kn(e,t);const r={};for(const n in e){const s=W(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(Xf(t.names||Object.keys(e),n)){const i=Object.assign({},W(r,n));me(i,"root",o),me(r,n,i)}else me(r,n,o)}return r},Xf=(e,t)=>{const r=Co(t);return e.some(n=>Co(n).match(`^${r}\\.\\d+`))};function Co(e){return e.replace(/\]|\[/g,"")}function Do(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function Qf(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(f){return f.errors.forEach(function(g){return e.push(g)})}),t){var c=r[i].types,u=c&&c[n.code];r[i]=An(i,t,r,s,u?[].concat(u,n.message):n.message)}e.shift()}return r}function eh(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if(n.code==="invalid_union"&&n.errors.forEach(function(f){return f.forEach(function(g){return e.push(g)})}),t){var c=r[i].types,u=c&&c[n.code];r[i]=An(i,t,r,s,u?[].concat(u,n.message):n.message)}e.shift()}return r}function th(e,t,r){if(r===void 0&&(r={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,s,o){try{return Promise.resolve(Do(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(i){return o.shouldUseNativeValidation&&Kn({},o),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:Io(Qf(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,s,o){try{return Promise.resolve(Do(function(){return Promise.resolve((r.mode==="sync"?nc:sc)(e,n,t)).then(function(i){return o.shouldUseNativeValidation&&Kn({},o),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof vn})(i))return{values:{},errors:Io(eh(i.issues,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}};throw new Error("Invalid input: not a Zod schema")}function Vo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ar={exports:{}},xn={},tt={},pt={},Jn={},Hn={},Gn={},Fo;function cr(){return Fo||(Fo=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(l){if(super(),!e.IDENTIFIER.test(l))throw new Error("CodeGen: name must be a valid identifier");this.str=l}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(l){super(),this._items=typeof l=="string"?[l]:l}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const l=this._items[0];return l===""||l==='""'}get str(){var l;return(l=this._str)!==null&&l!==void 0?l:this._str=this._items.reduce((y,_)=>`${y}${_}`,"")}get names(){var l;return(l=this._names)!==null&&l!==void 0?l:this._names=this._items.reduce((y,_)=>(_ instanceof r&&(y[_.str]=(y[_.str]||0)+1),y),{})}}e._Code=n,e.nil=new n("");function s(v,...l){const y=[v[0]];let _=0;for(;_<l.length;)a(y,l[_]),y.push(v[++_]);return new n(y)}e._=s;const o=new n("+");function i(v,...l){const y=[h(v[0])];let _=0;for(;_<l.length;)y.push(o),a(y,l[_]),y.push(o,h(v[++_]));return c(y),new n(y)}e.str=i;function a(v,l){l instanceof n?v.push(...l._items):l instanceof r?v.push(l):v.push(g(l))}e.addCodeArg=a;function c(v){let l=1;for(;l<v.length-1;){if(v[l]===o){const y=u(v[l-1],v[l+1]);if(y!==void 0){v.splice(l-1,3,y);continue}v[l++]="+"}l++}}function u(v,l){if(l==='""')return v;if(v==='""')return l;if(typeof v=="string")return l instanceof r||v[v.length-1]!=='"'?void 0:typeof l!="string"?`${v.slice(0,-1)}${l}"`:l[0]==='"'?v.slice(0,-1)+l.slice(1):void 0;if(typeof l=="string"&&l[0]==='"'&&!(v instanceof r))return`"${v}${l.slice(1)}`}function f(v,l){return l.emptyStr()?v:v.emptyStr()?l:i`${v}${l}`}e.strConcat=f;function g(v){return typeof v=="number"||typeof v=="boolean"||v===null?v:h(Array.isArray(v)?v.join(","):v)}function m(v){return new n(h(v))}e.stringify=m;function h(v){return JSON.stringify(v).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=h;function w(v){return typeof v=="string"&&e.IDENTIFIER.test(v)?new n(`.${v}`):s`[${v}]`}e.getProperty=w;function S(v){if(typeof v=="string"&&e.IDENTIFIER.test(v))return new n(`${v}`);throw new Error(`CodeGen: invalid export name: ${v}, use explicit $id name mapping`)}e.getEsmExportName=S;function p(v){return new n(v.toString())}e.regexpCode=p})(Gn)),Gn}var Bn={},Mo;function qo(){return Mo||(Mo=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=cr();class r extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var n;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{constructor({prefixes:u,parent:f}={}){this._names={},this._prefixes=u,this._parent=f}toName(u){return u instanceof t.Name?u:this.name(u)}name(u){return new t.Name(this._newName(u))}_newName(u){const f=this._names[u]||this._nameGroup(u);return`${u}${f.index++}`}_nameGroup(u){var f,g;if(!((g=(f=this._parent)===null||f===void 0?void 0:f._prefixes)===null||g===void 0)&&g.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}e.Scope=s;class o extends t.Name{constructor(u,f){super(f),this.prefix=u}setValue(u,{property:f,itemIndex:g}){this.value=u,this.scopePath=(0,t._)`.${new t.Name(f)}[${g}]`}}e.ValueScopeName=o;const i=(0,t._)`\n`;class a extends s{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?i:t.nil}}get(){return this._scope}name(u){return new o(u,this._newName(u))}value(u,f){var g;if(f.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const m=this.toName(u),{prefix:h}=m,w=(g=f.key)!==null&&g!==void 0?g:f.ref;let S=this._values[h];if(S){const l=S.get(w);if(l)return l}else S=this._values[h]=new Map;S.set(w,m);const p=this._scope[h]||(this._scope[h]=[]),v=p.length;return p[v]=f.ref,m.setValue(f,{property:h,itemIndex:v}),m}getValue(u,f){const g=this._values[u];if(g)return g.get(f)}scopeRefs(u,f=this._values){return this._reduceValues(f,g=>{if(g.scopePath===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return(0,t._)`${u}${g.scopePath}`})}scopeCode(u=this._values,f,g){return this._reduceValues(u,m=>{if(m.value===void 0)throw new Error(`CodeGen: name "${m}" has no value`);return m.value.code},f,g)}_reduceValues(u,f,g={},m){let h=t.nil;for(const w in u){const S=u[w];if(!S)continue;const p=g[w]=g[w]||new Map;S.forEach(v=>{if(p.has(v))return;p.set(v,n.Started);let l=f(v);if(l){const y=this.opts.es5?e.varKinds.var:e.varKinds.const;h=(0,t._)`${h}${y} ${v} = ${l};${this.opts._n}`}else if(l=m?.(v))h=(0,t._)`${h}${l}${this.opts._n}`;else throw new r(v);p.set(v,n.Completed)})}return h}}e.ValueScope=a})(Bn)),Bn}var Zo;function ne(){return Zo||(Zo=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=cr(),r=qo();var n=cr();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var s=qo();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(b,P){return this}}class i extends o{constructor(b,P,I){super(),this.varKind=b,this.name=P,this.rhs=I}render({es5:b,_n:P}){const I=b?r.varKinds.var:this.varKind,G=this.rhs===void 0?"":` = ${this.rhs}`;return`${I} ${this.name}${G};`+P}optimizeNames(b,P){if(b[this.name.str])return this.rhs&&(this.rhs=x(this.rhs,b,P)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class a extends o{constructor(b,P,I){super(),this.lhs=b,this.rhs=P,this.sideEffects=I}render({_n:b}){return`${this.lhs} = ${this.rhs};`+b}optimizeNames(b,P){if(!(this.lhs instanceof t.Name&&!b[this.lhs.str]&&!this.sideEffects))return this.rhs=x(this.rhs,b,P),this}get names(){const b=this.lhs instanceof t.Name?{}:{...this.lhs.names};return U(b,this.rhs)}}class c extends a{constructor(b,P,I,G){super(b,I,G),this.op=P}render({_n:b}){return`${this.lhs} ${this.op}= ${this.rhs};`+b}}class u extends o{constructor(b){super(),this.label=b,this.names={}}render({_n:b}){return`${this.label}:`+b}}class f extends o{constructor(b){super(),this.label=b,this.names={}}render({_n:b}){return`break${this.label?` ${this.label}`:""};`+b}}class g extends o{constructor(b){super(),this.error=b}render({_n:b}){return`throw ${this.error};`+b}get names(){return this.error.names}}class m extends o{constructor(b){super(),this.code=b}render({_n:b}){return`${this.code};`+b}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(b,P){return this.code=x(this.code,b,P),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class h extends o{constructor(b=[]){super(),this.nodes=b}render(b){return this.nodes.reduce((P,I)=>P+I.render(b),"")}optimizeNodes(){const{nodes:b}=this;let P=b.length;for(;P--;){const I=b[P].optimizeNodes();Array.isArray(I)?b.splice(P,1,...I):I?b[P]=I:b.splice(P,1)}return b.length>0?this:void 0}optimizeNames(b,P){const{nodes:I}=this;let G=I.length;for(;G--;){const Y=I[G];Y.optimizeNames(b,P)||(re(b,Y.names),I.splice(G,1))}return I.length>0?this:void 0}get names(){return this.nodes.reduce((b,P)=>F(b,P.names),{})}}class w extends h{render(b){return"{"+b._n+super.render(b)+"}"+b._n}}class S extends h{}class p extends w{}p.kind="else";class v extends w{constructor(b,P){super(P),this.condition=b}render(b){let P=`if(${this.condition})`+super.render(b);return this.else&&(P+="else "+this.else.render(b)),P}optimizeNodes(){super.optimizeNodes();const b=this.condition;if(b===!0)return this.nodes;let P=this.else;if(P){const I=P.optimizeNodes();P=this.else=Array.isArray(I)?new p(I):I}if(P)return b===!1?P instanceof v?P:P.nodes:this.nodes.length?this:new v(ye(b),P instanceof v?[P]:P.nodes);if(!(b===!1||!this.nodes.length))return this}optimizeNames(b,P){var I;if(this.else=(I=this.else)===null||I===void 0?void 0:I.optimizeNames(b,P),!!(super.optimizeNames(b,P)||this.else))return this.condition=x(this.condition,b,P),this}get names(){const b=super.names;return U(b,this.condition),this.else&&F(b,this.else.names),b}}v.kind="if";class l extends w{}l.kind="for";class y extends l{constructor(b){super(),this.iteration=b}render(b){return`for(${this.iteration})`+super.render(b)}optimizeNames(b,P){if(super.optimizeNames(b,P))return this.iteration=x(this.iteration,b,P),this}get names(){return F(super.names,this.iteration.names)}}class _ extends l{constructor(b,P,I,G){super(),this.varKind=b,this.name=P,this.from=I,this.to=G}render(b){const P=b.es5?r.varKinds.var:this.varKind,{name:I,from:G,to:Y}=this;return`for(${P} ${I}=${G}; ${I}<${Y}; ${I}++)`+super.render(b)}get names(){const b=U(super.names,this.from);return U(b,this.to)}}class d extends l{constructor(b,P,I,G){super(),this.loop=b,this.varKind=P,this.name=I,this.iterable=G}render(b){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(b)}optimizeNames(b,P){if(super.optimizeNames(b,P))return this.iterable=x(this.iterable,b,P),this}get names(){return F(super.names,this.iterable.names)}}class $ extends w{constructor(b,P,I){super(),this.name=b,this.args=P,this.async=I}render(b){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(b)}}$.kind="func";class E extends h{render(b){return"return "+super.render(b)}}E.kind="return";class T extends w{render(b){let P="try"+super.render(b);return this.catch&&(P+=this.catch.render(b)),this.finally&&(P+=this.finally.render(b)),P}optimizeNodes(){var b,P;return super.optimizeNodes(),(b=this.catch)===null||b===void 0||b.optimizeNodes(),(P=this.finally)===null||P===void 0||P.optimizeNodes(),this}optimizeNames(b,P){var I,G;return super.optimizeNames(b,P),(I=this.catch)===null||I===void 0||I.optimizeNames(b,P),(G=this.finally)===null||G===void 0||G.optimizeNames(b,P),this}get names(){const b=super.names;return this.catch&&F(b,this.catch.names),this.finally&&F(b,this.finally.names),b}}class Z extends w{constructor(b){super(),this.error=b}render(b){return`catch(${this.error})`+super.render(b)}}Z.kind="catch";class K extends w{render(b){return"finally"+super.render(b)}}K.kind="finally";class M{constructor(b,P={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...P,_n:P.lines?`
|
|
40
40
|
`:""},this._extScope=b,this._scope=new r.Scope({parent:b}),this._nodes=[new S]}toString(){return this._root.render(this.opts)}name(b){return this._scope.name(b)}scopeName(b){return this._extScope.name(b)}scopeValue(b,P){const I=this._extScope.value(b,P);return(this._values[I.prefix]||(this._values[I.prefix]=new Set)).add(I),I}getScopeValue(b,P){return this._extScope.getValue(b,P)}scopeRefs(b){return this._extScope.scopeRefs(b,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(b,P,I,G){const Y=this._scope.toName(P);return I!==void 0&&G&&(this._constants[Y.str]=I),this._leafNode(new i(b,Y,I)),Y}const(b,P,I){return this._def(r.varKinds.const,b,P,I)}let(b,P,I){return this._def(r.varKinds.let,b,P,I)}var(b,P,I){return this._def(r.varKinds.var,b,P,I)}assign(b,P,I){return this._leafNode(new a(b,P,I))}add(b,P){return this._leafNode(new c(b,e.operators.ADD,P))}code(b){return typeof b=="function"?b():b!==t.nil&&this._leafNode(new m(b)),this}object(...b){const P=["{"];for(const[I,G]of b)P.length>1&&P.push(","),P.push(I),(I!==G||this.opts.es5)&&(P.push(":"),(0,t.addCodeArg)(P,G));return P.push("}"),new t._Code(P)}if(b,P,I){if(this._blockNode(new v(b)),P&&I)this.code(P).else().code(I).endIf();else if(P)this.code(P).endIf();else if(I)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(b){return this._elseNode(new v(b))}else(){return this._elseNode(new p)}endIf(){return this._endBlockNode(v,p)}_for(b,P){return this._blockNode(b),P&&this.code(P).endFor(),this}for(b,P){return this._for(new y(b),P)}forRange(b,P,I,G,Y=this.opts.es5?r.varKinds.var:r.varKinds.let){const ie=this._scope.toName(b);return this._for(new _(Y,ie,P,I),()=>G(ie))}forOf(b,P,I,G=r.varKinds.const){const Y=this._scope.toName(b);if(this.opts.es5){const ie=P instanceof t.Name?P:this.var("_arr",P);return this.forRange("_i",0,(0,t._)`${ie}.length`,ae=>{this.var(Y,(0,t._)`${ie}[${ae}]`),I(Y)})}return this._for(new d("of",G,Y,P),()=>I(Y))}forIn(b,P,I,G=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(b,(0,t._)`Object.keys(${P})`,I);const Y=this._scope.toName(b);return this._for(new d("in",G,Y,P),()=>I(Y))}endFor(){return this._endBlockNode(l)}label(b){return this._leafNode(new u(b))}break(b){return this._leafNode(new f(b))}return(b){const P=new E;if(this._blockNode(P),this.code(b),P.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(b,P,I){if(!P&&!I)throw new Error('CodeGen: "try" without "catch" and "finally"');const G=new T;if(this._blockNode(G),this.code(b),P){const Y=this.name("e");this._currNode=G.catch=new Z(Y),P(Y)}return I&&(this._currNode=G.finally=new K,this.code(I)),this._endBlockNode(Z,K)}throw(b){return this._leafNode(new g(b))}block(b,P){return this._blockStarts.push(this._nodes.length),b&&this.code(b).endBlock(P),this}endBlock(b){const P=this._blockStarts.pop();if(P===void 0)throw new Error("CodeGen: not in self-balancing block");const I=this._nodes.length-P;if(I<0||b!==void 0&&I!==b)throw new Error(`CodeGen: wrong number of nodes: ${I} vs ${b} expected`);return this._nodes.length=P,this}func(b,P=t.nil,I,G){return this._blockNode(new $(b,P,I)),G&&this.code(G).endFunc(),this}endFunc(){return this._endBlockNode($)}optimize(b=1){for(;b-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(b){return this._currNode.nodes.push(b),this}_blockNode(b){this._currNode.nodes.push(b),this._nodes.push(b)}_endBlockNode(b,P){const I=this._currNode;if(I instanceof b||P&&I instanceof P)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${P?`${b.kind}/${P.kind}`:b.kind}"`)}_elseNode(b){const P=this._currNode;if(!(P instanceof v))throw new Error('CodeGen: "else" without "if"');return this._currNode=P.else=b,this}get _root(){return this._nodes[0]}get _currNode(){const b=this._nodes;return b[b.length-1]}set _currNode(b){const P=this._nodes;P[P.length-1]=b}}e.CodeGen=M;function F(j,b){for(const P in b)j[P]=(j[P]||0)+(b[P]||0);return j}function U(j,b){return b instanceof t._CodeOrName?F(j,b.names):j}function x(j,b,P){if(j instanceof t.Name)return I(j);if(!G(j))return j;return new t._Code(j._items.reduce((Y,ie)=>(ie instanceof t.Name&&(ie=I(ie)),ie instanceof t._Code?Y.push(...ie._items):Y.push(ie),Y),[]));function I(Y){const ie=P[Y.str];return ie===void 0||b[Y.str]!==1?Y:(delete b[Y.str],ie)}function G(Y){return Y instanceof t._Code&&Y._items.some(ie=>ie instanceof t.Name&&b[ie.str]===1&&P[ie.str]!==void 0)}}function re(j,b){for(const P in b)j[P]=(j[P]||0)-(b[P]||0)}function ye(j){return typeof j=="boolean"||typeof j=="number"||j===null?!j:(0,t._)`!${C(j)}`}e.not=ye;const he=O(e.operators.AND);function ue(...j){return j.reduce(he)}e.and=ue;const Oe=O(e.operators.OR);function D(...j){return j.reduce(Oe)}e.or=D;function O(j){return(b,P)=>b===t.nil?P:P===t.nil?b:(0,t._)`${C(b)} ${j} ${C(P)}`}function C(j){return j instanceof t.Name?j:(0,t._)`(${j})`}})(Hn)),Hn}var oe={},Uo;function ce(){if(Uo)return oe;Uo=1,Object.defineProperty(oe,"__esModule",{value:!0}),oe.checkStrictMode=oe.getErrorPath=oe.Type=oe.useFunc=oe.setEvaluated=oe.evaluatedPropsToName=oe.mergeEvaluated=oe.eachItem=oe.unescapeJsonPointer=oe.escapeJsonPointer=oe.escapeFragment=oe.unescapeFragment=oe.schemaRefOrVal=oe.schemaHasRulesButRef=oe.schemaHasRules=oe.checkUnknownRules=oe.alwaysValidSchema=oe.toHash=void 0;const e=ne(),t=cr();function r(d){const $={};for(const E of d)$[E]=!0;return $}oe.toHash=r;function n(d,$){return typeof $=="boolean"?$:Object.keys($).length===0?!0:(s(d,$),!o($,d.self.RULES.all))}oe.alwaysValidSchema=n;function s(d,$=d.schema){const{opts:E,self:T}=d;if(!E.strictSchema||typeof $=="boolean")return;const Z=T.RULES.keywords;for(const K in $)Z[K]||_(d,`unknown keyword: "${K}"`)}oe.checkUnknownRules=s;function o(d,$){if(typeof d=="boolean")return!d;for(const E in d)if($[E])return!0;return!1}oe.schemaHasRules=o;function i(d,$){if(typeof d=="boolean")return!d;for(const E in d)if(E!=="$ref"&&$.all[E])return!0;return!1}oe.schemaHasRulesButRef=i;function a({topSchemaRef:d,schemaPath:$},E,T,Z){if(!Z){if(typeof E=="number"||typeof E=="boolean")return E;if(typeof E=="string")return(0,e._)`${E}`}return(0,e._)`${d}${$}${(0,e.getProperty)(T)}`}oe.schemaRefOrVal=a;function c(d){return g(decodeURIComponent(d))}oe.unescapeFragment=c;function u(d){return encodeURIComponent(f(d))}oe.escapeFragment=u;function f(d){return typeof d=="number"?`${d}`:d.replace(/~/g,"~0").replace(/\//g,"~1")}oe.escapeJsonPointer=f;function g(d){return d.replace(/~1/g,"/").replace(/~0/g,"~")}oe.unescapeJsonPointer=g;function m(d,$){if(Array.isArray(d))for(const E of d)$(E);else $(d)}oe.eachItem=m;function h({mergeNames:d,mergeToName:$,mergeValues:E,resultToName:T}){return(Z,K,M,F)=>{const U=M===void 0?K:M instanceof e.Name?(K instanceof e.Name?d(Z,K,M):$(Z,K,M),M):K instanceof e.Name?($(Z,M,K),K):E(K,M);return F===e.Name&&!(U instanceof e.Name)?T(Z,U):U}}oe.mergeEvaluated={props:h({mergeNames:(d,$,E)=>d.if((0,e._)`${E} !== true && ${$} !== undefined`,()=>{d.if((0,e._)`${$} === true`,()=>d.assign(E,!0),()=>d.assign(E,(0,e._)`${E} || {}`).code((0,e._)`Object.assign(${E}, ${$})`))}),mergeToName:(d,$,E)=>d.if((0,e._)`${E} !== true`,()=>{$===!0?d.assign(E,!0):(d.assign(E,(0,e._)`${E} || {}`),S(d,E,$))}),mergeValues:(d,$)=>d===!0?!0:{...d,...$},resultToName:w}),items:h({mergeNames:(d,$,E)=>d.if((0,e._)`${E} !== true && ${$} !== undefined`,()=>d.assign(E,(0,e._)`${$} === true ? true : ${E} > ${$} ? ${E} : ${$}`)),mergeToName:(d,$,E)=>d.if((0,e._)`${E} !== true`,()=>d.assign(E,$===!0?!0:(0,e._)`${E} > ${$} ? ${E} : ${$}`)),mergeValues:(d,$)=>d===!0?!0:Math.max(d,$),resultToName:(d,$)=>d.var("items",$)})};function w(d,$){if($===!0)return d.var("props",!0);const E=d.var("props",(0,e._)`{}`);return $!==void 0&&S(d,E,$),E}oe.evaluatedPropsToName=w;function S(d,$,E){Object.keys(E).forEach(T=>d.assign((0,e._)`${$}${(0,e.getProperty)(T)}`,!0))}oe.setEvaluated=S;const p={};function v(d,$){return d.scopeValue("func",{ref:$,code:p[$.code]||(p[$.code]=new t._Code($.code))})}oe.useFunc=v;var l;(function(d){d[d.Num=0]="Num",d[d.Str=1]="Str"})(l||(oe.Type=l={}));function y(d,$,E){if(d instanceof e.Name){const T=$===l.Num;return E?T?(0,e._)`"[" + ${d} + "]"`:(0,e._)`"['" + ${d} + "']"`:T?(0,e._)`"/" + ${d}`:(0,e._)`"/" + ${d}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return E?(0,e.getProperty)(d).toString():"/"+f(d)}oe.getErrorPath=y;function _(d,$,E=d.opts.strictSchema){if(E){if($=`strict mode: ${$}`,E===!0)throw new Error($);d.self.logger.warn($)}}return oe.checkStrictMode=_,oe}var ur={},Lo;function Ge(){if(Lo)return ur;Lo=1,Object.defineProperty(ur,"__esModule",{value:!0});const e=ne(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return ur.default=t,ur}var Ko;function dr(){return Ko||(Ko=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=ne(),r=ce(),n=Ge();e.keywordError={message:({keyword:p})=>(0,t.str)`must pass "${p}" keyword validation`},e.keyword$DataError={message:({keyword:p,schemaType:v})=>v?(0,t.str)`"${p}" keyword must be ${v} ($data)`:(0,t.str)`"${p}" keyword is invalid ($data)`};function s(p,v=e.keywordError,l,y){const{it:_}=p,{gen:d,compositeRule:$,allErrors:E}=_,T=g(p,v,l);y??($||E)?c(d,T):u(_,(0,t._)`[${T}]`)}e.reportError=s;function o(p,v=e.keywordError,l){const{it:y}=p,{gen:_,compositeRule:d,allErrors:$}=y,E=g(p,v,l);c(_,E),d||$||u(y,n.default.vErrors)}e.reportExtraError=o;function i(p,v){p.assign(n.default.errors,v),p.if((0,t._)`${n.default.vErrors} !== null`,()=>p.if(v,()=>p.assign((0,t._)`${n.default.vErrors}.length`,v),()=>p.assign(n.default.vErrors,null)))}e.resetErrorsCount=i;function a({gen:p,keyword:v,schemaValue:l,data:y,errsCount:_,it:d}){if(_===void 0)throw new Error("ajv implementation error");const $=p.name("err");p.forRange("i",_,n.default.errors,E=>{p.const($,(0,t._)`${n.default.vErrors}[${E}]`),p.if((0,t._)`${$}.instancePath === undefined`,()=>p.assign((0,t._)`${$}.instancePath`,(0,t.strConcat)(n.default.instancePath,d.errorPath))),p.assign((0,t._)`${$}.schemaPath`,(0,t.str)`${d.errSchemaPath}/${v}`),d.opts.verbose&&(p.assign((0,t._)`${$}.schema`,l),p.assign((0,t._)`${$}.data`,y))})}e.extendErrors=a;function c(p,v){const l=p.const("err",v);p.if((0,t._)`${n.default.vErrors} === null`,()=>p.assign(n.default.vErrors,(0,t._)`[${l}]`),(0,t._)`${n.default.vErrors}.push(${l})`),p.code((0,t._)`${n.default.errors}++`)}function u(p,v){const{gen:l,validateName:y,schemaEnv:_}=p;_.$async?l.throw((0,t._)`new ${p.ValidationError}(${v})`):(l.assign((0,t._)`${y}.errors`,v),l.return(!1))}const f={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function g(p,v,l){const{createErrors:y}=p.it;return y===!1?(0,t._)`{}`:m(p,v,l)}function m(p,v,l={}){const{gen:y,it:_}=p,d=[h(_,l),w(p,l)];return S(p,v,d),y.object(...d)}function h({errorPath:p},{instancePath:v}){const l=v?(0,t.str)`${p}${(0,r.getErrorPath)(v,r.Type.Str)}`:p;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,l)]}function w({keyword:p,it:{errSchemaPath:v}},{schemaPath:l,parentSchema:y}){let _=y?v:(0,t.str)`${v}/${p}`;return l&&(_=(0,t.str)`${_}${(0,r.getErrorPath)(l,r.Type.Str)}`),[f.schemaPath,_]}function S(p,{params:v,message:l},y){const{keyword:_,data:d,schemaValue:$,it:E}=p,{opts:T,propertyName:Z,topSchemaRef:K,schemaPath:M}=E;y.push([f.keyword,_],[f.params,typeof v=="function"?v(p):v||(0,t._)`{}`]),T.messages&&y.push([f.message,typeof l=="function"?l(p):l]),T.verbose&&y.push([f.schema,$],[f.parentSchema,(0,t._)`${K}${M}`],[n.default.data,d]),Z&&y.push([f.propertyName,Z])}})(Jn)),Jn}var xo;function rh(){if(xo)return pt;xo=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.boolOrEmptySchema=pt.topBoolOrEmptySchema=void 0;const e=dr(),t=ne(),r=Ge(),n={message:"boolean schema is false"};function s(a){const{gen:c,schema:u,validateName:f}=a;u===!1?i(a,!1):typeof u=="object"&&u.$async===!0?c.return(r.default.data):(c.assign((0,t._)`${f}.errors`,null),c.return(!0))}pt.topBoolOrEmptySchema=s;function o(a,c){const{gen:u,schema:f}=a;f===!1?(u.var(c,!1),i(a)):u.var(c,!0)}pt.boolOrEmptySchema=o;function i(a,c){const{gen:u,data:f}=a,g={gen:u,keyword:"false schema",data:f,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:a};(0,e.reportError)(g,n,void 0,c)}return pt}var Ae={},yt={},Jo;function Ho(){if(Jo)return yt;Jo=1,Object.defineProperty(yt,"__esModule",{value:!0}),yt.getRules=yt.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],t=new Set(e);function r(s){return typeof s=="string"&&t.has(s)}yt.isJSONType=r;function n(){const s={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...s,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},s.number,s.string,s.array,s.object],post:{rules:[]},all:{},keywords:{}}}return yt.getRules=n,yt}var rt={},Go;function Bo(){if(Go)return rt;Go=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.shouldUseRule=rt.shouldUseGroup=rt.schemaHasRulesForType=void 0;function e({schema:n,self:s},o){const i=s.RULES.types[o];return i&&i!==!0&&t(n,i)}rt.schemaHasRulesForType=e;function t(n,s){return s.rules.some(o=>r(n,o))}rt.shouldUseGroup=t;function r(n,s){var o;return n[s.keyword]!==void 0||((o=s.definition.implements)===null||o===void 0?void 0:o.some(i=>n[i]!==void 0))}return rt.shouldUseRule=r,rt}var Wo;function lr(){if(Wo)return Ae;Wo=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.reportTypeError=Ae.checkDataTypes=Ae.checkDataType=Ae.coerceAndCheckDataType=Ae.getJSONTypes=Ae.getSchemaTypes=Ae.DataType=void 0;const e=Ho(),t=Bo(),r=dr(),n=ne(),s=ce();var o;(function(l){l[l.Correct=0]="Correct",l[l.Wrong=1]="Wrong"})(o||(Ae.DataType=o={}));function i(l){const y=a(l.type);if(y.includes("null")){if(l.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!y.length&&l.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');l.nullable===!0&&y.push("null")}return y}Ae.getSchemaTypes=i;function a(l){const y=Array.isArray(l)?l:l?[l]:[];if(y.every(e.isJSONType))return y;throw new Error("type must be JSONType or JSONType[]: "+y.join(","))}Ae.getJSONTypes=a;function c(l,y){const{gen:_,data:d,opts:$}=l,E=f(y,$.coerceTypes),T=y.length>0&&!(E.length===0&&y.length===1&&(0,t.schemaHasRulesForType)(l,y[0]));if(T){const Z=w(y,d,$.strictNumbers,o.Wrong);_.if(Z,()=>{E.length?g(l,y,E):p(l)})}return T}Ae.coerceAndCheckDataType=c;const u=new Set(["string","number","integer","boolean","null"]);function f(l,y){return y?l.filter(_=>u.has(_)||y==="array"&&_==="array"):[]}function g(l,y,_){const{gen:d,data:$,opts:E}=l,T=d.let("dataType",(0,n._)`typeof ${$}`),Z=d.let("coerced",(0,n._)`undefined`);E.coerceTypes==="array"&&d.if((0,n._)`${T} == 'object' && Array.isArray(${$}) && ${$}.length == 1`,()=>d.assign($,(0,n._)`${$}[0]`).assign(T,(0,n._)`typeof ${$}`).if(w(y,$,E.strictNumbers),()=>d.assign(Z,$))),d.if((0,n._)`${Z} !== undefined`);for(const M of _)(u.has(M)||M==="array"&&E.coerceTypes==="array")&&K(M);d.else(),p(l),d.endIf(),d.if((0,n._)`${Z} !== undefined`,()=>{d.assign($,Z),m(l,Z)});function K(M){switch(M){case"string":d.elseIf((0,n._)`${T} == "number" || ${T} == "boolean"`).assign(Z,(0,n._)`"" + ${$}`).elseIf((0,n._)`${$} === null`).assign(Z,(0,n._)`""`);return;case"number":d.elseIf((0,n._)`${T} == "boolean" || ${$} === null
|
|
41
41
|
|| (${T} == "string" && ${$} && ${$} == +${$})`).assign(Z,(0,n._)`+${$}`);return;case"integer":d.elseIf((0,n._)`${T} === "boolean" || ${$} === null
|
|
42
42
|
|| (${T} === "string" && ${$} && ${$} == +${$} && !(${$} % 1))`).assign(Z,(0,n._)`+${$}`);return;case"boolean":d.elseIf((0,n._)`${$} === "false" || ${$} === 0 || ${$} === null`).assign(Z,!1).elseIf((0,n._)`${$} === "true" || ${$} === 1`).assign(Z,!0);return;case"null":d.elseIf((0,n._)`${$} === "" || ${$} === 0 || ${$} === false`),d.assign(Z,null);return;case"array":d.elseIf((0,n._)`${T} === "string" || ${T} === "number"
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from '../src/lib/index'
|
|
2
|
+
export {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ht-rnd/json-schema-editor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Headless JSON Schema Editor - provides hooks and utilities for building JSON Schema editors",
|
|
6
6
|
"keywords": [
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"ajv": "^8.17.1",
|
|
48
48
|
"ajv-formats": "^3.0.1",
|
|
49
49
|
"nanoid": "^5.1.6",
|
|
50
|
+
"radix-ui": "^1.4.3",
|
|
50
51
|
"react-hook-form": "^7.66.1",
|
|
51
52
|
"zod": "^4.1.12"
|
|
52
53
|
},
|
|
@@ -56,15 +57,6 @@
|
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@biomejs/biome": "^2.3.8",
|
|
59
|
-
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
60
|
-
"@radix-ui/react-checkbox": "^1.3.3",
|
|
61
|
-
"@radix-ui/react-dialog": "^1.1.15",
|
|
62
|
-
"@radix-ui/react-label": "^2.1.8",
|
|
63
|
-
"@radix-ui/react-radio-group": "^1.3.8",
|
|
64
|
-
"@radix-ui/react-select": "^2.2.6",
|
|
65
|
-
"@radix-ui/react-separator": "^1.1.8",
|
|
66
|
-
"@radix-ui/react-slot": "^1.2.4",
|
|
67
|
-
"@radix-ui/react-tooltip": "^1.2.8",
|
|
68
60
|
"@testing-library/dom": "^10.4.1",
|
|
69
61
|
"@testing-library/jest-dom": "^6.9.1",
|
|
70
62
|
"@testing-library/react": "^16.3.0",
|