@spear-ai/spectral 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/README.md +6 -5
  2. package/dist/.js +112 -239
  3. package/dist/Accordion-CDXdSAST.js +363 -0
  4. package/dist/Accordion.js +3 -498
  5. package/dist/Alert/AlertBase.js +69 -152
  6. package/dist/Alert.js +58 -106
  7. package/dist/AnimatePresence-D-9jXfgI.js +178 -0
  8. package/dist/App.js +6 -6
  9. package/dist/Avatar.js +83 -65
  10. package/dist/Badge.d.ts +1 -3
  11. package/dist/Badge.js +21 -25
  12. package/dist/Button.js +102 -178
  13. package/dist/ButtonGroup/ButtonGroupButton.js +38 -40
  14. package/dist/ButtonGroup.js +55 -59
  15. package/dist/ButtonIcon.js +58 -134
  16. package/dist/Calendar-s4lyijkn.js +3109 -0
  17. package/dist/Checkbox/CheckboxBase.js +94 -126
  18. package/dist/Checkbox.d.ts +1 -1
  19. package/dist/Checkbox.js +40 -105
  20. package/dist/Combobox/ComboboxBase.js +2 -79
  21. package/dist/Combobox.js +106 -172
  22. package/dist/ComboboxBase-D8Nf4xC-.js +491 -0
  23. package/dist/ControlGroup/ControlGroupSelect.d.ts +1 -1
  24. package/dist/ControlGroup/ControlGroupSelect.js +85 -101
  25. package/dist/ControlGroup.js +45 -48
  26. package/dist/DataCard/Card.js +37 -12
  27. package/dist/DataCard.d.ts +1 -1
  28. package/dist/DataCard.js +36 -16
  29. package/dist/DateTimePicker/Calendar.js +2 -2967
  30. package/dist/DateTimePicker/DateTimeDisplayInput.d.ts +1 -1
  31. package/dist/DateTimePicker/DateTimeDisplayInput.js +379 -274
  32. package/dist/DateTimePicker/DateTimeInput.d.ts +5 -3
  33. package/dist/DateTimePicker/DateTimeInput.js +133 -88
  34. package/dist/DateTimePicker/DateTimeUtils.js +2 -2193
  35. package/dist/DateTimePicker/TimePeriodSelect.d.ts +1 -1
  36. package/dist/DateTimePicker/TimePeriodSelect.js +45 -20
  37. package/dist/DateTimePicker/TimePicker.d.ts +1 -1
  38. package/dist/DateTimePicker/TimePicker.js +76 -60
  39. package/dist/DateTimePicker.d.ts +2 -2
  40. package/dist/DateTimePicker.js +87 -205
  41. package/dist/DateTimeUtils-DVvG6H-p.js +2098 -0
  42. package/dist/Dialog.js +74 -74
  43. package/dist/Drawer.js +67 -37
  44. package/dist/HoverCard-CYDsIiVK.js +201 -0
  45. package/dist/HoverCard.d.ts +1 -1
  46. package/dist/HoverCard.js +2 -218
  47. package/dist/Icons/AnalyzeIcon.js +50 -57
  48. package/dist/Icons/AnnotationsIcon.js +20 -15
  49. package/dist/Icons/ApprovedIcon.js +26 -18
  50. package/dist/Icons/ArrowDownIcon.js +20 -6
  51. package/dist/Icons/ArrowUpIcon.js +20 -6
  52. package/dist/Icons/BoxToolIcon.js +17 -12
  53. package/dist/Icons/CalendarIcon.js +43 -20
  54. package/dist/Icons/CheckCircleIcon.js +26 -10
  55. package/dist/Icons/CheckSquareIcon.js +26 -10
  56. package/dist/Icons/CheckmarkIcon.js +22 -9
  57. package/dist/Icons/ChevronDownIcon.js +22 -9
  58. package/dist/Icons/ChevronUpIcon.js +22 -9
  59. package/dist/Icons/ClockIcon.js +26 -18
  60. package/dist/Icons/CloseCircleIcon.js +26 -10
  61. package/dist/Icons/CloseIcon.js +18 -9
  62. package/dist/Icons/DashboardIcon.js +36 -10
  63. package/dist/Icons/DatabaseIcon.js +36 -19
  64. package/dist/Icons/DeleteIcon.js +36 -19
  65. package/dist/Icons/DurationIcon.js +57 -22
  66. package/dist/Icons/EditIcon.js +26 -27
  67. package/dist/Icons/EmailIcon.js +26 -10
  68. package/dist/Icons/EraserIcon.js +41 -25
  69. package/dist/Icons/ErrorIcon.js +27 -11
  70. package/dist/Icons/EyeClosedIcon.js +29 -13
  71. package/dist/Icons/EyeClosedIcon2.js +27 -11
  72. package/dist/Icons/EyeOpenIcon.js +22 -9
  73. package/dist/Icons/FileDownloadIcon.js +43 -20
  74. package/dist/Icons/GoToFirstIcon.js +26 -9
  75. package/dist/Icons/GoToLastIcon.js +26 -9
  76. package/dist/Icons/HarmonicCursorsIcon.js +23 -9
  77. package/dist/Icons/IconBase.d.ts +3 -3
  78. package/dist/Icons/IconBase.js +49 -23
  79. package/dist/Icons/InfoIcon.js +36 -10
  80. package/dist/Icons/KeyboardIcon.js +26 -27
  81. package/dist/Icons/LabelIcon.js +19 -14
  82. package/dist/Icons/LassoIcon.js +36 -28
  83. package/dist/Icons/LineToolIcon.js +48 -39
  84. package/dist/Icons/LiveViewIcon.js +50 -12
  85. package/dist/Icons/LoaderIcon.js +67 -27
  86. package/dist/Icons/LocationIcon.js +26 -27
  87. package/dist/Icons/LogoutIcon.js +20 -15
  88. package/dist/Icons/MeasureIcon.js +78 -25
  89. package/dist/Icons/MessagesIcon.js +33 -18
  90. package/dist/Icons/MetadataIcon.js +20 -15
  91. package/dist/Icons/MinusIcon.d.ts +1 -1
  92. package/dist/Icons/MinusIcon.js +18 -6
  93. package/dist/Icons/OntologyIcon.js +87 -71
  94. package/dist/Icons/PanelIconClose.js +28 -10
  95. package/dist/Icons/PanelIconOpen.js +28 -10
  96. package/dist/Icons/PlayIcon.js +20 -6
  97. package/dist/Icons/PlusIcon.js +20 -14
  98. package/dist/Icons/PolygonIcon.js +50 -39
  99. package/dist/Icons/ProgressCheckIcon.d.ts +5 -0
  100. package/dist/Icons/ProgressCheckIcon.js +58 -0
  101. package/dist/Icons/ResetIcon.js +17 -12
  102. package/dist/Icons/ReviewedIcon.js +36 -19
  103. package/dist/Icons/ScissorsIcon.js +22 -17
  104. package/dist/Icons/SearchIcon.js +26 -9
  105. package/dist/Icons/SettingsIcon.js +26 -27
  106. package/dist/Icons/SortAscendingIcon.js +50 -12
  107. package/dist/Icons/SortAtoZIcon.js +50 -12
  108. package/dist/Icons/SortDescendingIcon.js +50 -12
  109. package/dist/Icons/SortZtoAIcon.js +50 -12
  110. package/dist/Icons/StackIcon.js +26 -9
  111. package/dist/Icons/StarIcon.js +20 -6
  112. package/dist/Icons/TrashIcon.js +17 -12
  113. package/dist/Icons/UndoIcon.js +20 -15
  114. package/dist/Icons/User2Icon.js +26 -10
  115. package/dist/Icons/UserIcon.js +19 -14
  116. package/dist/Icons/WarningIcon.js +19 -14
  117. package/dist/Icons/ZoomAllIcon.js +71 -15
  118. package/dist/Icons/ZoomXIcon.js +36 -10
  119. package/dist/Icons/ZoomYIcon.js +36 -10
  120. package/dist/Icons/index.d.ts +1 -0
  121. package/dist/Icons.js +68 -136
  122. package/dist/IconsAnimated/PanelLeftCloseIcon.js +66 -36
  123. package/dist/IconsAnimated/PanelLeftOpenIcon.js +66 -36
  124. package/dist/IconsAnimated.js +3 -6
  125. package/dist/Input/InputUtils.js +51 -52
  126. package/dist/Input.js +132 -185
  127. package/dist/InputOTP-XUWW9xcI.js +461 -0
  128. package/dist/InputOTP.js +2 -382
  129. package/dist/Kbd.d.ts +1 -1
  130. package/dist/Kbd.js +182 -86
  131. package/dist/Label.js +12 -14
  132. package/dist/MultiSelect/MultiSelectBase.js +331 -403
  133. package/dist/MultiSelect.d.ts +1 -1
  134. package/dist/MultiSelect.js +23 -23
  135. package/dist/Popover.js +28 -32
  136. package/dist/RadioButton.d.ts +17 -0
  137. package/dist/RadioButton.js +33 -0
  138. package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +3 -1
  139. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +49 -46
  140. package/dist/RadioButtonGroup.d.ts +1 -1
  141. package/dist/RadioButtonGroup.js +11 -8
  142. package/dist/RadioGroup-w_q6RGEK.js +447 -0
  143. package/dist/RadioGroup.js +2 -505
  144. package/dist/Select.js +163 -186
  145. package/dist/Separator.js +16 -19
  146. package/dist/Skeleton.js +10 -6
  147. package/dist/Slider-BzzZT3Zm.js +490 -0
  148. package/dist/Slider.js +2 -562
  149. package/dist/SpectralProvider.js +8 -5
  150. package/dist/Switch/SwitchBase.js +91 -95
  151. package/dist/Switch-CVzRJ-0n.js +126 -0
  152. package/dist/Switch.d.ts +1 -1
  153. package/dist/Switch.js +2 -134
  154. package/dist/Tabs/TabsBase.js +242 -250
  155. package/dist/Tabs/tabsUtils.js +65 -73
  156. package/dist/Tabs.d.ts +1 -1
  157. package/dist/Tabs.js +73 -103
  158. package/dist/Textarea/TextareaUtils.js +35 -46
  159. package/dist/Textarea.js +83 -160
  160. package/dist/Toast-9zqXxKKO.js +711 -0
  161. package/dist/Toast.js +2 -885
  162. package/dist/Toggle/ToggleBase.js +46 -56
  163. package/dist/Toggle.d.ts +1 -1
  164. package/dist/Toggle.js +52 -62
  165. package/dist/ToggleGroup/ToggleGroupBase.js +128 -104
  166. package/dist/ToggleGroup.d.ts +1 -1
  167. package/dist/ToggleGroup.js +52 -63
  168. package/dist/Tooltip-D1K8kY1y.js +389 -0
  169. package/dist/Tooltip.js +2 -365
  170. package/dist/Tray.js +174 -217
  171. package/dist/chunk-h9knIhTc.js +20 -0
  172. package/dist/clsx-jM1GlMvB.js +16 -0
  173. package/dist/dist-3Af8168y.js +913 -0
  174. package/dist/dist-7HRQ5IKN.js +249 -0
  175. package/dist/dist-B2k1iWFp.js +129 -0
  176. package/dist/dist-B4FgboI8.js +122 -0
  177. package/dist/dist-B4g6zpUF.js +33 -0
  178. package/dist/dist-B9tup-4O.js +216 -0
  179. package/dist/dist-BK1K0g9W.js +29 -0
  180. package/dist/dist-Bfjk-jx9.js +28 -0
  181. package/dist/dist-Bft31cJh.js +65 -0
  182. package/dist/dist-BtdmHAzK.js +190 -0
  183. package/dist/dist-C0Hifjgh.js +1287 -0
  184. package/dist/dist-CGzgmYB9.js +68 -0
  185. package/dist/dist-ClmepHp4.js +10 -0
  186. package/dist/dist-D8Wb_MX9.js +6 -0
  187. package/dist/dist-Dtvmk11N.js +12 -0
  188. package/dist/dist-fW81qjVl.js +677 -0
  189. package/dist/dist-s1uWaZYZ.js +11 -0
  190. package/dist/es2015-YHaMV-St.js +701 -0
  191. package/dist/hooks/useAccordionAutoScroll.js +66 -67
  192. package/dist/hooks/useControllableState.js +14 -13
  193. package/dist/hooks/useTheme.js +21 -17
  194. package/dist/index.d.ts +2 -1
  195. package/dist/index.d.ts.map +1 -1
  196. package/dist/main.js +18954 -27224
  197. package/dist/primitives/button.js +39 -41
  198. package/dist/primitives/input-group.js +57 -73
  199. package/dist/primitives/input.js +11 -20
  200. package/dist/primitives/popover.d.ts.map +1 -1
  201. package/dist/primitives/popover.js +34 -25
  202. package/dist/primitives/select.js +70 -138
  203. package/dist/primitives/slot.js +32 -31
  204. package/dist/primitives/textarea.js +10 -16
  205. package/dist/proxy-Dn10Pl_g.js +4920 -0
  206. package/dist/styles/main.css +2 -1
  207. package/dist/styles/spectral.css +1 -1
  208. package/dist/twUtils-VNWgstKL.js +1673 -0
  209. package/dist/use-animation-CBUDycyW.js +57 -0
  210. package/dist/utils/constants.js +4 -4
  211. package/dist/utils/formFieldUtils.js +136 -148
  212. package/dist/utils/sharedUtils.js +26 -7
  213. package/dist/utils/twUtils.js +2 -2919
  214. package/package.json +24 -28
  215. package/dist/ComboboxBase-CxNxYtdT.js +0 -408
  216. package/dist/clsx-OuTLNxxd.js +0 -16
  217. package/dist/index-0ioNhtNM.js +0 -10
  218. package/dist/index-6oYKCvIn.js +0 -677
  219. package/dist/index-BFOf48AQ.js +0 -69
  220. package/dist/index-BZPx6jYI.js +0 -8
  221. package/dist/index-BlHU_t18.js +0 -142
  222. package/dist/index-Bm1RbF6w.js +0 -1037
  223. package/dist/index-Bv2OIg5P.js +0 -225
  224. package/dist/index-CKEI0pDv.js +0 -56
  225. package/dist/index-CM_hWgfC.js +0 -32
  226. package/dist/index-C_YVr64u.js +0 -1538
  227. package/dist/index-Cl8VeY0o.js +0 -149
  228. package/dist/index-CwSyIPrv.js +0 -13
  229. package/dist/index-D29mdTf5.js +0 -34
  230. package/dist/index-DEYs15GP.js +0 -66
  231. package/dist/index-Dc0No4pV.js +0 -233
  232. package/dist/index-T6XEa11q.js +0 -822
  233. package/dist/index-pBCLb6Gr.js +0 -240
  234. package/dist/index-psiVrsnE.js +0 -27
  235. package/dist/index-rKs9bXHr.js +0 -6
  236. package/dist/proxy-CO_-Vget.js +0 -4975
  237. package/dist/use-animation-DhEPRwZ3.js +0 -62
@@ -1,2193 +1,2 @@
1
- function l(e, n, t) {
2
- function r(u, c) {
3
- if (u._zod || Object.defineProperty(u, "_zod", {
4
- value: {
5
- def: c,
6
- constr: s,
7
- traits: /* @__PURE__ */ new Set()
8
- },
9
- enumerable: !1
10
- }), u._zod.traits.has(e))
11
- return;
12
- u._zod.traits.add(e), n(u, c);
13
- const a = s.prototype, f = Object.keys(a);
14
- for (let h = 0; h < f.length; h++) {
15
- const d = f[h];
16
- d in u || (u[d] = a[d].bind(u));
17
- }
18
- }
19
- const o = t?.Parent ?? Object;
20
- class i extends o {
21
- }
22
- Object.defineProperty(i, "name", { value: e });
23
- function s(u) {
24
- var c;
25
- const a = t?.Parent ? new i() : this;
26
- r(a, u), (c = a._zod).deferred ?? (c.deferred = []);
27
- for (const f of a._zod.deferred)
28
- f();
29
- return a;
30
- }
31
- return Object.defineProperty(s, "init", { value: r }), Object.defineProperty(s, Symbol.hasInstance, {
32
- value: (u) => t?.Parent && u instanceof t.Parent ? !0 : u?._zod?.traits?.has(e)
33
- }), Object.defineProperty(s, "name", { value: e }), s;
34
- }
35
- class M extends Error {
36
- constructor() {
37
- super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
38
- }
39
- }
40
- class $e extends Error {
41
- constructor(n) {
42
- super(`Encountered unidirectional transform during encode: ${n}`), this.name = "ZodEncodeError";
43
- }
44
- }
45
- const Ne = {};
46
- function Z(e) {
47
- return Ne;
48
- }
49
- function Ee(e) {
50
- const n = Object.values(e).filter((r) => typeof r == "number");
51
- return Object.entries(e).filter(([r, o]) => n.indexOf(+r) === -1).map(([r, o]) => o);
52
- }
53
- function W(e, n) {
54
- return typeof n == "bigint" ? n.toString() : n;
55
- }
56
- function ee(e) {
57
- return {
58
- get value() {
59
- {
60
- const n = e();
61
- return Object.defineProperty(this, "value", { value: n }), n;
62
- }
63
- }
64
- };
65
- }
66
- function ne(e) {
67
- return e == null;
68
- }
69
- function te(e) {
70
- const n = e.startsWith("^") ? 1 : 0, t = e.endsWith("$") ? e.length - 1 : e.length;
71
- return e.slice(n, t);
72
- }
73
- function rn(e, n) {
74
- const t = (e.toString().split(".")[1] || "").length, r = n.toString();
75
- let o = (r.split(".")[1] || "").length;
76
- if (o === 0 && /\d?e-\d?/.test(r)) {
77
- const c = r.match(/\d?e-(\d?)/);
78
- c?.[1] && (o = Number.parseInt(c[1]));
79
- }
80
- const i = t > o ? t : o, s = Number.parseInt(e.toFixed(i).replace(".", "")), u = Number.parseInt(n.toFixed(i).replace(".", ""));
81
- return s % u / 10 ** i;
82
- }
83
- const ue = /* @__PURE__ */ Symbol("evaluating");
84
- function m(e, n, t) {
85
- let r;
86
- Object.defineProperty(e, n, {
87
- get() {
88
- if (r !== ue)
89
- return r === void 0 && (r = ue, r = t()), r;
90
- },
91
- set(o) {
92
- Object.defineProperty(e, n, {
93
- value: o
94
- // configurable: true,
95
- });
96
- },
97
- configurable: !0
98
- });
99
- }
100
- function j(e, n, t) {
101
- Object.defineProperty(e, n, {
102
- value: t,
103
- writable: !0,
104
- enumerable: !0,
105
- configurable: !0
106
- });
107
- }
108
- function N(...e) {
109
- const n = {};
110
- for (const t of e) {
111
- const r = Object.getOwnPropertyDescriptors(t);
112
- Object.assign(n, r);
113
- }
114
- return Object.defineProperties({}, n);
115
- }
116
- function ce(e) {
117
- return JSON.stringify(e);
118
- }
119
- const Ze = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
120
- };
121
- function H(e) {
122
- return typeof e == "object" && e !== null && !Array.isArray(e);
123
- }
124
- const on = ee(() => {
125
- if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
126
- return !1;
127
- try {
128
- const e = Function;
129
- return new e(""), !0;
130
- } catch {
131
- return !1;
132
- }
133
- });
134
- function D(e) {
135
- if (H(e) === !1)
136
- return !1;
137
- const n = e.constructor;
138
- if (n === void 0 || typeof n != "function")
139
- return !0;
140
- const t = n.prototype;
141
- return !(H(t) === !1 || Object.prototype.hasOwnProperty.call(t, "isPrototypeOf") === !1);
142
- }
143
- function Ie(e) {
144
- return D(e) ? { ...e } : Array.isArray(e) ? [...e] : e;
145
- }
146
- const sn = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
147
- function un(e) {
148
- return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
149
- }
150
- function E(e, n, t) {
151
- const r = new e._zod.constr(n ?? e._zod.def);
152
- return (!n || t?.parent) && (r._zod.parent = e), r;
153
- }
154
- function _(e) {
155
- const n = e;
156
- if (!n)
157
- return {};
158
- if (typeof n == "string")
159
- return { error: () => n };
160
- if (n?.message !== void 0) {
161
- if (n?.error !== void 0)
162
- throw new Error("Cannot specify both `message` and `error` params");
163
- n.error = n.message;
164
- }
165
- return delete n.message, typeof n.error == "string" ? { ...n, error: () => n.error } : n;
166
- }
167
- function cn(e) {
168
- return Object.keys(e).filter((n) => e[n]._zod.optin === "optional" && e[n]._zod.optout === "optional");
169
- }
170
- const an = {
171
- safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
172
- int32: [-2147483648, 2147483647],
173
- uint32: [0, 4294967295],
174
- float32: [-34028234663852886e22, 34028234663852886e22],
175
- float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
176
- };
177
- function ln(e, n) {
178
- const t = e._zod.def, r = t.checks;
179
- if (r && r.length > 0)
180
- throw new Error(".pick() cannot be used on object schemas containing refinements");
181
- const i = N(e._zod.def, {
182
- get shape() {
183
- const s = {};
184
- for (const u in n) {
185
- if (!(u in t.shape))
186
- throw new Error(`Unrecognized key: "${u}"`);
187
- n[u] && (s[u] = t.shape[u]);
188
- }
189
- return j(this, "shape", s), s;
190
- },
191
- checks: []
192
- });
193
- return E(e, i);
194
- }
195
- function fn(e, n) {
196
- const t = e._zod.def, r = t.checks;
197
- if (r && r.length > 0)
198
- throw new Error(".omit() cannot be used on object schemas containing refinements");
199
- const i = N(e._zod.def, {
200
- get shape() {
201
- const s = { ...e._zod.def.shape };
202
- for (const u in n) {
203
- if (!(u in t.shape))
204
- throw new Error(`Unrecognized key: "${u}"`);
205
- n[u] && delete s[u];
206
- }
207
- return j(this, "shape", s), s;
208
- },
209
- checks: []
210
- });
211
- return E(e, i);
212
- }
213
- function dn(e, n) {
214
- if (!D(n))
215
- throw new Error("Invalid input to extend: expected a plain object");
216
- const t = e._zod.def.checks;
217
- if (t && t.length > 0) {
218
- const i = e._zod.def.shape;
219
- for (const s in n)
220
- if (Object.getOwnPropertyDescriptor(i, s) !== void 0)
221
- throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
222
- }
223
- const o = N(e._zod.def, {
224
- get shape() {
225
- const i = { ...e._zod.def.shape, ...n };
226
- return j(this, "shape", i), i;
227
- }
228
- });
229
- return E(e, o);
230
- }
231
- function pn(e, n) {
232
- if (!D(n))
233
- throw new Error("Invalid input to safeExtend: expected a plain object");
234
- const t = N(e._zod.def, {
235
- get shape() {
236
- const r = { ...e._zod.def.shape, ...n };
237
- return j(this, "shape", r), r;
238
- }
239
- });
240
- return E(e, t);
241
- }
242
- function hn(e, n) {
243
- const t = N(e._zod.def, {
244
- get shape() {
245
- const r = { ...e._zod.def.shape, ...n._zod.def.shape };
246
- return j(this, "shape", r), r;
247
- },
248
- get catchall() {
249
- return n._zod.def.catchall;
250
- },
251
- checks: []
252
- // delete existing checks
253
- });
254
- return E(e, t);
255
- }
256
- function mn(e, n, t) {
257
- const o = n._zod.def.checks;
258
- if (o && o.length > 0)
259
- throw new Error(".partial() cannot be used on object schemas containing refinements");
260
- const s = N(n._zod.def, {
261
- get shape() {
262
- const u = n._zod.def.shape, c = { ...u };
263
- if (t)
264
- for (const a in t) {
265
- if (!(a in u))
266
- throw new Error(`Unrecognized key: "${a}"`);
267
- t[a] && (c[a] = e ? new e({
268
- type: "optional",
269
- innerType: u[a]
270
- }) : u[a]);
271
- }
272
- else
273
- for (const a in u)
274
- c[a] = e ? new e({
275
- type: "optional",
276
- innerType: u[a]
277
- }) : u[a];
278
- return j(this, "shape", c), c;
279
- },
280
- checks: []
281
- });
282
- return E(n, s);
283
- }
284
- function _n(e, n, t) {
285
- const r = N(n._zod.def, {
286
- get shape() {
287
- const o = n._zod.def.shape, i = { ...o };
288
- if (t)
289
- for (const s in t) {
290
- if (!(s in i))
291
- throw new Error(`Unrecognized key: "${s}"`);
292
- t[s] && (i[s] = new e({
293
- type: "nonoptional",
294
- innerType: o[s]
295
- }));
296
- }
297
- else
298
- for (const s in o)
299
- i[s] = new e({
300
- type: "nonoptional",
301
- innerType: o[s]
302
- });
303
- return j(this, "shape", i), i;
304
- }
305
- });
306
- return E(n, r);
307
- }
308
- function A(e, n = 0) {
309
- if (e.aborted === !0)
310
- return !0;
311
- for (let t = n; t < e.issues.length; t++)
312
- if (e.issues[t]?.continue !== !0)
313
- return !0;
314
- return !1;
315
- }
316
- function je(e, n) {
317
- return n.map((t) => {
318
- var r;
319
- return (r = t).path ?? (r.path = []), t.path.unshift(e), t;
320
- });
321
- }
322
- function J(e) {
323
- return typeof e == "string" ? e : e?.message;
324
- }
325
- function I(e, n, t) {
326
- const r = { ...e, path: e.path ?? [] };
327
- if (!e.message) {
328
- const o = J(e.inst?._zod.def?.error?.(e)) ?? J(n?.error?.(e)) ?? J(t.customError?.(e)) ?? J(t.localeError?.(e)) ?? "Invalid input";
329
- r.message = o;
330
- }
331
- return delete r.inst, delete r.continue, n?.reportInput || delete r.input, r;
332
- }
333
- function re(e) {
334
- return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
335
- }
336
- function C(...e) {
337
- const [n, t, r] = e;
338
- return typeof n == "string" ? {
339
- message: n,
340
- code: "custom",
341
- input: t,
342
- inst: r
343
- } : { ...n };
344
- }
345
- const Ae = (e, n) => {
346
- e.name = "$ZodError", Object.defineProperty(e, "_zod", {
347
- value: e._zod,
348
- enumerable: !1
349
- }), Object.defineProperty(e, "issues", {
350
- value: n,
351
- enumerable: !1
352
- }), e.message = JSON.stringify(n, W, 2), Object.defineProperty(e, "toString", {
353
- value: () => e.message,
354
- enumerable: !1
355
- });
356
- }, Me = l("$ZodError", Ae), Re = l("$ZodError", Ae, { Parent: Error });
357
- function gn(e, n = (t) => t.message) {
358
- const t = {}, r = [];
359
- for (const o of e.issues)
360
- o.path.length > 0 ? (t[o.path[0]] = t[o.path[0]] || [], t[o.path[0]].push(n(o))) : r.push(n(o));
361
- return { formErrors: r, fieldErrors: t };
362
- }
363
- function yn(e, n = (t) => t.message) {
364
- const t = { _errors: [] }, r = (o) => {
365
- for (const i of o.issues)
366
- if (i.code === "invalid_union" && i.errors.length)
367
- i.errors.map((s) => r({ issues: s }));
368
- else if (i.code === "invalid_key")
369
- r({ issues: i.issues });
370
- else if (i.code === "invalid_element")
371
- r({ issues: i.issues });
372
- else if (i.path.length === 0)
373
- t._errors.push(n(i));
374
- else {
375
- let s = t, u = 0;
376
- for (; u < i.path.length; ) {
377
- const c = i.path[u];
378
- u === i.path.length - 1 ? (s[c] = s[c] || { _errors: [] }, s[c]._errors.push(n(i))) : s[c] = s[c] || { _errors: [] }, s = s[c], u++;
379
- }
380
- }
381
- };
382
- return r(e), t;
383
- }
384
- const oe = (e) => (n, t, r, o) => {
385
- const i = r ? Object.assign(r, { async: !1 }) : { async: !1 }, s = n._zod.run({ value: t, issues: [] }, i);
386
- if (s instanceof Promise)
387
- throw new M();
388
- if (s.issues.length) {
389
- const u = new (o?.Err ?? e)(s.issues.map((c) => I(c, i, Z())));
390
- throw Ze(u, o?.callee), u;
391
- }
392
- return s.value;
393
- }, se = (e) => async (n, t, r, o) => {
394
- const i = r ? Object.assign(r, { async: !0 }) : { async: !0 };
395
- let s = n._zod.run({ value: t, issues: [] }, i);
396
- if (s instanceof Promise && (s = await s), s.issues.length) {
397
- const u = new (o?.Err ?? e)(s.issues.map((c) => I(c, i, Z())));
398
- throw Ze(u, o?.callee), u;
399
- }
400
- return s.value;
401
- }, K = (e) => (n, t, r) => {
402
- const o = r ? { ...r, async: !1 } : { async: !1 }, i = n._zod.run({ value: t, issues: [] }, o);
403
- if (i instanceof Promise)
404
- throw new M();
405
- return i.issues.length ? {
406
- success: !1,
407
- error: new (e ?? Me)(i.issues.map((s) => I(s, o, Z())))
408
- } : { success: !0, data: i.value };
409
- }, vn = /* @__PURE__ */ K(Re), Y = (e) => async (n, t, r) => {
410
- const o = r ? Object.assign(r, { async: !0 }) : { async: !0 };
411
- let i = n._zod.run({ value: t, issues: [] }, o);
412
- return i instanceof Promise && (i = await i), i.issues.length ? {
413
- success: !1,
414
- error: new e(i.issues.map((s) => I(s, o, Z())))
415
- } : { success: !0, data: i.value };
416
- }, zn = /* @__PURE__ */ Y(Re), bn = (e) => (n, t, r) => {
417
- const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
418
- return oe(e)(n, t, o);
419
- }, wn = (e) => (n, t, r) => oe(e)(n, t, r), kn = (e) => async (n, t, r) => {
420
- const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
421
- return se(e)(n, t, o);
422
- }, On = (e) => async (n, t, r) => se(e)(n, t, r), Sn = (e) => (n, t, r) => {
423
- const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
424
- return K(e)(n, t, o);
425
- }, Pn = (e) => (n, t, r) => K(e)(n, t, r), Tn = (e) => async (n, t, r) => {
426
- const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
427
- return Y(e)(n, t, o);
428
- }, $n = (e) => async (n, t, r) => Y(e)(n, t, r), Nn = /^-?\d+$/, En = /^-?\d+(?:\.\d+)?$/, T = /* @__PURE__ */ l("$ZodCheck", (e, n) => {
429
- var t;
430
- e._zod ?? (e._zod = {}), e._zod.def = n, (t = e._zod).onattach ?? (t.onattach = []);
431
- }), De = {
432
- number: "number",
433
- bigint: "bigint",
434
- object: "date"
435
- }, Ce = /* @__PURE__ */ l("$ZodCheckLessThan", (e, n) => {
436
- T.init(e, n);
437
- const t = De[typeof n.value];
438
- e._zod.onattach.push((r) => {
439
- const o = r._zod.bag, i = (n.inclusive ? o.maximum : o.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
440
- n.value < i && (n.inclusive ? o.maximum = n.value : o.exclusiveMaximum = n.value);
441
- }), e._zod.check = (r) => {
442
- (n.inclusive ? r.value <= n.value : r.value < n.value) || r.issues.push({
443
- origin: t,
444
- code: "too_big",
445
- maximum: typeof n.value == "object" ? n.value.getTime() : n.value,
446
- input: r.value,
447
- inclusive: n.inclusive,
448
- inst: e,
449
- continue: !n.abort
450
- });
451
- };
452
- }), Ve = /* @__PURE__ */ l("$ZodCheckGreaterThan", (e, n) => {
453
- T.init(e, n);
454
- const t = De[typeof n.value];
455
- e._zod.onattach.push((r) => {
456
- const o = r._zod.bag, i = (n.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
457
- n.value > i && (n.inclusive ? o.minimum = n.value : o.exclusiveMinimum = n.value);
458
- }), e._zod.check = (r) => {
459
- (n.inclusive ? r.value >= n.value : r.value > n.value) || r.issues.push({
460
- origin: t,
461
- code: "too_small",
462
- minimum: typeof n.value == "object" ? n.value.getTime() : n.value,
463
- input: r.value,
464
- inclusive: n.inclusive,
465
- inst: e,
466
- continue: !n.abort
467
- });
468
- };
469
- }), Zn = /* @__PURE__ */ l("$ZodCheckMultipleOf", (e, n) => {
470
- T.init(e, n), e._zod.onattach.push((t) => {
471
- var r;
472
- (r = t._zod.bag).multipleOf ?? (r.multipleOf = n.value);
473
- }), e._zod.check = (t) => {
474
- if (typeof t.value != typeof n.value)
475
- throw new Error("Cannot mix number and bigint in multiple_of check.");
476
- (typeof t.value == "bigint" ? t.value % n.value === BigInt(0) : rn(t.value, n.value) === 0) || t.issues.push({
477
- origin: typeof t.value,
478
- code: "not_multiple_of",
479
- divisor: n.value,
480
- input: t.value,
481
- inst: e,
482
- continue: !n.abort
483
- });
484
- };
485
- }), In = /* @__PURE__ */ l("$ZodCheckNumberFormat", (e, n) => {
486
- T.init(e, n), n.format = n.format || "float64";
487
- const t = n.format?.includes("int"), r = t ? "int" : "number", [o, i] = an[n.format];
488
- e._zod.onattach.push((s) => {
489
- const u = s._zod.bag;
490
- u.format = n.format, u.minimum = o, u.maximum = i, t && (u.pattern = Nn);
491
- }), e._zod.check = (s) => {
492
- const u = s.value;
493
- if (t) {
494
- if (!Number.isInteger(u)) {
495
- s.issues.push({
496
- expected: r,
497
- format: n.format,
498
- code: "invalid_type",
499
- continue: !1,
500
- input: u,
501
- inst: e
502
- });
503
- return;
504
- }
505
- if (!Number.isSafeInteger(u)) {
506
- u > 0 ? s.issues.push({
507
- input: u,
508
- code: "too_big",
509
- maximum: Number.MAX_SAFE_INTEGER,
510
- note: "Integers must be within the safe integer range.",
511
- inst: e,
512
- origin: r,
513
- inclusive: !0,
514
- continue: !n.abort
515
- }) : s.issues.push({
516
- input: u,
517
- code: "too_small",
518
- minimum: Number.MIN_SAFE_INTEGER,
519
- note: "Integers must be within the safe integer range.",
520
- inst: e,
521
- origin: r,
522
- inclusive: !0,
523
- continue: !n.abort
524
- });
525
- return;
526
- }
527
- }
528
- u < o && s.issues.push({
529
- origin: "number",
530
- input: u,
531
- code: "too_small",
532
- minimum: o,
533
- inclusive: !0,
534
- inst: e,
535
- continue: !n.abort
536
- }), u > i && s.issues.push({
537
- origin: "number",
538
- input: u,
539
- code: "too_big",
540
- maximum: i,
541
- inclusive: !0,
542
- inst: e,
543
- continue: !n.abort
544
- });
545
- };
546
- }), jn = /* @__PURE__ */ l("$ZodCheckMaxLength", (e, n) => {
547
- var t;
548
- T.init(e, n), (t = e._zod.def).when ?? (t.when = (r) => {
549
- const o = r.value;
550
- return !ne(o) && o.length !== void 0;
551
- }), e._zod.onattach.push((r) => {
552
- const o = r._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
553
- n.maximum < o && (r._zod.bag.maximum = n.maximum);
554
- }), e._zod.check = (r) => {
555
- const o = r.value;
556
- if (o.length <= n.maximum)
557
- return;
558
- const s = re(o);
559
- r.issues.push({
560
- origin: s,
561
- code: "too_big",
562
- maximum: n.maximum,
563
- inclusive: !0,
564
- input: o,
565
- inst: e,
566
- continue: !n.abort
567
- });
568
- };
569
- }), An = /* @__PURE__ */ l("$ZodCheckMinLength", (e, n) => {
570
- var t;
571
- T.init(e, n), (t = e._zod.def).when ?? (t.when = (r) => {
572
- const o = r.value;
573
- return !ne(o) && o.length !== void 0;
574
- }), e._zod.onattach.push((r) => {
575
- const o = r._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
576
- n.minimum > o && (r._zod.bag.minimum = n.minimum);
577
- }), e._zod.check = (r) => {
578
- const o = r.value;
579
- if (o.length >= n.minimum)
580
- return;
581
- const s = re(o);
582
- r.issues.push({
583
- origin: s,
584
- code: "too_small",
585
- minimum: n.minimum,
586
- inclusive: !0,
587
- input: o,
588
- inst: e,
589
- continue: !n.abort
590
- });
591
- };
592
- }), Mn = /* @__PURE__ */ l("$ZodCheckLengthEquals", (e, n) => {
593
- var t;
594
- T.init(e, n), (t = e._zod.def).when ?? (t.when = (r) => {
595
- const o = r.value;
596
- return !ne(o) && o.length !== void 0;
597
- }), e._zod.onattach.push((r) => {
598
- const o = r._zod.bag;
599
- o.minimum = n.length, o.maximum = n.length, o.length = n.length;
600
- }), e._zod.check = (r) => {
601
- const o = r.value, i = o.length;
602
- if (i === n.length)
603
- return;
604
- const s = re(o), u = i > n.length;
605
- r.issues.push({
606
- origin: s,
607
- ...u ? { code: "too_big", maximum: n.length } : { code: "too_small", minimum: n.length },
608
- inclusive: !0,
609
- exact: !0,
610
- input: r.value,
611
- inst: e,
612
- continue: !n.abort
613
- });
614
- };
615
- }), Rn = /* @__PURE__ */ l("$ZodCheckOverwrite", (e, n) => {
616
- T.init(e, n), e._zod.check = (t) => {
617
- t.value = n.tx(t.value);
618
- };
619
- });
620
- class Dn {
621
- constructor(n = []) {
622
- this.content = [], this.indent = 0, this && (this.args = n);
623
- }
624
- indented(n) {
625
- this.indent += 1, n(this), this.indent -= 1;
626
- }
627
- write(n) {
628
- if (typeof n == "function") {
629
- n(this, { execution: "sync" }), n(this, { execution: "async" });
630
- return;
631
- }
632
- const r = n.split(`
633
- `).filter((s) => s), o = Math.min(...r.map((s) => s.length - s.trimStart().length)), i = r.map((s) => s.slice(o)).map((s) => " ".repeat(this.indent * 2) + s);
634
- for (const s of i)
635
- this.content.push(s);
636
- }
637
- compile() {
638
- const n = Function, t = this?.args, o = [...(this?.content ?? [""]).map((i) => ` ${i}`)];
639
- return new n(...t, o.join(`
640
- `));
641
- }
642
- }
643
- const Cn = {
644
- major: 4,
645
- minor: 3,
646
- patch: 6
647
- }, g = /* @__PURE__ */ l("$ZodType", (e, n) => {
648
- var t;
649
- e ?? (e = {}), e._zod.def = n, e._zod.bag = e._zod.bag || {}, e._zod.version = Cn;
650
- const r = [...e._zod.def.checks ?? []];
651
- e._zod.traits.has("$ZodCheck") && r.unshift(e);
652
- for (const o of r)
653
- for (const i of o._zod.onattach)
654
- i(e);
655
- if (r.length === 0)
656
- (t = e._zod).deferred ?? (t.deferred = []), e._zod.deferred?.push(() => {
657
- e._zod.run = e._zod.parse;
658
- });
659
- else {
660
- const o = (s, u, c) => {
661
- let a = A(s), f;
662
- for (const h of u) {
663
- if (h._zod.def.when) {
664
- if (!h._zod.def.when(s))
665
- continue;
666
- } else if (a)
667
- continue;
668
- const d = s.issues.length, p = h._zod.check(s);
669
- if (p instanceof Promise && c?.async === !1)
670
- throw new M();
671
- if (f || p instanceof Promise)
672
- f = (f ?? Promise.resolve()).then(async () => {
673
- await p, s.issues.length !== d && (a || (a = A(s, d)));
674
- });
675
- else {
676
- if (s.issues.length === d)
677
- continue;
678
- a || (a = A(s, d));
679
- }
680
- }
681
- return f ? f.then(() => s) : s;
682
- }, i = (s, u, c) => {
683
- if (A(s))
684
- return s.aborted = !0, s;
685
- const a = o(u, r, c);
686
- if (a instanceof Promise) {
687
- if (c.async === !1)
688
- throw new M();
689
- return a.then((f) => e._zod.parse(f, c));
690
- }
691
- return e._zod.parse(a, c);
692
- };
693
- e._zod.run = (s, u) => {
694
- if (u.skipChecks)
695
- return e._zod.parse(s, u);
696
- if (u.direction === "backward") {
697
- const a = e._zod.parse({ value: s.value, issues: [] }, { ...u, skipChecks: !0 });
698
- return a instanceof Promise ? a.then((f) => i(f, s, u)) : i(a, s, u);
699
- }
700
- const c = e._zod.parse(s, u);
701
- if (c instanceof Promise) {
702
- if (u.async === !1)
703
- throw new M();
704
- return c.then((a) => o(a, r, u));
705
- }
706
- return o(c, r, u);
707
- };
708
- }
709
- m(e, "~standard", () => ({
710
- validate: (o) => {
711
- try {
712
- const i = vn(e, o);
713
- return i.success ? { value: i.data } : { issues: i.error?.issues };
714
- } catch {
715
- return zn(e, o).then((s) => s.success ? { value: s.data } : { issues: s.error?.issues });
716
- }
717
- },
718
- vendor: "zod",
719
- version: 1
720
- }));
721
- }), Je = /* @__PURE__ */ l("$ZodNumber", (e, n) => {
722
- g.init(e, n), e._zod.pattern = e._zod.bag.pattern ?? En, e._zod.parse = (t, r) => {
723
- if (n.coerce)
724
- try {
725
- t.value = Number(t.value);
726
- } catch {
727
- }
728
- const o = t.value;
729
- if (typeof o == "number" && !Number.isNaN(o) && Number.isFinite(o))
730
- return t;
731
- const i = typeof o == "number" ? Number.isNaN(o) ? "NaN" : Number.isFinite(o) ? void 0 : "Infinity" : void 0;
732
- return t.issues.push({
733
- expected: "number",
734
- code: "invalid_type",
735
- input: o,
736
- inst: e,
737
- ...i ? { received: i } : {}
738
- }), t;
739
- };
740
- }), Vn = /* @__PURE__ */ l("$ZodNumberFormat", (e, n) => {
741
- In.init(e, n), Je.init(e, n);
742
- }), Jn = /* @__PURE__ */ l("$ZodUnknown", (e, n) => {
743
- g.init(e, n), e._zod.parse = (t) => t;
744
- }), Un = /* @__PURE__ */ l("$ZodNever", (e, n) => {
745
- g.init(e, n), e._zod.parse = (t, r) => (t.issues.push({
746
- expected: "never",
747
- code: "invalid_type",
748
- input: t.value,
749
- inst: e
750
- }), t);
751
- }), xn = /* @__PURE__ */ l("$ZodDate", (e, n) => {
752
- g.init(e, n), e._zod.parse = (t, r) => {
753
- if (n.coerce)
754
- try {
755
- t.value = new Date(t.value);
756
- } catch {
757
- }
758
- const o = t.value, i = o instanceof Date;
759
- return i && !Number.isNaN(o.getTime()) || t.issues.push({
760
- expected: "date",
761
- code: "invalid_type",
762
- input: o,
763
- ...i ? { received: "Invalid Date" } : {},
764
- inst: e
765
- }), t;
766
- };
767
- });
768
- function ae(e, n, t) {
769
- e.issues.length && n.issues.push(...je(t, e.issues)), n.value[t] = e.value;
770
- }
771
- const Fn = /* @__PURE__ */ l("$ZodArray", (e, n) => {
772
- g.init(e, n), e._zod.parse = (t, r) => {
773
- const o = t.value;
774
- if (!Array.isArray(o))
775
- return t.issues.push({
776
- expected: "array",
777
- code: "invalid_type",
778
- input: o,
779
- inst: e
780
- }), t;
781
- t.value = Array(o.length);
782
- const i = [];
783
- for (let s = 0; s < o.length; s++) {
784
- const u = o[s], c = n.element._zod.run({
785
- value: u,
786
- issues: []
787
- }, r);
788
- c instanceof Promise ? i.push(c.then((a) => ae(a, t, s))) : ae(c, t, s);
789
- }
790
- return i.length ? Promise.all(i).then(() => t) : t;
791
- };
792
- });
793
- function L(e, n, t, r, o) {
794
- if (e.issues.length) {
795
- if (o && !(t in r))
796
- return;
797
- n.issues.push(...je(t, e.issues));
798
- }
799
- e.value === void 0 ? t in r && (n.value[t] = void 0) : n.value[t] = e.value;
800
- }
801
- function Ue(e) {
802
- const n = Object.keys(e.shape);
803
- for (const r of n)
804
- if (!e.shape?.[r]?._zod?.traits?.has("$ZodType"))
805
- throw new Error(`Invalid element at key "${r}": expected a Zod schema`);
806
- const t = cn(e.shape);
807
- return {
808
- ...e,
809
- keys: n,
810
- keySet: new Set(n),
811
- numKeys: n.length,
812
- optionalKeys: new Set(t)
813
- };
814
- }
815
- function xe(e, n, t, r, o, i) {
816
- const s = [], u = o.keySet, c = o.catchall._zod, a = c.def.type, f = c.optout === "optional";
817
- for (const h in n) {
818
- if (u.has(h))
819
- continue;
820
- if (a === "never") {
821
- s.push(h);
822
- continue;
823
- }
824
- const d = c.run({ value: n[h], issues: [] }, r);
825
- d instanceof Promise ? e.push(d.then((p) => L(p, t, h, n, f))) : L(d, t, h, n, f);
826
- }
827
- return s.length && t.issues.push({
828
- code: "unrecognized_keys",
829
- keys: s,
830
- input: n,
831
- inst: i
832
- }), e.length ? Promise.all(e).then(() => t) : t;
833
- }
834
- const Hn = /* @__PURE__ */ l("$ZodObject", (e, n) => {
835
- if (g.init(e, n), !Object.getOwnPropertyDescriptor(n, "shape")?.get) {
836
- const u = n.shape;
837
- Object.defineProperty(n, "shape", {
838
- get: () => {
839
- const c = { ...u };
840
- return Object.defineProperty(n, "shape", {
841
- value: c
842
- }), c;
843
- }
844
- });
845
- }
846
- const r = ee(() => Ue(n));
847
- m(e._zod, "propValues", () => {
848
- const u = n.shape, c = {};
849
- for (const a in u) {
850
- const f = u[a]._zod;
851
- if (f.values) {
852
- c[a] ?? (c[a] = /* @__PURE__ */ new Set());
853
- for (const h of f.values)
854
- c[a].add(h);
855
- }
856
- }
857
- return c;
858
- });
859
- const o = H, i = n.catchall;
860
- let s;
861
- e._zod.parse = (u, c) => {
862
- s ?? (s = r.value);
863
- const a = u.value;
864
- if (!o(a))
865
- return u.issues.push({
866
- expected: "object",
867
- code: "invalid_type",
868
- input: a,
869
- inst: e
870
- }), u;
871
- u.value = {};
872
- const f = [], h = s.shape;
873
- for (const d of s.keys) {
874
- const p = h[d], b = p._zod.optout === "optional", v = p._zod.run({ value: a[d], issues: [] }, c);
875
- v instanceof Promise ? f.push(v.then((V) => L(V, u, d, a, b))) : L(v, u, d, a, b);
876
- }
877
- return i ? xe(f, a, u, c, r.value, e) : f.length ? Promise.all(f).then(() => u) : u;
878
- };
879
- }), Ln = /* @__PURE__ */ l("$ZodObjectJIT", (e, n) => {
880
- Hn.init(e, n);
881
- const t = e._zod.parse, r = ee(() => Ue(n)), o = (d) => {
882
- const p = new Dn(["shape", "payload", "ctx"]), b = r.value, v = (P) => {
883
- const k = ce(P);
884
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
885
- };
886
- p.write("const input = payload.value;");
887
- const V = /* @__PURE__ */ Object.create(null);
888
- let en = 0;
889
- for (const P of b.keys)
890
- V[P] = `key_${en++}`;
891
- p.write("const newResult = {};");
892
- for (const P of b.keys) {
893
- const k = V[P], S = ce(P), tn = d[P]?._zod?.optout === "optional";
894
- p.write(`const ${k} = ${v(P)};`), tn ? p.write(`
895
- if (${k}.issues.length) {
896
- if (${S} in input) {
897
- payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
898
- ...iss,
899
- path: iss.path ? [${S}, ...iss.path] : [${S}]
900
- })));
901
- }
902
- }
903
-
904
- if (${k}.value === undefined) {
905
- if (${S} in input) {
906
- newResult[${S}] = undefined;
907
- }
908
- } else {
909
- newResult[${S}] = ${k}.value;
910
- }
911
-
912
- `) : p.write(`
913
- if (${k}.issues.length) {
914
- payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
915
- ...iss,
916
- path: iss.path ? [${S}, ...iss.path] : [${S}]
917
- })));
918
- }
919
-
920
- if (${k}.value === undefined) {
921
- if (${S} in input) {
922
- newResult[${S}] = undefined;
923
- }
924
- } else {
925
- newResult[${S}] = ${k}.value;
926
- }
927
-
928
- `);
929
- }
930
- p.write("payload.value = newResult;"), p.write("return payload;");
931
- const nn = p.compile();
932
- return (P, k) => nn(d, P, k);
933
- };
934
- let i;
935
- const s = H, u = !Ne.jitless, a = u && on.value, f = n.catchall;
936
- let h;
937
- e._zod.parse = (d, p) => {
938
- h ?? (h = r.value);
939
- const b = d.value;
940
- return s(b) ? u && a && p?.async === !1 && p.jitless !== !0 ? (i || (i = o(n.shape)), d = i(d, p), f ? xe([], b, d, p, h, e) : d) : t(d, p) : (d.issues.push({
941
- expected: "object",
942
- code: "invalid_type",
943
- input: b,
944
- inst: e
945
- }), d);
946
- };
947
- });
948
- function le(e, n, t, r) {
949
- for (const i of e)
950
- if (i.issues.length === 0)
951
- return n.value = i.value, n;
952
- const o = e.filter((i) => !A(i));
953
- return o.length === 1 ? (n.value = o[0].value, o[0]) : (n.issues.push({
954
- code: "invalid_union",
955
- input: n.value,
956
- inst: t,
957
- errors: e.map((i) => i.issues.map((s) => I(s, r, Z())))
958
- }), n);
959
- }
960
- const Gn = /* @__PURE__ */ l("$ZodUnion", (e, n) => {
961
- g.init(e, n), m(e._zod, "optin", () => n.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0), m(e._zod, "optout", () => n.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0), m(e._zod, "values", () => {
962
- if (n.options.every((o) => o._zod.values))
963
- return new Set(n.options.flatMap((o) => Array.from(o._zod.values)));
964
- }), m(e._zod, "pattern", () => {
965
- if (n.options.every((o) => o._zod.pattern)) {
966
- const o = n.options.map((i) => i._zod.pattern);
967
- return new RegExp(`^(${o.map((i) => te(i.source)).join("|")})$`);
968
- }
969
- });
970
- const t = n.options.length === 1, r = n.options[0]._zod.run;
971
- e._zod.parse = (o, i) => {
972
- if (t)
973
- return r(o, i);
974
- let s = !1;
975
- const u = [];
976
- for (const c of n.options) {
977
- const a = c._zod.run({
978
- value: o.value,
979
- issues: []
980
- }, i);
981
- if (a instanceof Promise)
982
- u.push(a), s = !0;
983
- else {
984
- if (a.issues.length === 0)
985
- return a;
986
- u.push(a);
987
- }
988
- }
989
- return s ? Promise.all(u).then((c) => le(c, o, e, i)) : le(u, o, e, i);
990
- };
991
- }), Kn = /* @__PURE__ */ l("$ZodIntersection", (e, n) => {
992
- g.init(e, n), e._zod.parse = (t, r) => {
993
- const o = t.value, i = n.left._zod.run({ value: o, issues: [] }, r), s = n.right._zod.run({ value: o, issues: [] }, r);
994
- return i instanceof Promise || s instanceof Promise ? Promise.all([i, s]).then(([c, a]) => fe(t, c, a)) : fe(t, i, s);
995
- };
996
- });
997
- function X(e, n) {
998
- if (e === n)
999
- return { valid: !0, data: e };
1000
- if (e instanceof Date && n instanceof Date && +e == +n)
1001
- return { valid: !0, data: e };
1002
- if (D(e) && D(n)) {
1003
- const t = Object.keys(n), r = Object.keys(e).filter((i) => t.indexOf(i) !== -1), o = { ...e, ...n };
1004
- for (const i of r) {
1005
- const s = X(e[i], n[i]);
1006
- if (!s.valid)
1007
- return {
1008
- valid: !1,
1009
- mergeErrorPath: [i, ...s.mergeErrorPath]
1010
- };
1011
- o[i] = s.data;
1012
- }
1013
- return { valid: !0, data: o };
1014
- }
1015
- if (Array.isArray(e) && Array.isArray(n)) {
1016
- if (e.length !== n.length)
1017
- return { valid: !1, mergeErrorPath: [] };
1018
- const t = [];
1019
- for (let r = 0; r < e.length; r++) {
1020
- const o = e[r], i = n[r], s = X(o, i);
1021
- if (!s.valid)
1022
- return {
1023
- valid: !1,
1024
- mergeErrorPath: [r, ...s.mergeErrorPath]
1025
- };
1026
- t.push(s.data);
1027
- }
1028
- return { valid: !0, data: t };
1029
- }
1030
- return { valid: !1, mergeErrorPath: [] };
1031
- }
1032
- function fe(e, n, t) {
1033
- const r = /* @__PURE__ */ new Map();
1034
- let o;
1035
- for (const u of n.issues)
1036
- if (u.code === "unrecognized_keys") {
1037
- o ?? (o = u);
1038
- for (const c of u.keys)
1039
- r.has(c) || r.set(c, {}), r.get(c).l = !0;
1040
- } else
1041
- e.issues.push(u);
1042
- for (const u of t.issues)
1043
- if (u.code === "unrecognized_keys")
1044
- for (const c of u.keys)
1045
- r.has(c) || r.set(c, {}), r.get(c).r = !0;
1046
- else
1047
- e.issues.push(u);
1048
- const i = [...r].filter(([, u]) => u.l && u.r).map(([u]) => u);
1049
- if (i.length && o && e.issues.push({ ...o, keys: i }), A(e))
1050
- return e;
1051
- const s = X(n.value, t.value);
1052
- if (!s.valid)
1053
- throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);
1054
- return e.value = s.data, e;
1055
- }
1056
- const Yn = /* @__PURE__ */ l("$ZodEnum", (e, n) => {
1057
- g.init(e, n);
1058
- const t = Ee(n.entries), r = new Set(t);
1059
- e._zod.values = r, e._zod.pattern = new RegExp(`^(${t.filter((o) => sn.has(typeof o)).map((o) => typeof o == "string" ? un(o) : o.toString()).join("|")})$`), e._zod.parse = (o, i) => {
1060
- const s = o.value;
1061
- return r.has(s) || o.issues.push({
1062
- code: "invalid_value",
1063
- values: t,
1064
- input: s,
1065
- inst: e
1066
- }), o;
1067
- };
1068
- }), Bn = /* @__PURE__ */ l("$ZodTransform", (e, n) => {
1069
- g.init(e, n), e._zod.parse = (t, r) => {
1070
- if (r.direction === "backward")
1071
- throw new $e(e.constructor.name);
1072
- const o = n.transform(t.value, t);
1073
- if (r.async)
1074
- return (o instanceof Promise ? o : Promise.resolve(o)).then((s) => (t.value = s, t));
1075
- if (o instanceof Promise)
1076
- throw new M();
1077
- return t.value = o, t;
1078
- };
1079
- });
1080
- function de(e, n) {
1081
- return e.issues.length && n === void 0 ? { issues: [], value: void 0 } : e;
1082
- }
1083
- const Fe = /* @__PURE__ */ l("$ZodOptional", (e, n) => {
1084
- g.init(e, n), e._zod.optin = "optional", e._zod.optout = "optional", m(e._zod, "values", () => n.innerType._zod.values ? /* @__PURE__ */ new Set([...n.innerType._zod.values, void 0]) : void 0), m(e._zod, "pattern", () => {
1085
- const t = n.innerType._zod.pattern;
1086
- return t ? new RegExp(`^(${te(t.source)})?$`) : void 0;
1087
- }), e._zod.parse = (t, r) => {
1088
- if (n.innerType._zod.optin === "optional") {
1089
- const o = n.innerType._zod.run(t, r);
1090
- return o instanceof Promise ? o.then((i) => de(i, t.value)) : de(o, t.value);
1091
- }
1092
- return t.value === void 0 ? t : n.innerType._zod.run(t, r);
1093
- };
1094
- }), qn = /* @__PURE__ */ l("$ZodExactOptional", (e, n) => {
1095
- Fe.init(e, n), m(e._zod, "values", () => n.innerType._zod.values), m(e._zod, "pattern", () => n.innerType._zod.pattern), e._zod.parse = (t, r) => n.innerType._zod.run(t, r);
1096
- }), Wn = /* @__PURE__ */ l("$ZodNullable", (e, n) => {
1097
- g.init(e, n), m(e._zod, "optin", () => n.innerType._zod.optin), m(e._zod, "optout", () => n.innerType._zod.optout), m(e._zod, "pattern", () => {
1098
- const t = n.innerType._zod.pattern;
1099
- return t ? new RegExp(`^(${te(t.source)}|null)$`) : void 0;
1100
- }), m(e._zod, "values", () => n.innerType._zod.values ? /* @__PURE__ */ new Set([...n.innerType._zod.values, null]) : void 0), e._zod.parse = (t, r) => t.value === null ? t : n.innerType._zod.run(t, r);
1101
- }), Xn = /* @__PURE__ */ l("$ZodDefault", (e, n) => {
1102
- g.init(e, n), e._zod.optin = "optional", m(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => {
1103
- if (r.direction === "backward")
1104
- return n.innerType._zod.run(t, r);
1105
- if (t.value === void 0)
1106
- return t.value = n.defaultValue, t;
1107
- const o = n.innerType._zod.run(t, r);
1108
- return o instanceof Promise ? o.then((i) => pe(i, n)) : pe(o, n);
1109
- };
1110
- });
1111
- function pe(e, n) {
1112
- return e.value === void 0 && (e.value = n.defaultValue), e;
1113
- }
1114
- const Qn = /* @__PURE__ */ l("$ZodPrefault", (e, n) => {
1115
- g.init(e, n), e._zod.optin = "optional", m(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => (r.direction === "backward" || t.value === void 0 && (t.value = n.defaultValue), n.innerType._zod.run(t, r));
1116
- }), et = /* @__PURE__ */ l("$ZodNonOptional", (e, n) => {
1117
- g.init(e, n), m(e._zod, "values", () => {
1118
- const t = n.innerType._zod.values;
1119
- return t ? new Set([...t].filter((r) => r !== void 0)) : void 0;
1120
- }), e._zod.parse = (t, r) => {
1121
- const o = n.innerType._zod.run(t, r);
1122
- return o instanceof Promise ? o.then((i) => he(i, e)) : he(o, e);
1123
- };
1124
- });
1125
- function he(e, n) {
1126
- return !e.issues.length && e.value === void 0 && e.issues.push({
1127
- code: "invalid_type",
1128
- expected: "nonoptional",
1129
- input: e.value,
1130
- inst: n
1131
- }), e;
1132
- }
1133
- const nt = /* @__PURE__ */ l("$ZodCatch", (e, n) => {
1134
- g.init(e, n), m(e._zod, "optin", () => n.innerType._zod.optin), m(e._zod, "optout", () => n.innerType._zod.optout), m(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => {
1135
- if (r.direction === "backward")
1136
- return n.innerType._zod.run(t, r);
1137
- const o = n.innerType._zod.run(t, r);
1138
- return o instanceof Promise ? o.then((i) => (t.value = i.value, i.issues.length && (t.value = n.catchValue({
1139
- ...t,
1140
- error: {
1141
- issues: i.issues.map((s) => I(s, r, Z()))
1142
- },
1143
- input: t.value
1144
- }), t.issues = []), t)) : (t.value = o.value, o.issues.length && (t.value = n.catchValue({
1145
- ...t,
1146
- error: {
1147
- issues: o.issues.map((i) => I(i, r, Z()))
1148
- },
1149
- input: t.value
1150
- }), t.issues = []), t);
1151
- };
1152
- }), tt = /* @__PURE__ */ l("$ZodPipe", (e, n) => {
1153
- g.init(e, n), m(e._zod, "values", () => n.in._zod.values), m(e._zod, "optin", () => n.in._zod.optin), m(e._zod, "optout", () => n.out._zod.optout), m(e._zod, "propValues", () => n.in._zod.propValues), e._zod.parse = (t, r) => {
1154
- if (r.direction === "backward") {
1155
- const i = n.out._zod.run(t, r);
1156
- return i instanceof Promise ? i.then((s) => U(s, n.in, r)) : U(i, n.in, r);
1157
- }
1158
- const o = n.in._zod.run(t, r);
1159
- return o instanceof Promise ? o.then((i) => U(i, n.out, r)) : U(o, n.out, r);
1160
- };
1161
- });
1162
- function U(e, n, t) {
1163
- return e.issues.length ? (e.aborted = !0, e) : n._zod.run({ value: e.value, issues: e.issues }, t);
1164
- }
1165
- const rt = /* @__PURE__ */ l("$ZodReadonly", (e, n) => {
1166
- g.init(e, n), m(e._zod, "propValues", () => n.innerType._zod.propValues), m(e._zod, "values", () => n.innerType._zod.values), m(e._zod, "optin", () => n.innerType?._zod?.optin), m(e._zod, "optout", () => n.innerType?._zod?.optout), e._zod.parse = (t, r) => {
1167
- if (r.direction === "backward")
1168
- return n.innerType._zod.run(t, r);
1169
- const o = n.innerType._zod.run(t, r);
1170
- return o instanceof Promise ? o.then(me) : me(o);
1171
- };
1172
- });
1173
- function me(e) {
1174
- return e.value = Object.freeze(e.value), e;
1175
- }
1176
- const ot = /* @__PURE__ */ l("$ZodCustom", (e, n) => {
1177
- T.init(e, n), g.init(e, n), e._zod.parse = (t, r) => t, e._zod.check = (t) => {
1178
- const r = t.value, o = n.fn(r);
1179
- if (o instanceof Promise)
1180
- return o.then((i) => _e(i, t, r, e));
1181
- _e(o, t, r, e);
1182
- };
1183
- });
1184
- function _e(e, n, t, r) {
1185
- if (!e) {
1186
- const o = {
1187
- code: "custom",
1188
- input: t,
1189
- inst: r,
1190
- // incorporates params.error into issue reporting
1191
- path: [...r._zod.def.path ?? []],
1192
- // incorporates params.error into issue reporting
1193
- continue: !r._zod.def.abort
1194
- // params: inst._zod.def.params,
1195
- };
1196
- r._zod.def.params && (o.params = r._zod.def.params), n.issues.push(C(o));
1197
- }
1198
- }
1199
- var ge;
1200
- class st {
1201
- constructor() {
1202
- this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
1203
- }
1204
- add(n, ...t) {
1205
- const r = t[0];
1206
- return this._map.set(n, r), r && typeof r == "object" && "id" in r && this._idmap.set(r.id, n), this;
1207
- }
1208
- clear() {
1209
- return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
1210
- }
1211
- remove(n) {
1212
- const t = this._map.get(n);
1213
- return t && typeof t == "object" && "id" in t && this._idmap.delete(t.id), this._map.delete(n), this;
1214
- }
1215
- get(n) {
1216
- const t = n._zod.parent;
1217
- if (t) {
1218
- const r = { ...this.get(t) ?? {} };
1219
- delete r.id;
1220
- const o = { ...r, ...this._map.get(n) };
1221
- return Object.keys(o).length ? o : void 0;
1222
- }
1223
- return this._map.get(n);
1224
- }
1225
- has(n) {
1226
- return this._map.has(n);
1227
- }
1228
- }
1229
- function it() {
1230
- return new st();
1231
- }
1232
- (ge = globalThis).__zod_globalRegistry ?? (ge.__zod_globalRegistry = it());
1233
- const R = globalThis.__zod_globalRegistry;
1234
- // @__NO_SIDE_EFFECTS__
1235
- function ut(e, n) {
1236
- return new e({
1237
- type: "number",
1238
- checks: [],
1239
- ..._(n)
1240
- });
1241
- }
1242
- // @__NO_SIDE_EFFECTS__
1243
- function ct(e, n) {
1244
- return new e({
1245
- type: "number",
1246
- check: "number_format",
1247
- abort: !1,
1248
- format: "safeint",
1249
- ..._(n)
1250
- });
1251
- }
1252
- // @__NO_SIDE_EFFECTS__
1253
- function at(e) {
1254
- return new e({
1255
- type: "unknown"
1256
- });
1257
- }
1258
- // @__NO_SIDE_EFFECTS__
1259
- function lt(e, n) {
1260
- return new e({
1261
- type: "never",
1262
- ..._(n)
1263
- });
1264
- }
1265
- // @__NO_SIDE_EFFECTS__
1266
- function ft(e, n) {
1267
- return new e({
1268
- type: "date",
1269
- ..._(n)
1270
- });
1271
- }
1272
- // @__NO_SIDE_EFFECTS__
1273
- function ye(e, n) {
1274
- return new Ce({
1275
- check: "less_than",
1276
- ..._(n),
1277
- value: e,
1278
- inclusive: !1
1279
- });
1280
- }
1281
- // @__NO_SIDE_EFFECTS__
1282
- function x(e, n) {
1283
- return new Ce({
1284
- check: "less_than",
1285
- ..._(n),
1286
- value: e,
1287
- inclusive: !0
1288
- });
1289
- }
1290
- // @__NO_SIDE_EFFECTS__
1291
- function ve(e, n) {
1292
- return new Ve({
1293
- check: "greater_than",
1294
- ..._(n),
1295
- value: e,
1296
- inclusive: !1
1297
- });
1298
- }
1299
- // @__NO_SIDE_EFFECTS__
1300
- function F(e, n) {
1301
- return new Ve({
1302
- check: "greater_than",
1303
- ..._(n),
1304
- value: e,
1305
- inclusive: !0
1306
- });
1307
- }
1308
- // @__NO_SIDE_EFFECTS__
1309
- function ze(e, n) {
1310
- return new Zn({
1311
- check: "multiple_of",
1312
- ..._(n),
1313
- value: e
1314
- });
1315
- }
1316
- // @__NO_SIDE_EFFECTS__
1317
- function dt(e, n) {
1318
- return new jn({
1319
- check: "max_length",
1320
- ..._(n),
1321
- maximum: e
1322
- });
1323
- }
1324
- // @__NO_SIDE_EFFECTS__
1325
- function be(e, n) {
1326
- return new An({
1327
- check: "min_length",
1328
- ..._(n),
1329
- minimum: e
1330
- });
1331
- }
1332
- // @__NO_SIDE_EFFECTS__
1333
- function pt(e, n) {
1334
- return new Mn({
1335
- check: "length_equals",
1336
- ..._(n),
1337
- length: e
1338
- });
1339
- }
1340
- // @__NO_SIDE_EFFECTS__
1341
- function ht(e) {
1342
- return new Rn({
1343
- check: "overwrite",
1344
- tx: e
1345
- });
1346
- }
1347
- // @__NO_SIDE_EFFECTS__
1348
- function mt(e, n, t) {
1349
- return new e({
1350
- type: "array",
1351
- element: n,
1352
- // get element() {
1353
- // return element;
1354
- // },
1355
- ..._(t)
1356
- });
1357
- }
1358
- // @__NO_SIDE_EFFECTS__
1359
- function _t(e, n, t) {
1360
- return new e({
1361
- type: "custom",
1362
- check: "custom",
1363
- fn: n,
1364
- ..._(t)
1365
- });
1366
- }
1367
- // @__NO_SIDE_EFFECTS__
1368
- function gt(e) {
1369
- const n = /* @__PURE__ */ yt((t) => (t.addIssue = (r) => {
1370
- if (typeof r == "string")
1371
- t.issues.push(C(r, t.value, n._zod.def));
1372
- else {
1373
- const o = r;
1374
- o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input = t.value), o.inst ?? (o.inst = n), o.continue ?? (o.continue = !n._zod.def.abort), t.issues.push(C(o));
1375
- }
1376
- }, e(t.value, t)));
1377
- return n;
1378
- }
1379
- // @__NO_SIDE_EFFECTS__
1380
- function yt(e, n) {
1381
- const t = new T({
1382
- check: "custom",
1383
- ..._(n)
1384
- });
1385
- return t._zod.check = e, t;
1386
- }
1387
- function He(e) {
1388
- let n = e?.target ?? "draft-2020-12";
1389
- return n === "draft-4" && (n = "draft-04"), n === "draft-7" && (n = "draft-07"), {
1390
- processors: e.processors ?? {},
1391
- metadataRegistry: e?.metadata ?? R,
1392
- target: n,
1393
- unrepresentable: e?.unrepresentable ?? "throw",
1394
- override: e?.override ?? (() => {
1395
- }),
1396
- io: e?.io ?? "output",
1397
- counter: 0,
1398
- seen: /* @__PURE__ */ new Map(),
1399
- cycles: e?.cycles ?? "ref",
1400
- reused: e?.reused ?? "inline",
1401
- external: e?.external ?? void 0
1402
- };
1403
- }
1404
- function z(e, n, t = { path: [], schemaPath: [] }) {
1405
- var r;
1406
- const o = e._zod.def, i = n.seen.get(e);
1407
- if (i)
1408
- return i.count++, t.schemaPath.includes(e) && (i.cycle = t.path), i.schema;
1409
- const s = { schema: {}, count: 1, cycle: void 0, path: t.path };
1410
- n.seen.set(e, s);
1411
- const u = e._zod.toJSONSchema?.();
1412
- if (u)
1413
- s.schema = u;
1414
- else {
1415
- const f = {
1416
- ...t,
1417
- schemaPath: [...t.schemaPath, e],
1418
- path: t.path
1419
- };
1420
- if (e._zod.processJSONSchema)
1421
- e._zod.processJSONSchema(n, s.schema, f);
1422
- else {
1423
- const d = s.schema, p = n.processors[o.type];
1424
- if (!p)
1425
- throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);
1426
- p(e, n, d, f);
1427
- }
1428
- const h = e._zod.parent;
1429
- h && (s.ref || (s.ref = h), z(h, n, f), n.seen.get(h).isParent = !0);
1430
- }
1431
- const c = n.metadataRegistry.get(e);
1432
- return c && Object.assign(s.schema, c), n.io === "input" && w(e) && (delete s.schema.examples, delete s.schema.default), n.io === "input" && s.schema._prefault && ((r = s.schema).default ?? (r.default = s.schema._prefault)), delete s.schema._prefault, n.seen.get(e).schema;
1433
- }
1434
- function Le(e, n) {
1435
- const t = e.seen.get(n);
1436
- if (!t)
1437
- throw new Error("Unprocessed schema. This is a bug in Zod.");
1438
- const r = /* @__PURE__ */ new Map();
1439
- for (const s of e.seen.entries()) {
1440
- const u = e.metadataRegistry.get(s[0])?.id;
1441
- if (u) {
1442
- const c = r.get(u);
1443
- if (c && c !== s[0])
1444
- throw new Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
1445
- r.set(u, s[0]);
1446
- }
1447
- }
1448
- const o = (s) => {
1449
- const u = e.target === "draft-2020-12" ? "$defs" : "definitions";
1450
- if (e.external) {
1451
- const h = e.external.registry.get(s[0])?.id, d = e.external.uri ?? ((b) => b);
1452
- if (h)
1453
- return { ref: d(h) };
1454
- const p = s[1].defId ?? s[1].schema.id ?? `schema${e.counter++}`;
1455
- return s[1].defId = p, { defId: p, ref: `${d("__shared")}#/${u}/${p}` };
1456
- }
1457
- if (s[1] === t)
1458
- return { ref: "#" };
1459
- const a = `#/${u}/`, f = s[1].schema.id ?? `__schema${e.counter++}`;
1460
- return { defId: f, ref: a + f };
1461
- }, i = (s) => {
1462
- if (s[1].schema.$ref)
1463
- return;
1464
- const u = s[1], { ref: c, defId: a } = o(s);
1465
- u.def = { ...u.schema }, a && (u.defId = a);
1466
- const f = u.schema;
1467
- for (const h in f)
1468
- delete f[h];
1469
- f.$ref = c;
1470
- };
1471
- if (e.cycles === "throw")
1472
- for (const s of e.seen.entries()) {
1473
- const u = s[1];
1474
- if (u.cycle)
1475
- throw new Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
1476
-
1477
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
1478
- }
1479
- for (const s of e.seen.entries()) {
1480
- const u = s[1];
1481
- if (n === s[0]) {
1482
- i(s);
1483
- continue;
1484
- }
1485
- if (e.external) {
1486
- const a = e.external.registry.get(s[0])?.id;
1487
- if (n !== s[0] && a) {
1488
- i(s);
1489
- continue;
1490
- }
1491
- }
1492
- if (e.metadataRegistry.get(s[0])?.id) {
1493
- i(s);
1494
- continue;
1495
- }
1496
- if (u.cycle) {
1497
- i(s);
1498
- continue;
1499
- }
1500
- if (u.count > 1 && e.reused === "ref") {
1501
- i(s);
1502
- continue;
1503
- }
1504
- }
1505
- }
1506
- function Ge(e, n) {
1507
- const t = e.seen.get(n);
1508
- if (!t)
1509
- throw new Error("Unprocessed schema. This is a bug in Zod.");
1510
- const r = (s) => {
1511
- const u = e.seen.get(s);
1512
- if (u.ref === null)
1513
- return;
1514
- const c = u.def ?? u.schema, a = { ...c }, f = u.ref;
1515
- if (u.ref = null, f) {
1516
- r(f);
1517
- const d = e.seen.get(f), p = d.schema;
1518
- if (p.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (c.allOf = c.allOf ?? [], c.allOf.push(p)) : Object.assign(c, p), Object.assign(c, a), s._zod.parent === f)
1519
- for (const v in c)
1520
- v === "$ref" || v === "allOf" || v in a || delete c[v];
1521
- if (p.$ref && d.def)
1522
- for (const v in c)
1523
- v === "$ref" || v === "allOf" || v in d.def && JSON.stringify(c[v]) === JSON.stringify(d.def[v]) && delete c[v];
1524
- }
1525
- const h = s._zod.parent;
1526
- if (h && h !== f) {
1527
- r(h);
1528
- const d = e.seen.get(h);
1529
- if (d?.schema.$ref && (c.$ref = d.schema.$ref, d.def))
1530
- for (const p in c)
1531
- p === "$ref" || p === "allOf" || p in d.def && JSON.stringify(c[p]) === JSON.stringify(d.def[p]) && delete c[p];
1532
- }
1533
- e.override({
1534
- zodSchema: s,
1535
- jsonSchema: c,
1536
- path: u.path ?? []
1537
- });
1538
- };
1539
- for (const s of [...e.seen.entries()].reverse())
1540
- r(s[0]);
1541
- const o = {};
1542
- if (e.target === "draft-2020-12" ? o.$schema = "https://json-schema.org/draft/2020-12/schema" : e.target === "draft-07" ? o.$schema = "http://json-schema.org/draft-07/schema#" : e.target === "draft-04" ? o.$schema = "http://json-schema.org/draft-04/schema#" : e.target, e.external?.uri) {
1543
- const s = e.external.registry.get(n)?.id;
1544
- if (!s)
1545
- throw new Error("Schema is missing an `id` property");
1546
- o.$id = e.external.uri(s);
1547
- }
1548
- Object.assign(o, t.def ?? t.schema);
1549
- const i = e.external?.defs ?? {};
1550
- for (const s of e.seen.entries()) {
1551
- const u = s[1];
1552
- u.def && u.defId && (i[u.defId] = u.def);
1553
- }
1554
- e.external || Object.keys(i).length > 0 && (e.target === "draft-2020-12" ? o.$defs = i : o.definitions = i);
1555
- try {
1556
- const s = JSON.parse(JSON.stringify(o));
1557
- return Object.defineProperty(s, "~standard", {
1558
- value: {
1559
- ...n["~standard"],
1560
- jsonSchema: {
1561
- input: G(n, "input", e.processors),
1562
- output: G(n, "output", e.processors)
1563
- }
1564
- },
1565
- enumerable: !1,
1566
- writable: !1
1567
- }), s;
1568
- } catch {
1569
- throw new Error("Error converting schema to JSON.");
1570
- }
1571
- }
1572
- function w(e, n) {
1573
- const t = n ?? { seen: /* @__PURE__ */ new Set() };
1574
- if (t.seen.has(e))
1575
- return !1;
1576
- t.seen.add(e);
1577
- const r = e._zod.def;
1578
- if (r.type === "transform")
1579
- return !0;
1580
- if (r.type === "array")
1581
- return w(r.element, t);
1582
- if (r.type === "set")
1583
- return w(r.valueType, t);
1584
- if (r.type === "lazy")
1585
- return w(r.getter(), t);
1586
- if (r.type === "promise" || r.type === "optional" || r.type === "nonoptional" || r.type === "nullable" || r.type === "readonly" || r.type === "default" || r.type === "prefault")
1587
- return w(r.innerType, t);
1588
- if (r.type === "intersection")
1589
- return w(r.left, t) || w(r.right, t);
1590
- if (r.type === "record" || r.type === "map")
1591
- return w(r.keyType, t) || w(r.valueType, t);
1592
- if (r.type === "pipe")
1593
- return w(r.in, t) || w(r.out, t);
1594
- if (r.type === "object") {
1595
- for (const o in r.shape)
1596
- if (w(r.shape[o], t))
1597
- return !0;
1598
- return !1;
1599
- }
1600
- if (r.type === "union") {
1601
- for (const o of r.options)
1602
- if (w(o, t))
1603
- return !0;
1604
- return !1;
1605
- }
1606
- if (r.type === "tuple") {
1607
- for (const o of r.items)
1608
- if (w(o, t))
1609
- return !0;
1610
- return !!(r.rest && w(r.rest, t));
1611
- }
1612
- return !1;
1613
- }
1614
- const vt = (e, n = {}) => (t) => {
1615
- const r = He({ ...t, processors: n });
1616
- return z(e, r), Le(r, e), Ge(r, e);
1617
- }, G = (e, n, t = {}) => (r) => {
1618
- const { libraryOptions: o, target: i } = r ?? {}, s = He({ ...o ?? {}, target: i, io: n, processors: t });
1619
- return z(e, s), Le(s, e), Ge(s, e);
1620
- }, zt = (e, n, t, r) => {
1621
- const o = t, { minimum: i, maximum: s, format: u, multipleOf: c, exclusiveMaximum: a, exclusiveMinimum: f } = e._zod.bag;
1622
- typeof u == "string" && u.includes("int") ? o.type = "integer" : o.type = "number", typeof f == "number" && (n.target === "draft-04" || n.target === "openapi-3.0" ? (o.minimum = f, o.exclusiveMinimum = !0) : o.exclusiveMinimum = f), typeof i == "number" && (o.minimum = i, typeof f == "number" && n.target !== "draft-04" && (f >= i ? delete o.minimum : delete o.exclusiveMinimum)), typeof a == "number" && (n.target === "draft-04" || n.target === "openapi-3.0" ? (o.maximum = a, o.exclusiveMaximum = !0) : o.exclusiveMaximum = a), typeof s == "number" && (o.maximum = s, typeof a == "number" && n.target !== "draft-04" && (a <= s ? delete o.maximum : delete o.exclusiveMaximum)), typeof c == "number" && (o.multipleOf = c);
1623
- }, bt = (e, n, t, r) => {
1624
- t.not = {};
1625
- }, wt = (e, n, t, r) => {
1626
- }, kt = (e, n, t, r) => {
1627
- if (n.unrepresentable === "throw")
1628
- throw new Error("Date cannot be represented in JSON Schema");
1629
- }, Ot = (e, n, t, r) => {
1630
- const o = e._zod.def, i = Ee(o.entries);
1631
- i.every((s) => typeof s == "number") && (t.type = "number"), i.every((s) => typeof s == "string") && (t.type = "string"), t.enum = i;
1632
- }, St = (e, n, t, r) => {
1633
- if (n.unrepresentable === "throw")
1634
- throw new Error("Custom types cannot be represented in JSON Schema");
1635
- }, Pt = (e, n, t, r) => {
1636
- if (n.unrepresentable === "throw")
1637
- throw new Error("Transforms cannot be represented in JSON Schema");
1638
- }, Tt = (e, n, t, r) => {
1639
- const o = t, i = e._zod.def, { minimum: s, maximum: u } = e._zod.bag;
1640
- typeof s == "number" && (o.minItems = s), typeof u == "number" && (o.maxItems = u), o.type = "array", o.items = z(i.element, n, { ...r, path: [...r.path, "items"] });
1641
- }, $t = (e, n, t, r) => {
1642
- const o = t, i = e._zod.def;
1643
- o.type = "object", o.properties = {};
1644
- const s = i.shape;
1645
- for (const a in s)
1646
- o.properties[a] = z(s[a], n, {
1647
- ...r,
1648
- path: [...r.path, "properties", a]
1649
- });
1650
- const u = new Set(Object.keys(s)), c = new Set([...u].filter((a) => {
1651
- const f = i.shape[a]._zod;
1652
- return n.io === "input" ? f.optin === void 0 : f.optout === void 0;
1653
- }));
1654
- c.size > 0 && (o.required = Array.from(c)), i.catchall?._zod.def.type === "never" ? o.additionalProperties = !1 : i.catchall ? i.catchall && (o.additionalProperties = z(i.catchall, n, {
1655
- ...r,
1656
- path: [...r.path, "additionalProperties"]
1657
- })) : n.io === "output" && (o.additionalProperties = !1);
1658
- }, Nt = (e, n, t, r) => {
1659
- const o = e._zod.def, i = o.inclusive === !1, s = o.options.map((u, c) => z(u, n, {
1660
- ...r,
1661
- path: [...r.path, i ? "oneOf" : "anyOf", c]
1662
- }));
1663
- i ? t.oneOf = s : t.anyOf = s;
1664
- }, Et = (e, n, t, r) => {
1665
- const o = e._zod.def, i = z(o.left, n, {
1666
- ...r,
1667
- path: [...r.path, "allOf", 0]
1668
- }), s = z(o.right, n, {
1669
- ...r,
1670
- path: [...r.path, "allOf", 1]
1671
- }), u = (a) => "allOf" in a && Object.keys(a).length === 1, c = [
1672
- ...u(i) ? i.allOf : [i],
1673
- ...u(s) ? s.allOf : [s]
1674
- ];
1675
- t.allOf = c;
1676
- }, Zt = (e, n, t, r) => {
1677
- const o = e._zod.def, i = z(o.innerType, n, r), s = n.seen.get(e);
1678
- n.target === "openapi-3.0" ? (s.ref = o.innerType, t.nullable = !0) : t.anyOf = [i, { type: "null" }];
1679
- }, It = (e, n, t, r) => {
1680
- const o = e._zod.def;
1681
- z(o.innerType, n, r);
1682
- const i = n.seen.get(e);
1683
- i.ref = o.innerType;
1684
- }, jt = (e, n, t, r) => {
1685
- const o = e._zod.def;
1686
- z(o.innerType, n, r);
1687
- const i = n.seen.get(e);
1688
- i.ref = o.innerType, t.default = JSON.parse(JSON.stringify(o.defaultValue));
1689
- }, At = (e, n, t, r) => {
1690
- const o = e._zod.def;
1691
- z(o.innerType, n, r);
1692
- const i = n.seen.get(e);
1693
- i.ref = o.innerType, n.io === "input" && (t._prefault = JSON.parse(JSON.stringify(o.defaultValue)));
1694
- }, Mt = (e, n, t, r) => {
1695
- const o = e._zod.def;
1696
- z(o.innerType, n, r);
1697
- const i = n.seen.get(e);
1698
- i.ref = o.innerType;
1699
- let s;
1700
- try {
1701
- s = o.catchValue(void 0);
1702
- } catch {
1703
- throw new Error("Dynamic catch values are not supported in JSON Schema");
1704
- }
1705
- t.default = s;
1706
- }, Rt = (e, n, t, r) => {
1707
- const o = e._zod.def, i = n.io === "input" ? o.in._zod.def.type === "transform" ? o.out : o.in : o.out;
1708
- z(i, n, r);
1709
- const s = n.seen.get(e);
1710
- s.ref = i;
1711
- }, Dt = (e, n, t, r) => {
1712
- const o = e._zod.def;
1713
- z(o.innerType, n, r);
1714
- const i = n.seen.get(e);
1715
- i.ref = o.innerType, t.readOnly = !0;
1716
- }, Ke = (e, n, t, r) => {
1717
- const o = e._zod.def;
1718
- z(o.innerType, n, r);
1719
- const i = n.seen.get(e);
1720
- i.ref = o.innerType;
1721
- }, Ct = (e, n) => {
1722
- Me.init(e, n), e.name = "ZodError", Object.defineProperties(e, {
1723
- format: {
1724
- value: (t) => yn(e, t)
1725
- // enumerable: false,
1726
- },
1727
- flatten: {
1728
- value: (t) => gn(e, t)
1729
- // enumerable: false,
1730
- },
1731
- addIssue: {
1732
- value: (t) => {
1733
- e.issues.push(t), e.message = JSON.stringify(e.issues, W, 2);
1734
- }
1735
- // enumerable: false,
1736
- },
1737
- addIssues: {
1738
- value: (t) => {
1739
- e.issues.push(...t), e.message = JSON.stringify(e.issues, W, 2);
1740
- }
1741
- // enumerable: false,
1742
- },
1743
- isEmpty: {
1744
- get() {
1745
- return e.issues.length === 0;
1746
- }
1747
- // enumerable: false,
1748
- }
1749
- });
1750
- }, O = l("ZodError", Ct, {
1751
- Parent: Error
1752
- }), Vt = /* @__PURE__ */ oe(O), Jt = /* @__PURE__ */ se(O), Ut = /* @__PURE__ */ K(O), xt = /* @__PURE__ */ Y(O), Ft = /* @__PURE__ */ bn(O), Ht = /* @__PURE__ */ wn(O), Lt = /* @__PURE__ */ kn(O), Gt = /* @__PURE__ */ On(O), Kt = /* @__PURE__ */ Sn(O), Yt = /* @__PURE__ */ Pn(O), Bt = /* @__PURE__ */ Tn(O), qt = /* @__PURE__ */ $n(O), y = /* @__PURE__ */ l("ZodType", (e, n) => (g.init(e, n), Object.assign(e["~standard"], {
1753
- jsonSchema: {
1754
- input: G(e, "input"),
1755
- output: G(e, "output")
1756
- }
1757
- }), e.toJSONSchema = vt(e, {}), e.def = n, e.type = n.type, Object.defineProperty(e, "_def", { value: n }), e.check = (...t) => e.clone(N(n, {
1758
- checks: [
1759
- ...n.checks ?? [],
1760
- ...t.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
1761
- ]
1762
- }), {
1763
- parent: !0
1764
- }), e.with = e.check, e.clone = (t, r) => E(e, t, r), e.brand = () => e, e.register = ((t, r) => (t.add(e, r), e)), e.parse = (t, r) => Vt(e, t, r, { callee: e.parse }), e.safeParse = (t, r) => Ut(e, t, r), e.parseAsync = async (t, r) => Jt(e, t, r, { callee: e.parseAsync }), e.safeParseAsync = async (t, r) => xt(e, t, r), e.spa = e.safeParseAsync, e.encode = (t, r) => Ft(e, t, r), e.decode = (t, r) => Ht(e, t, r), e.encodeAsync = async (t, r) => Lt(e, t, r), e.decodeAsync = async (t, r) => Gt(e, t, r), e.safeEncode = (t, r) => Kt(e, t, r), e.safeDecode = (t, r) => Yt(e, t, r), e.safeEncodeAsync = async (t, r) => Bt(e, t, r), e.safeDecodeAsync = async (t, r) => qt(e, t, r), e.refine = (t, r) => e.check(Pr(t, r)), e.superRefine = (t) => e.check(Tr(t)), e.overwrite = (t) => e.check(/* @__PURE__ */ ht(t)), e.optional = () => Se(e), e.exactOptional = () => pr(e), e.nullable = () => Pe(e), e.nullish = () => Se(Pe(e)), e.nonoptional = (t) => vr(e, t), e.array = () => or(e), e.or = (t) => ur([e, t]), e.and = (t) => ar(e, t), e.transform = (t) => Te(e, fr(t)), e.default = (t) => _r(e, t), e.prefault = (t) => yr(e, t), e.catch = (t) => br(e, t), e.pipe = (t) => Te(e, t), e.readonly = () => Or(e), e.describe = (t) => {
1765
- const r = e.clone();
1766
- return R.add(r, { description: t }), r;
1767
- }, Object.defineProperty(e, "description", {
1768
- get() {
1769
- return R.get(e)?.description;
1770
- },
1771
- configurable: !0
1772
- }), e.meta = (...t) => {
1773
- if (t.length === 0)
1774
- return R.get(e);
1775
- const r = e.clone();
1776
- return R.add(r, t[0]), r;
1777
- }, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e.apply = (t) => t(e), e)), Ye = /* @__PURE__ */ l("ZodNumber", (e, n) => {
1778
- Je.init(e, n), y.init(e, n), e._zod.processJSONSchema = (r, o, i) => zt(e, r, o), e.gt = (r, o) => e.check(/* @__PURE__ */ ve(r, o)), e.gte = (r, o) => e.check(/* @__PURE__ */ F(r, o)), e.min = (r, o) => e.check(/* @__PURE__ */ F(r, o)), e.lt = (r, o) => e.check(/* @__PURE__ */ ye(r, o)), e.lte = (r, o) => e.check(/* @__PURE__ */ x(r, o)), e.max = (r, o) => e.check(/* @__PURE__ */ x(r, o)), e.int = (r) => e.check(ke(r)), e.safe = (r) => e.check(ke(r)), e.positive = (r) => e.check(/* @__PURE__ */ ve(0, r)), e.nonnegative = (r) => e.check(/* @__PURE__ */ F(0, r)), e.negative = (r) => e.check(/* @__PURE__ */ ye(0, r)), e.nonpositive = (r) => e.check(/* @__PURE__ */ x(0, r)), e.multipleOf = (r, o) => e.check(/* @__PURE__ */ ze(r, o)), e.step = (r, o) => e.check(/* @__PURE__ */ ze(r, o)), e.finite = () => e;
1779
- const t = e._zod.bag;
1780
- e.minValue = Math.max(t.minimum ?? Number.NEGATIVE_INFINITY, t.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(t.maximum ?? Number.POSITIVE_INFINITY, t.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (t.format ?? "").includes("int") || Number.isSafeInteger(t.multipleOf ?? 0.5), e.isFinite = !0, e.format = t.format ?? null;
1781
- });
1782
- function we(e) {
1783
- return /* @__PURE__ */ ut(Ye, e);
1784
- }
1785
- const Wt = /* @__PURE__ */ l("ZodNumberFormat", (e, n) => {
1786
- Vn.init(e, n), Ye.init(e, n);
1787
- });
1788
- function ke(e) {
1789
- return /* @__PURE__ */ ct(Wt, e);
1790
- }
1791
- const Xt = /* @__PURE__ */ l("ZodUnknown", (e, n) => {
1792
- Jn.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => wt();
1793
- });
1794
- function Oe() {
1795
- return /* @__PURE__ */ at(Xt);
1796
- }
1797
- const Qt = /* @__PURE__ */ l("ZodNever", (e, n) => {
1798
- Un.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => bt(e, t, r);
1799
- });
1800
- function er(e) {
1801
- return /* @__PURE__ */ lt(Qt, e);
1802
- }
1803
- const nr = /* @__PURE__ */ l("ZodDate", (e, n) => {
1804
- xn.init(e, n), y.init(e, n), e._zod.processJSONSchema = (r, o, i) => kt(e, r), e.min = (r, o) => e.check(/* @__PURE__ */ F(r, o)), e.max = (r, o) => e.check(/* @__PURE__ */ x(r, o));
1805
- const t = e._zod.bag;
1806
- e.minDate = t.minimum ? new Date(t.minimum) : null, e.maxDate = t.maximum ? new Date(t.maximum) : null;
1807
- });
1808
- function tr(e) {
1809
- return /* @__PURE__ */ ft(nr, e);
1810
- }
1811
- const rr = /* @__PURE__ */ l("ZodArray", (e, n) => {
1812
- Fn.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => Tt(e, t, r, o), e.element = n.element, e.min = (t, r) => e.check(/* @__PURE__ */ be(t, r)), e.nonempty = (t) => e.check(/* @__PURE__ */ be(1, t)), e.max = (t, r) => e.check(/* @__PURE__ */ dt(t, r)), e.length = (t, r) => e.check(/* @__PURE__ */ pt(t, r)), e.unwrap = () => e.element;
1813
- });
1814
- function or(e, n) {
1815
- return /* @__PURE__ */ mt(rr, e, n);
1816
- }
1817
- const sr = /* @__PURE__ */ l("ZodObject", (e, n) => {
1818
- Ln.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => $t(e, t, r, o), m(e, "shape", () => n.shape), e.keyof = () => B(Object.keys(e._zod.def.shape)), e.catchall = (t) => e.clone({ ...e._zod.def, catchall: t }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: Oe() }), e.loose = () => e.clone({ ...e._zod.def, catchall: Oe() }), e.strict = () => e.clone({ ...e._zod.def, catchall: er() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (t) => dn(e, t), e.safeExtend = (t) => pn(e, t), e.merge = (t) => hn(e, t), e.pick = (t) => ln(e, t), e.omit = (t) => fn(e, t), e.partial = (...t) => mn(qe, e, t[0]), e.required = (...t) => _n(We, e, t[0]);
1819
- });
1820
- function Be(e, n) {
1821
- const t = {
1822
- type: "object",
1823
- shape: e ?? {},
1824
- ..._(n)
1825
- };
1826
- return new sr(t);
1827
- }
1828
- const ir = /* @__PURE__ */ l("ZodUnion", (e, n) => {
1829
- Gn.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => Nt(e, t, r, o), e.options = n.options;
1830
- });
1831
- function ur(e, n) {
1832
- return new ir({
1833
- type: "union",
1834
- options: e,
1835
- ..._(n)
1836
- });
1837
- }
1838
- const cr = /* @__PURE__ */ l("ZodIntersection", (e, n) => {
1839
- Kn.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => Et(e, t, r, o);
1840
- });
1841
- function ar(e, n) {
1842
- return new cr({
1843
- type: "intersection",
1844
- left: e,
1845
- right: n
1846
- });
1847
- }
1848
- const Q = /* @__PURE__ */ l("ZodEnum", (e, n) => {
1849
- Yn.init(e, n), y.init(e, n), e._zod.processJSONSchema = (r, o, i) => Ot(e, r, o), e.enum = n.entries, e.options = Object.values(n.entries);
1850
- const t = new Set(Object.keys(n.entries));
1851
- e.extract = (r, o) => {
1852
- const i = {};
1853
- for (const s of r)
1854
- if (t.has(s))
1855
- i[s] = n.entries[s];
1856
- else
1857
- throw new Error(`Key ${s} not found in enum`);
1858
- return new Q({
1859
- ...n,
1860
- checks: [],
1861
- ..._(o),
1862
- entries: i
1863
- });
1864
- }, e.exclude = (r, o) => {
1865
- const i = { ...n.entries };
1866
- for (const s of r)
1867
- if (t.has(s))
1868
- delete i[s];
1869
- else
1870
- throw new Error(`Key ${s} not found in enum`);
1871
- return new Q({
1872
- ...n,
1873
- checks: [],
1874
- ..._(o),
1875
- entries: i
1876
- });
1877
- };
1878
- });
1879
- function B(e, n) {
1880
- const t = Array.isArray(e) ? Object.fromEntries(e.map((r) => [r, r])) : e;
1881
- return new Q({
1882
- type: "enum",
1883
- entries: t,
1884
- ..._(n)
1885
- });
1886
- }
1887
- const lr = /* @__PURE__ */ l("ZodTransform", (e, n) => {
1888
- Bn.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => Pt(e, t), e._zod.parse = (t, r) => {
1889
- if (r.direction === "backward")
1890
- throw new $e(e.constructor.name);
1891
- t.addIssue = (i) => {
1892
- if (typeof i == "string")
1893
- t.issues.push(C(i, t.value, n));
1894
- else {
1895
- const s = i;
1896
- s.fatal && (s.continue = !1), s.code ?? (s.code = "custom"), s.input ?? (s.input = t.value), s.inst ?? (s.inst = e), t.issues.push(C(s));
1897
- }
1898
- };
1899
- const o = n.transform(t.value, t);
1900
- return o instanceof Promise ? o.then((i) => (t.value = i, t)) : (t.value = o, t);
1901
- };
1902
- });
1903
- function fr(e) {
1904
- return new lr({
1905
- type: "transform",
1906
- transform: e
1907
- });
1908
- }
1909
- const qe = /* @__PURE__ */ l("ZodOptional", (e, n) => {
1910
- Fe.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => Ke(e, t, r, o), e.unwrap = () => e._zod.def.innerType;
1911
- });
1912
- function Se(e) {
1913
- return new qe({
1914
- type: "optional",
1915
- innerType: e
1916
- });
1917
- }
1918
- const dr = /* @__PURE__ */ l("ZodExactOptional", (e, n) => {
1919
- qn.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => Ke(e, t, r, o), e.unwrap = () => e._zod.def.innerType;
1920
- });
1921
- function pr(e) {
1922
- return new dr({
1923
- type: "optional",
1924
- innerType: e
1925
- });
1926
- }
1927
- const hr = /* @__PURE__ */ l("ZodNullable", (e, n) => {
1928
- Wn.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => Zt(e, t, r, o), e.unwrap = () => e._zod.def.innerType;
1929
- });
1930
- function Pe(e) {
1931
- return new hr({
1932
- type: "nullable",
1933
- innerType: e
1934
- });
1935
- }
1936
- const mr = /* @__PURE__ */ l("ZodDefault", (e, n) => {
1937
- Xn.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => jt(e, t, r, o), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
1938
- });
1939
- function _r(e, n) {
1940
- return new mr({
1941
- type: "default",
1942
- innerType: e,
1943
- get defaultValue() {
1944
- return typeof n == "function" ? n() : Ie(n);
1945
- }
1946
- });
1947
- }
1948
- const gr = /* @__PURE__ */ l("ZodPrefault", (e, n) => {
1949
- Qn.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => At(e, t, r, o), e.unwrap = () => e._zod.def.innerType;
1950
- });
1951
- function yr(e, n) {
1952
- return new gr({
1953
- type: "prefault",
1954
- innerType: e,
1955
- get defaultValue() {
1956
- return typeof n == "function" ? n() : Ie(n);
1957
- }
1958
- });
1959
- }
1960
- const We = /* @__PURE__ */ l("ZodNonOptional", (e, n) => {
1961
- et.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => It(e, t, r, o), e.unwrap = () => e._zod.def.innerType;
1962
- });
1963
- function vr(e, n) {
1964
- return new We({
1965
- type: "nonoptional",
1966
- innerType: e,
1967
- ..._(n)
1968
- });
1969
- }
1970
- const zr = /* @__PURE__ */ l("ZodCatch", (e, n) => {
1971
- nt.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => Mt(e, t, r, o), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
1972
- });
1973
- function br(e, n) {
1974
- return new zr({
1975
- type: "catch",
1976
- innerType: e,
1977
- catchValue: typeof n == "function" ? n : () => n
1978
- });
1979
- }
1980
- const wr = /* @__PURE__ */ l("ZodPipe", (e, n) => {
1981
- tt.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => Rt(e, t, r, o), e.in = n.in, e.out = n.out;
1982
- });
1983
- function Te(e, n) {
1984
- return new wr({
1985
- type: "pipe",
1986
- in: e,
1987
- out: n
1988
- // ...util.normalizeParams(params),
1989
- });
1990
- }
1991
- const kr = /* @__PURE__ */ l("ZodReadonly", (e, n) => {
1992
- rt.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => Dt(e, t, r, o), e.unwrap = () => e._zod.def.innerType;
1993
- });
1994
- function Or(e) {
1995
- return new kr({
1996
- type: "readonly",
1997
- innerType: e
1998
- });
1999
- }
2000
- const Sr = /* @__PURE__ */ l("ZodCustom", (e, n) => {
2001
- ot.init(e, n), y.init(e, n), e._zod.processJSONSchema = (t, r, o) => St(e, t);
2002
- });
2003
- function Pr(e, n = {}) {
2004
- return /* @__PURE__ */ _t(Sr, e, n);
2005
- }
2006
- function Tr(e) {
2007
- return /* @__PURE__ */ gt(e);
2008
- }
2009
- const Hr = B(["minutes", "hours", "12hours"]), $r = B(["AM", "PM"]), Nr = B(["12", "24"]), Lr = Be({
2010
- hours: we().min(0).max(23),
2011
- minutes: we().min(0).max(59)
2012
- }), Gr = Be({
2013
- date: tr().optional(),
2014
- hourFormat: Nr.default("12"),
2015
- period: $r.optional()
2016
- }), Er = {
2017
- hours12: "Hours (1-12)",
2018
- hours24: "Hours",
2019
- minutes: "Minutes",
2020
- selectPeriodTemplate: "Select {am} or {pm}",
2021
- timePicker12Hour: "Time picker (12-hour format)",
2022
- timePicker24Hour: "Time picker (24-hour format)",
2023
- timeValue: "Time value"
2024
- }, Kr = (e, n) => n.replace("{am}", e.am).replace("{pm}", e.pm), Yr = {
2025
- HOURS: "hours",
2026
- HOURS_12: "12hours",
2027
- MINUTES: "minutes"
2028
- }, $ = {
2029
- HOURS_24: { min: 0, max: 23 },
2030
- HOURS_12: { min: 1, max: 12 },
2031
- MINUTES: { min: 0, max: 59 }
2032
- }, Br = (e) => {
2033
- if (e) return e;
2034
- try {
2035
- return Intl.DateTimeFormat().resolvedOptions().locale;
2036
- } catch {
2037
- return typeof navigator < "u" && navigator.language ? navigator.language : "en-US";
2038
- }
2039
- }, qr = (e) => {
2040
- try {
2041
- return new Intl.DateTimeFormat(e, {
2042
- hour: "numeric",
2043
- hour12: void 0
2044
- // Let the locale decide
2045
- }).formatToParts(new Date(2e3, 0, 1, 13, 0, 0)).some((o) => o.type === "dayPeriod") ? "12" : "24";
2046
- } catch {
2047
- return "12";
2048
- }
2049
- }, Wr = (e) => {
2050
- try {
2051
- const n = new Intl.DateTimeFormat(e, {
2052
- hour: "numeric",
2053
- hour12: !0
2054
- }), r = n.formatToParts(new Date(2e3, 0, 1, 0, 0, 0)).find((s) => s.type === "dayPeriod"), i = n.formatToParts(new Date(2e3, 0, 1, 12, 0, 0)).find((s) => s.type === "dayPeriod");
2055
- return {
2056
- am: r?.value ?? "AM",
2057
- pm: i?.value ?? "PM"
2058
- };
2059
- } catch {
2060
- return { am: "AM", pm: "PM" };
2061
- }
2062
- }, Xr = (e, n) => e === "AM" ? n.am : n.pm, Qr = (e, n) => {
2063
- try {
2064
- return new Intl.NumberFormat(n, {
2065
- minimumIntegerDigits: 2,
2066
- useGrouping: !1
2067
- }).format(e);
2068
- } catch {
2069
- return e.toString().padStart(2, "0");
2070
- }
2071
- }, Zr = (e) => /^(0[0-9]|1[0-9]|2[0-3])$/.test(e), Ir = (e) => /^(0[1-9]|1[0-2])$/.test(e), jr = (e) => /^[0-5][0-9]$/.test(e), q = (e, { max: n, min: t = 0, loop: r = !1 }) => {
2072
- let o = parseInt(e, 10);
2073
- return isNaN(o) ? t.toString().padStart(2, "0") : (r ? o > n ? o = t : o < t && (o = n) : o = Math.min(Math.max(o, t), n), o.toString().padStart(2, "0"));
2074
- }, Xe = (e) => Zr(e) ? e : q(e, $.HOURS_24), Ar = (e) => Ir(e) ? e : q(e, $.HOURS_12), Qe = (e) => jr(e) ? e : q(e, $.MINUTES), ie = (e, { min: n, max: t, step: r }) => {
2075
- const o = parseInt(e, 10);
2076
- return isNaN(o) ? n.toString().padStart(2, "0") : q(String(o + r), { min: n, max: t, loop: !0 });
2077
- }, Mr = (e, n) => ie(e, { ...$.HOURS_24, step: n }), Rr = (e, n) => ie(e, { ...$.HOURS_12, step: n }), Dr = (e, n) => ie(e, { ...$.MINUTES, step: n }), Cr = (e, n) => {
2078
- const t = new Date(e.getTime()), r = Qe(n);
2079
- return t.setMinutes(parseInt(r, 10)), t;
2080
- }, Vr = (e, n) => {
2081
- const t = new Date(e.getTime()), r = Xe(n);
2082
- return t.setHours(parseInt(r, 10)), t;
2083
- }, Jr = (e, n, t) => {
2084
- const r = new Date(e.getTime()), o = parseInt(Ar(n), 10), i = Ur(o, t);
2085
- return r.setHours(i), r;
2086
- }, eo = (e, n, t, r) => {
2087
- switch (n) {
2088
- case "minutes":
2089
- return Cr(e, t);
2090
- case "hours":
2091
- return Vr(e, t);
2092
- case "12hours":
2093
- return r ? Jr(e, t, r) : new Date(e.getTime());
2094
- default:
2095
- return new Date(e.getTime());
2096
- }
2097
- }, no = (e, n) => {
2098
- switch (n) {
2099
- case "minutes":
2100
- return Qe(String(e.getMinutes()));
2101
- case "hours":
2102
- return Xe(String(e.getHours()));
2103
- case "12hours":
2104
- return xr(e.getHours());
2105
- default:
2106
- return "00";
2107
- }
2108
- }, to = (e, n, t) => {
2109
- switch (n) {
2110
- case "minutes":
2111
- return Dr(t, e);
2112
- case "hours":
2113
- return Mr(t, e);
2114
- case "12hours":
2115
- return Rr(t, e);
2116
- default:
2117
- return "00";
2118
- }
2119
- }, Ur = (e, n) => n === "PM" ? e === 12 ? 12 : e + 12 : e === 12 ? 0 : e, xr = (e) => e === 0 || e === 12 ? "12" : (e % 12).toString().padStart(2, "0"), ro = (e) => e >= 12 ? "PM" : "AM", oo = (e, n) => {
2120
- switch (n) {
2121
- case "minutes":
2122
- return e.getMinutes();
2123
- case "hours":
2124
- return e.getHours();
2125
- case "12hours": {
2126
- const t = e.getHours();
2127
- return t === 0 ? 12 : t > 12 ? t - 12 : t;
2128
- }
2129
- default:
2130
- return 0;
2131
- }
2132
- }, so = (e) => {
2133
- switch (e) {
2134
- case "minutes":
2135
- return $.MINUTES;
2136
- case "hours":
2137
- return $.HOURS_24;
2138
- case "12hours":
2139
- return $.HOURS_12;
2140
- default:
2141
- return { min: 0, max: 0 };
2142
- }
2143
- }, io = (e, n = Er) => {
2144
- switch (e) {
2145
- case "minutes":
2146
- return n.minutes;
2147
- case "hours":
2148
- return n.hours24;
2149
- case "12hours":
2150
- return n.hours12;
2151
- default:
2152
- return n.timeValue;
2153
- }
2154
- };
2155
- export {
2156
- Er as DEFAULT_TRANSLATIONS,
2157
- Gr as DateTimeConfigSchema,
2158
- Nr as HourFormatSchema,
2159
- Yr as PICKER_TYPES,
2160
- $r as PeriodSchema,
2161
- $ as TIME_BOUNDS,
2162
- Hr as TimePickerTypeSchema,
2163
- Lr as TimeValueSchema,
2164
- Ur as convert12HourTo24Hour,
2165
- qr as detectHourFormat,
2166
- xr as display12HourValue,
2167
- Kr as formatSelectPeriodLabel,
2168
- Qr as formatTimeNumber,
2169
- io as getAriaLabel,
2170
- so as getAriaValueMinMax,
2171
- oo as getAriaValueNow,
2172
- to as getArrowByType,
2173
- no as getDateByType,
2174
- Xr as getLocalizedPeriodLabel,
2175
- Wr as getLocalizedPeriodLabels,
2176
- ro as getPeriodFromHours,
2177
- Br as getResolvedLocale,
2178
- Ar as getValid12Hour,
2179
- Rr as getValidArrow12Hour,
2180
- Mr as getValidArrowHour,
2181
- Dr as getValidArrowMinute,
2182
- ie as getValidArrowNumber,
2183
- Xe as getValidHour,
2184
- Qe as getValidMinute,
2185
- q as getValidNumber,
2186
- Ir as isValid12Hour,
2187
- Zr as isValidHour,
2188
- jr as isValidMinute,
2189
- Jr as set12Hours,
2190
- eo as setDateByType,
2191
- Vr as setHours,
2192
- Cr as setMinutes
2193
- };
1
+ import { A as e, C as t, D as n, E as r, F as i, I as a, L as o, M as s, N as c, O as l, P as u, S as d, T as f, _ as p, a as m, b as h, c as g, d as _, f as v, g as y, h as b, i as x, j as S, k as C, l as w, m as T, n as E, o as D, p as O, r as k, s as A, t as j, u as M, v as N, w as P, x as F, y as I } from "../DateTimeUtils-DVvG6H-p.js";
2
+ export { j as DEFAULT_TRANSLATIONS, E as DateTimeConfigSchema, k as HourFormatSchema, x as PICKER_TYPES, m as PeriodSchema, D as TIME_BOUNDS, A as TimePickerTypeSchema, g as TimeValueSchema, w as convert12HourTo24Hour, M as detectHourFormat, _ as display12HourValue, v as formatSelectPeriodLabel, O as formatTimeNumber, T as getAriaLabel, b as getAriaValueMinMax, y as getAriaValueNow, p as getArrowByType, N as getDateByType, I as getLocalizedPeriodLabel, h as getLocalizedPeriodLabels, F as getPeriodFromHours, d as getResolvedLocale, t as getValid12Hour, P as getValidArrow12Hour, f as getValidArrowHour, r as getValidArrowMinute, n as getValidArrowNumber, l as getValidHour, C as getValidMinute, e as getValidNumber, S as isValid12Hour, s as isValidHour, c as isValidMinute, u as set12Hours, i as setDateByType, a as setHours, o as setMinutes };