@lssm/lib.ui-kit 1.10.0 → 1.11.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 (119) hide show
  1. package/README.md +11 -0
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/dist/ui/accordion.d.ts +5 -5
  4. package/dist/ui/alert-dialog.d.ts +9 -9
  5. package/dist/ui/alert.d.ts +6 -6
  6. package/dist/ui/alert.d.ts.map +1 -1
  7. package/dist/ui/avatar.d.ts +4 -4
  8. package/dist/ui/badge.d.ts +5 -5
  9. package/dist/ui/breadcrumb.d.ts +8 -8
  10. package/dist/ui/button.d.ts +7 -7
  11. package/dist/ui/button.d.ts.map +1 -1
  12. package/dist/ui/card.d.ts +7 -7
  13. package/dist/ui/collapsible.d.ts +8 -8
  14. package/dist/ui/collapsible.d.ts.map +1 -1
  15. package/dist/ui/context-menu.d.ts +16 -16
  16. package/dist/ui/date-picker.d.ts +2 -2
  17. package/dist/ui/date-range-picker.d.ts +2 -2
  18. package/dist/ui/datetime-picker.d.ts +2 -2
  19. package/dist/ui/dialog.d.ts +10 -10
  20. package/dist/ui/dialog.d.ts.map +1 -1
  21. package/dist/ui/dropdown-menu.d.ts +16 -16
  22. package/dist/ui/empty-state.d.ts +4 -4
  23. package/dist/ui/empty-state.d.ts.map +1 -1
  24. package/dist/ui/empty.d.ts +9 -9
  25. package/dist/ui/fab.d.ts +3 -3
  26. package/dist/ui/field.d.ts +13 -13
  27. package/dist/ui/form.d.ts +7 -7
  28. package/dist/ui/form.js +2 -2
  29. package/dist/ui/hover-card.d.ts +6 -6
  30. package/dist/ui/hover-card.d.ts.map +1 -1
  31. package/dist/ui/input.d.ts +2 -2
  32. package/dist/ui/input.d.ts.map +1 -1
  33. package/dist/ui/label.d.ts +2 -2
  34. package/dist/ui/label.d.ts.map +1 -1
  35. package/dist/ui/link.d.ts +2 -2
  36. package/dist/ui/link.d.ts.map +1 -1
  37. package/dist/ui/loading-button.d.ts +2 -2
  38. package/dist/ui/loading-button.d.ts.map +1 -1
  39. package/dist/ui/loading-overlay.d.ts +2 -2
  40. package/dist/ui/loading-screen.d.ts +2 -2
  41. package/dist/ui/marketing/FeatureGrid.d.ts +2 -2
  42. package/dist/ui/marketing/Hero.d.ts +2 -2
  43. package/dist/ui/marketing/PricingTable.d.ts +2 -2
  44. package/dist/ui/menubar.d.ts +17 -17
  45. package/dist/ui/menubar.d.ts.map +1 -1
  46. package/dist/ui/navigation-menu.d.ts +12 -12
  47. package/dist/ui/organisms/ErrorBoundary/ErrorBoundary.d.ts +2 -2
  48. package/dist/ui/organisms/ErrorBoundary/ErrorBoundary.d.ts.map +1 -1
  49. package/dist/ui/organisms/ListPage/ListPage.d.ts +2 -2
  50. package/dist/ui/organisms/ListPage/ListPage.d.ts.map +1 -1
  51. package/dist/ui/page-header.d.ts +5 -5
  52. package/dist/ui/page-header.d.ts.map +1 -1
  53. package/dist/ui/password-strength.d.ts +2 -2
  54. package/dist/ui/popover.d.ts +6 -6
  55. package/dist/ui/progress.d.ts +2 -2
  56. package/dist/ui/progress.d.ts.map +1 -1
  57. package/dist/ui/radio-group.d.ts +3 -3
  58. package/dist/ui/radio-group.d.ts.map +1 -1
  59. package/dist/ui/select.d.ts +13 -13
  60. package/dist/ui/select.d.ts.map +1 -1
  61. package/dist/ui/separator.d.ts +2 -2
  62. package/dist/ui/separator.d.ts.map +1 -1
  63. package/dist/ui/skeleton.d.ts +2 -2
  64. package/dist/ui/stack.d.ts +17 -17
  65. package/dist/ui/stack.d.ts.map +1 -1
  66. package/dist/ui/stepper.d.ts +4 -4
  67. package/dist/ui/stepper.d.ts.map +1 -1
  68. package/dist/ui/switch.d.ts +2 -2
  69. package/dist/ui/table.d.ts +8 -8
  70. package/dist/ui/tabs.d.ts +11 -11
  71. package/dist/ui/text.d.ts +2 -2
  72. package/dist/ui/text.d.ts.map +1 -1
  73. package/dist/ui/time-picker.d.ts +2 -2
  74. package/dist/ui/toggle-group.d.ts +4 -4
  75. package/dist/ui/toggle-group.d.ts.map +1 -1
  76. package/dist/ui/toggle.d.ts +6 -6
  77. package/dist/ui/toggle.d.ts.map +1 -1
  78. package/dist/ui/tooltip.d.ts +6 -6
  79. package/dist/ui/tooltip.d.ts.map +1 -1
  80. package/dist/ui/typography.d.ts +12 -12
  81. package/dist/ui/typography.d.ts.map +1 -1
  82. package/dist/ui/useColorScheme.d.ts +2 -2
  83. package/dist/ui/usecases/UseCaseCard.d.ts +2 -2
  84. package/dist/ui/usecases/UserStoryCard.d.ts +2 -2
  85. package/package.json +5 -3
  86. package/dist/node_modules/@hookform/resolvers/dist/resolvers.js +0 -29
  87. package/dist/node_modules/@hookform/resolvers/dist/resolvers.js.map +0 -1
  88. package/dist/node_modules/@hookform/resolvers/zod/dist/zod.js +0 -61
  89. package/dist/node_modules/@hookform/resolvers/zod/dist/zod.js.map +0 -1
  90. package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -2073
  91. package/dist/node_modules/react-hook-form/dist/index.esm.js.map +0 -1
  92. package/dist/node_modules/zod/v4/classic/errors.js +0 -30
  93. package/dist/node_modules/zod/v4/classic/errors.js.map +0 -1
  94. package/dist/node_modules/zod/v4/classic/iso.js +0 -38
  95. package/dist/node_modules/zod/v4/classic/iso.js.map +0 -1
  96. package/dist/node_modules/zod/v4/classic/parse.js +0 -20
  97. package/dist/node_modules/zod/v4/classic/parse.js.map +0 -1
  98. package/dist/node_modules/zod/v4/classic/schemas.js +0 -395
  99. package/dist/node_modules/zod/v4/classic/schemas.js.map +0 -1
  100. package/dist/node_modules/zod/v4/core/api.js +0 -377
  101. package/dist/node_modules/zod/v4/core/api.js.map +0 -1
  102. package/dist/node_modules/zod/v4/core/checks.js +0 -226
  103. package/dist/node_modules/zod/v4/core/checks.js.map +0 -1
  104. package/dist/node_modules/zod/v4/core/core.js +0 -56
  105. package/dist/node_modules/zod/v4/core/core.js.map +0 -1
  106. package/dist/node_modules/zod/v4/core/errors.js +0 -63
  107. package/dist/node_modules/zod/v4/core/errors.js.map +0 -1
  108. package/dist/node_modules/zod/v4/core/parse.js +0 -110
  109. package/dist/node_modules/zod/v4/core/parse.js.map +0 -1
  110. package/dist/node_modules/zod/v4/core/regexes.js +0 -59
  111. package/dist/node_modules/zod/v4/core/regexes.js.map +0 -1
  112. package/dist/node_modules/zod/v4/core/registries.js +0 -51
  113. package/dist/node_modules/zod/v4/core/registries.js.map +0 -1
  114. package/dist/node_modules/zod/v4/core/schemas.js +0 -755
  115. package/dist/node_modules/zod/v4/core/schemas.js.map +0 -1
  116. package/dist/node_modules/zod/v4/core/util.js +0 -152
  117. package/dist/node_modules/zod/v4/core/util.js.map +0 -1
  118. package/dist/node_modules/zod/v4/core/versions.js +0 -10
  119. package/dist/node_modules/zod/v4/core/versions.js.map +0 -1
@@ -1,755 +0,0 @@
1
- import { $ZodAsyncError, $ZodEncodeError, $constructor, config } from "./core.js";
2
- import { aborted, cleanRegex, clone, defineLazy, finalizeIssue, isPlainObject, issue, prefixIssues } from "./util.js";
3
- import { safeParse, safeParseAsync } from "./parse.js";
4
- import { base64, base64url, cidrv4, cidrv6, cuid, cuid2, date, datetime, duration, e164, email, emoji, guid, hostname, ipv4, ipv6, ksuid, nanoid, string, time, ulid, uuid, xid } from "./regexes.js";
5
- import { $ZodCheck, $ZodCheckStringFormat } from "./checks.js";
6
- import { version } from "./versions.js";
7
-
8
- //#region ../../../node_modules/zod/v4/core/schemas.js
9
- const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
10
- var _a;
11
- inst ?? (inst = {});
12
- inst._zod.def = def;
13
- inst._zod.bag = inst._zod.bag || {};
14
- inst._zod.version = version;
15
- const checks = [...inst._zod.def.checks ?? []];
16
- if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
17
- for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
18
- if (checks.length === 0) {
19
- (_a = inst._zod).deferred ?? (_a.deferred = []);
20
- inst._zod.deferred?.push(() => {
21
- inst._zod.run = inst._zod.parse;
22
- });
23
- } else {
24
- const runChecks = (payload, checks$1, ctx) => {
25
- let isAborted = aborted(payload);
26
- let asyncResult;
27
- for (const ch of checks$1) {
28
- if (ch._zod.def.when) {
29
- if (!ch._zod.def.when(payload)) continue;
30
- } else if (isAborted) continue;
31
- const currLen = payload.issues.length;
32
- const _ = ch._zod.check(payload);
33
- if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
34
- if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
35
- await _;
36
- if (payload.issues.length === currLen) return;
37
- if (!isAborted) isAborted = aborted(payload, currLen);
38
- });
39
- else {
40
- if (payload.issues.length === currLen) continue;
41
- if (!isAborted) isAborted = aborted(payload, currLen);
42
- }
43
- }
44
- if (asyncResult) return asyncResult.then(() => {
45
- return payload;
46
- });
47
- return payload;
48
- };
49
- const handleCanaryResult = (canary, payload, ctx) => {
50
- if (aborted(canary)) {
51
- canary.aborted = true;
52
- return canary;
53
- }
54
- const checkResult = runChecks(payload, checks, ctx);
55
- if (checkResult instanceof Promise) {
56
- if (ctx.async === false) throw new $ZodAsyncError();
57
- return checkResult.then((checkResult$1) => inst._zod.parse(checkResult$1, ctx));
58
- }
59
- return inst._zod.parse(checkResult, ctx);
60
- };
61
- inst._zod.run = (payload, ctx) => {
62
- if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
63
- if (ctx.direction === "backward") {
64
- const canary = inst._zod.parse({
65
- value: payload.value,
66
- issues: []
67
- }, {
68
- ...ctx,
69
- skipChecks: true
70
- });
71
- if (canary instanceof Promise) return canary.then((canary$1) => {
72
- return handleCanaryResult(canary$1, payload, ctx);
73
- });
74
- return handleCanaryResult(canary, payload, ctx);
75
- }
76
- const result = inst._zod.parse(payload, ctx);
77
- if (result instanceof Promise) {
78
- if (ctx.async === false) throw new $ZodAsyncError();
79
- return result.then((result$1) => runChecks(result$1, checks, ctx));
80
- }
81
- return runChecks(result, checks, ctx);
82
- };
83
- }
84
- inst["~standard"] = {
85
- validate: (value) => {
86
- try {
87
- const r = safeParse(inst, value);
88
- return r.success ? { value: r.data } : { issues: r.error?.issues };
89
- } catch (_) {
90
- return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
91
- }
92
- },
93
- vendor: "zod",
94
- version: 1
95
- };
96
- });
97
- const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
98
- $ZodType.init(inst, def);
99
- inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
100
- inst._zod.parse = (payload, _) => {
101
- if (def.coerce) try {
102
- payload.value = String(payload.value);
103
- } catch (_$1) {}
104
- if (typeof payload.value === "string") return payload;
105
- payload.issues.push({
106
- expected: "string",
107
- code: "invalid_type",
108
- input: payload.value,
109
- inst
110
- });
111
- return payload;
112
- };
113
- });
114
- const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
115
- $ZodCheckStringFormat.init(inst, def);
116
- $ZodString.init(inst, def);
117
- });
118
- const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
119
- def.pattern ?? (def.pattern = guid);
120
- $ZodStringFormat.init(inst, def);
121
- });
122
- const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
123
- if (def.version) {
124
- const v = {
125
- v1: 1,
126
- v2: 2,
127
- v3: 3,
128
- v4: 4,
129
- v5: 5,
130
- v6: 6,
131
- v7: 7,
132
- v8: 8
133
- }[def.version];
134
- if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
135
- def.pattern ?? (def.pattern = uuid(v));
136
- } else def.pattern ?? (def.pattern = uuid());
137
- $ZodStringFormat.init(inst, def);
138
- });
139
- const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
140
- def.pattern ?? (def.pattern = email);
141
- $ZodStringFormat.init(inst, def);
142
- });
143
- const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
144
- $ZodStringFormat.init(inst, def);
145
- inst._zod.check = (payload) => {
146
- try {
147
- const trimmed = payload.value.trim();
148
- const url = new URL(trimmed);
149
- if (def.hostname) {
150
- def.hostname.lastIndex = 0;
151
- if (!def.hostname.test(url.hostname)) payload.issues.push({
152
- code: "invalid_format",
153
- format: "url",
154
- note: "Invalid hostname",
155
- pattern: hostname.source,
156
- input: payload.value,
157
- inst,
158
- continue: !def.abort
159
- });
160
- }
161
- if (def.protocol) {
162
- def.protocol.lastIndex = 0;
163
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
164
- code: "invalid_format",
165
- format: "url",
166
- note: "Invalid protocol",
167
- pattern: def.protocol.source,
168
- input: payload.value,
169
- inst,
170
- continue: !def.abort
171
- });
172
- }
173
- if (def.normalize) payload.value = url.href;
174
- else payload.value = trimmed;
175
- return;
176
- } catch (_) {
177
- payload.issues.push({
178
- code: "invalid_format",
179
- format: "url",
180
- input: payload.value,
181
- inst,
182
- continue: !def.abort
183
- });
184
- }
185
- };
186
- });
187
- const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
188
- def.pattern ?? (def.pattern = emoji());
189
- $ZodStringFormat.init(inst, def);
190
- });
191
- const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
192
- def.pattern ?? (def.pattern = nanoid);
193
- $ZodStringFormat.init(inst, def);
194
- });
195
- const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
196
- def.pattern ?? (def.pattern = cuid);
197
- $ZodStringFormat.init(inst, def);
198
- });
199
- const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
200
- def.pattern ?? (def.pattern = cuid2);
201
- $ZodStringFormat.init(inst, def);
202
- });
203
- const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
204
- def.pattern ?? (def.pattern = ulid);
205
- $ZodStringFormat.init(inst, def);
206
- });
207
- const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
208
- def.pattern ?? (def.pattern = xid);
209
- $ZodStringFormat.init(inst, def);
210
- });
211
- const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
212
- def.pattern ?? (def.pattern = ksuid);
213
- $ZodStringFormat.init(inst, def);
214
- });
215
- const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
216
- def.pattern ?? (def.pattern = datetime(def));
217
- $ZodStringFormat.init(inst, def);
218
- });
219
- const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
220
- def.pattern ?? (def.pattern = date);
221
- $ZodStringFormat.init(inst, def);
222
- });
223
- const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
224
- def.pattern ?? (def.pattern = time(def));
225
- $ZodStringFormat.init(inst, def);
226
- });
227
- const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
228
- def.pattern ?? (def.pattern = duration);
229
- $ZodStringFormat.init(inst, def);
230
- });
231
- const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
232
- def.pattern ?? (def.pattern = ipv4);
233
- $ZodStringFormat.init(inst, def);
234
- inst._zod.onattach.push((inst$1) => {
235
- const bag = inst$1._zod.bag;
236
- bag.format = `ipv4`;
237
- });
238
- });
239
- const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
240
- def.pattern ?? (def.pattern = ipv6);
241
- $ZodStringFormat.init(inst, def);
242
- inst._zod.onattach.push((inst$1) => {
243
- const bag = inst$1._zod.bag;
244
- bag.format = `ipv6`;
245
- });
246
- inst._zod.check = (payload) => {
247
- try {
248
- new URL(`http://[${payload.value}]`);
249
- } catch {
250
- payload.issues.push({
251
- code: "invalid_format",
252
- format: "ipv6",
253
- input: payload.value,
254
- inst,
255
- continue: !def.abort
256
- });
257
- }
258
- };
259
- });
260
- const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
261
- def.pattern ?? (def.pattern = cidrv4);
262
- $ZodStringFormat.init(inst, def);
263
- });
264
- const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
265
- def.pattern ?? (def.pattern = cidrv6);
266
- $ZodStringFormat.init(inst, def);
267
- inst._zod.check = (payload) => {
268
- const parts = payload.value.split("/");
269
- try {
270
- if (parts.length !== 2) throw new Error();
271
- const [address, prefix] = parts;
272
- if (!prefix) throw new Error();
273
- const prefixNum = Number(prefix);
274
- if (`${prefixNum}` !== prefix) throw new Error();
275
- if (prefixNum < 0 || prefixNum > 128) throw new Error();
276
- new URL(`http://[${address}]`);
277
- } catch {
278
- payload.issues.push({
279
- code: "invalid_format",
280
- format: "cidrv6",
281
- input: payload.value,
282
- inst,
283
- continue: !def.abort
284
- });
285
- }
286
- };
287
- });
288
- function isValidBase64(data) {
289
- if (data === "") return true;
290
- if (data.length % 4 !== 0) return false;
291
- try {
292
- atob(data);
293
- return true;
294
- } catch {
295
- return false;
296
- }
297
- }
298
- const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
299
- def.pattern ?? (def.pattern = base64);
300
- $ZodStringFormat.init(inst, def);
301
- inst._zod.onattach.push((inst$1) => {
302
- inst$1._zod.bag.contentEncoding = "base64";
303
- });
304
- inst._zod.check = (payload) => {
305
- if (isValidBase64(payload.value)) return;
306
- payload.issues.push({
307
- code: "invalid_format",
308
- format: "base64",
309
- input: payload.value,
310
- inst,
311
- continue: !def.abort
312
- });
313
- };
314
- });
315
- function isValidBase64URL(data) {
316
- if (!base64url.test(data)) return false;
317
- const base64$1 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
318
- return isValidBase64(base64$1.padEnd(Math.ceil(base64$1.length / 4) * 4, "="));
319
- }
320
- const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
321
- def.pattern ?? (def.pattern = base64url);
322
- $ZodStringFormat.init(inst, def);
323
- inst._zod.onattach.push((inst$1) => {
324
- inst$1._zod.bag.contentEncoding = "base64url";
325
- });
326
- inst._zod.check = (payload) => {
327
- if (isValidBase64URL(payload.value)) return;
328
- payload.issues.push({
329
- code: "invalid_format",
330
- format: "base64url",
331
- input: payload.value,
332
- inst,
333
- continue: !def.abort
334
- });
335
- };
336
- });
337
- const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
338
- def.pattern ?? (def.pattern = e164);
339
- $ZodStringFormat.init(inst, def);
340
- });
341
- function isValidJWT(token, algorithm = null) {
342
- try {
343
- const tokensParts = token.split(".");
344
- if (tokensParts.length !== 3) return false;
345
- const [header] = tokensParts;
346
- if (!header) return false;
347
- const parsedHeader = JSON.parse(atob(header));
348
- if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
349
- if (!parsedHeader.alg) return false;
350
- if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
351
- return true;
352
- } catch {
353
- return false;
354
- }
355
- }
356
- const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
357
- $ZodStringFormat.init(inst, def);
358
- inst._zod.check = (payload) => {
359
- if (isValidJWT(payload.value, def.alg)) return;
360
- payload.issues.push({
361
- code: "invalid_format",
362
- format: "jwt",
363
- input: payload.value,
364
- inst,
365
- continue: !def.abort
366
- });
367
- };
368
- });
369
- function handleArrayResult(result, final, index) {
370
- if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
371
- final.value[index] = result.value;
372
- }
373
- const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
374
- $ZodType.init(inst, def);
375
- inst._zod.parse = (payload, ctx) => {
376
- const input = payload.value;
377
- if (!Array.isArray(input)) {
378
- payload.issues.push({
379
- expected: "array",
380
- code: "invalid_type",
381
- input,
382
- inst
383
- });
384
- return payload;
385
- }
386
- payload.value = Array(input.length);
387
- const proms = [];
388
- for (let i = 0; i < input.length; i++) {
389
- const item = input[i];
390
- const result = def.element._zod.run({
391
- value: item,
392
- issues: []
393
- }, ctx);
394
- if (result instanceof Promise) proms.push(result.then((result$1) => handleArrayResult(result$1, payload, i)));
395
- else handleArrayResult(result, payload, i);
396
- }
397
- if (proms.length) return Promise.all(proms).then(() => payload);
398
- return payload;
399
- };
400
- });
401
- function handleUnionResults(results, final, inst, ctx) {
402
- for (const result of results) if (result.issues.length === 0) {
403
- final.value = result.value;
404
- return final;
405
- }
406
- const nonaborted = results.filter((r) => !aborted(r));
407
- if (nonaborted.length === 1) {
408
- final.value = nonaborted[0].value;
409
- return nonaborted[0];
410
- }
411
- final.issues.push({
412
- code: "invalid_union",
413
- input: final.value,
414
- inst,
415
- errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
416
- });
417
- return final;
418
- }
419
- const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
420
- $ZodType.init(inst, def);
421
- defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
422
- defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
423
- defineLazy(inst._zod, "values", () => {
424
- if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
425
- });
426
- defineLazy(inst._zod, "pattern", () => {
427
- if (def.options.every((o) => o._zod.pattern)) {
428
- const patterns = def.options.map((o) => o._zod.pattern);
429
- return /* @__PURE__ */ new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
430
- }
431
- });
432
- const single = def.options.length === 1;
433
- const first = def.options[0]._zod.run;
434
- inst._zod.parse = (payload, ctx) => {
435
- if (single) return first(payload, ctx);
436
- let async = false;
437
- const results = [];
438
- for (const option of def.options) {
439
- const result = option._zod.run({
440
- value: payload.value,
441
- issues: []
442
- }, ctx);
443
- if (result instanceof Promise) {
444
- results.push(result);
445
- async = true;
446
- } else {
447
- if (result.issues.length === 0) return result;
448
- results.push(result);
449
- }
450
- }
451
- if (!async) return handleUnionResults(results, payload, inst, ctx);
452
- return Promise.all(results).then((results$1) => {
453
- return handleUnionResults(results$1, payload, inst, ctx);
454
- });
455
- };
456
- });
457
- const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
458
- $ZodType.init(inst, def);
459
- inst._zod.parse = (payload, ctx) => {
460
- const input = payload.value;
461
- const left = def.left._zod.run({
462
- value: input,
463
- issues: []
464
- }, ctx);
465
- const right = def.right._zod.run({
466
- value: input,
467
- issues: []
468
- }, ctx);
469
- if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left$1, right$1]) => {
470
- return handleIntersectionResults(payload, left$1, right$1);
471
- });
472
- return handleIntersectionResults(payload, left, right);
473
- };
474
- });
475
- function mergeValues(a, b) {
476
- if (a === b) return {
477
- valid: true,
478
- data: a
479
- };
480
- if (a instanceof Date && b instanceof Date && +a === +b) return {
481
- valid: true,
482
- data: a
483
- };
484
- if (isPlainObject(a) && isPlainObject(b)) {
485
- const bKeys = Object.keys(b);
486
- const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
487
- const newObj = {
488
- ...a,
489
- ...b
490
- };
491
- for (const key of sharedKeys) {
492
- const sharedValue = mergeValues(a[key], b[key]);
493
- if (!sharedValue.valid) return {
494
- valid: false,
495
- mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
496
- };
497
- newObj[key] = sharedValue.data;
498
- }
499
- return {
500
- valid: true,
501
- data: newObj
502
- };
503
- }
504
- if (Array.isArray(a) && Array.isArray(b)) {
505
- if (a.length !== b.length) return {
506
- valid: false,
507
- mergeErrorPath: []
508
- };
509
- const newArray = [];
510
- for (let index = 0; index < a.length; index++) {
511
- const itemA = a[index];
512
- const itemB = b[index];
513
- const sharedValue = mergeValues(itemA, itemB);
514
- if (!sharedValue.valid) return {
515
- valid: false,
516
- mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
517
- };
518
- newArray.push(sharedValue.data);
519
- }
520
- return {
521
- valid: true,
522
- data: newArray
523
- };
524
- }
525
- return {
526
- valid: false,
527
- mergeErrorPath: []
528
- };
529
- }
530
- function handleIntersectionResults(result, left, right) {
531
- if (left.issues.length) result.issues.push(...left.issues);
532
- if (right.issues.length) result.issues.push(...right.issues);
533
- if (aborted(result)) return result;
534
- const merged = mergeValues(left.value, right.value);
535
- if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
536
- result.value = merged.data;
537
- return result;
538
- }
539
- const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
540
- $ZodType.init(inst, def);
541
- inst._zod.parse = (payload, ctx) => {
542
- if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
543
- const _out = def.transform(payload.value, payload);
544
- if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
545
- payload.value = output;
546
- return payload;
547
- });
548
- if (_out instanceof Promise) throw new $ZodAsyncError();
549
- payload.value = _out;
550
- return payload;
551
- };
552
- });
553
- function handleOptionalResult(result, input) {
554
- if (result.issues.length && input === void 0) return {
555
- issues: [],
556
- value: void 0
557
- };
558
- return result;
559
- }
560
- const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
561
- $ZodType.init(inst, def);
562
- inst._zod.optin = "optional";
563
- inst._zod.optout = "optional";
564
- defineLazy(inst._zod, "values", () => {
565
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
566
- });
567
- defineLazy(inst._zod, "pattern", () => {
568
- const pattern = def.innerType._zod.pattern;
569
- return pattern ? /* @__PURE__ */ new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
570
- });
571
- inst._zod.parse = (payload, ctx) => {
572
- if (def.innerType._zod.optin === "optional") {
573
- const result = def.innerType._zod.run(payload, ctx);
574
- if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, payload.value));
575
- return handleOptionalResult(result, payload.value);
576
- }
577
- if (payload.value === void 0) return payload;
578
- return def.innerType._zod.run(payload, ctx);
579
- };
580
- });
581
- const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
582
- $ZodType.init(inst, def);
583
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
584
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
585
- defineLazy(inst._zod, "pattern", () => {
586
- const pattern = def.innerType._zod.pattern;
587
- return pattern ? /* @__PURE__ */ new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
588
- });
589
- defineLazy(inst._zod, "values", () => {
590
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
591
- });
592
- inst._zod.parse = (payload, ctx) => {
593
- if (payload.value === null) return payload;
594
- return def.innerType._zod.run(payload, ctx);
595
- };
596
- });
597
- const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
598
- $ZodType.init(inst, def);
599
- inst._zod.optin = "optional";
600
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
601
- inst._zod.parse = (payload, ctx) => {
602
- if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
603
- if (payload.value === void 0) {
604
- payload.value = def.defaultValue;
605
- /**
606
- * $ZodDefault returns the default value immediately in forward direction.
607
- * It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
608
- return payload;
609
- }
610
- const result = def.innerType._zod.run(payload, ctx);
611
- if (result instanceof Promise) return result.then((result$1) => handleDefaultResult(result$1, def));
612
- return handleDefaultResult(result, def);
613
- };
614
- });
615
- function handleDefaultResult(payload, def) {
616
- if (payload.value === void 0) payload.value = def.defaultValue;
617
- return payload;
618
- }
619
- const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
620
- $ZodType.init(inst, def);
621
- inst._zod.optin = "optional";
622
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
623
- inst._zod.parse = (payload, ctx) => {
624
- if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
625
- if (payload.value === void 0) payload.value = def.defaultValue;
626
- return def.innerType._zod.run(payload, ctx);
627
- };
628
- });
629
- const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
630
- $ZodType.init(inst, def);
631
- defineLazy(inst._zod, "values", () => {
632
- const v = def.innerType._zod.values;
633
- return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
634
- });
635
- inst._zod.parse = (payload, ctx) => {
636
- const result = def.innerType._zod.run(payload, ctx);
637
- if (result instanceof Promise) return result.then((result$1) => handleNonOptionalResult(result$1, inst));
638
- return handleNonOptionalResult(result, inst);
639
- };
640
- });
641
- function handleNonOptionalResult(payload, inst) {
642
- if (!payload.issues.length && payload.value === void 0) payload.issues.push({
643
- code: "invalid_type",
644
- expected: "nonoptional",
645
- input: payload.value,
646
- inst
647
- });
648
- return payload;
649
- }
650
- const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
651
- $ZodType.init(inst, def);
652
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
653
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
654
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
655
- inst._zod.parse = (payload, ctx) => {
656
- if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
657
- const result = def.innerType._zod.run(payload, ctx);
658
- if (result instanceof Promise) return result.then((result$1) => {
659
- payload.value = result$1.value;
660
- if (result$1.issues.length) {
661
- payload.value = def.catchValue({
662
- ...payload,
663
- error: { issues: result$1.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
664
- input: payload.value
665
- });
666
- payload.issues = [];
667
- }
668
- return payload;
669
- });
670
- payload.value = result.value;
671
- if (result.issues.length) {
672
- payload.value = def.catchValue({
673
- ...payload,
674
- error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
675
- input: payload.value
676
- });
677
- payload.issues = [];
678
- }
679
- return payload;
680
- };
681
- });
682
- const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
683
- $ZodType.init(inst, def);
684
- defineLazy(inst._zod, "values", () => def.in._zod.values);
685
- defineLazy(inst._zod, "optin", () => def.in._zod.optin);
686
- defineLazy(inst._zod, "optout", () => def.out._zod.optout);
687
- defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
688
- inst._zod.parse = (payload, ctx) => {
689
- if (ctx.direction === "backward") {
690
- const right = def.out._zod.run(payload, ctx);
691
- if (right instanceof Promise) return right.then((right$1) => handlePipeResult(right$1, def.in, ctx));
692
- return handlePipeResult(right, def.in, ctx);
693
- }
694
- const left = def.in._zod.run(payload, ctx);
695
- if (left instanceof Promise) return left.then((left$1) => handlePipeResult(left$1, def.out, ctx));
696
- return handlePipeResult(left, def.out, ctx);
697
- };
698
- });
699
- function handlePipeResult(left, next, ctx) {
700
- if (left.issues.length) {
701
- left.aborted = true;
702
- return left;
703
- }
704
- return next._zod.run({
705
- value: left.value,
706
- issues: left.issues
707
- }, ctx);
708
- }
709
- const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
710
- $ZodType.init(inst, def);
711
- defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
712
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
713
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
714
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
715
- inst._zod.parse = (payload, ctx) => {
716
- if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
717
- const result = def.innerType._zod.run(payload, ctx);
718
- if (result instanceof Promise) return result.then(handleReadonlyResult);
719
- return handleReadonlyResult(result);
720
- };
721
- });
722
- function handleReadonlyResult(payload) {
723
- payload.value = Object.freeze(payload.value);
724
- return payload;
725
- }
726
- const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
727
- $ZodCheck.init(inst, def);
728
- $ZodType.init(inst, def);
729
- inst._zod.parse = (payload, _) => {
730
- return payload;
731
- };
732
- inst._zod.check = (payload) => {
733
- const input = payload.value;
734
- const r = def.fn(input);
735
- if (r instanceof Promise) return r.then((r$1) => handleRefineResult(r$1, payload, input, inst));
736
- handleRefineResult(r, payload, input, inst);
737
- };
738
- });
739
- function handleRefineResult(result, payload, input, inst) {
740
- if (!result) {
741
- const _iss = {
742
- code: "custom",
743
- input,
744
- inst,
745
- path: [...inst._zod.def.path ?? []],
746
- continue: !inst._zod.def.abort
747
- };
748
- if (inst._zod.def.params) _iss.params = inst._zod.def.params;
749
- payload.issues.push(issue(_iss));
750
- }
751
- }
752
-
753
- //#endregion
754
- export { $ZodArray, $ZodBase64, $ZodBase64URL, $ZodCIDRv4, $ZodCIDRv6, $ZodCUID, $ZodCUID2, $ZodCatch, $ZodCustom, $ZodDefault, $ZodE164, $ZodEmail, $ZodEmoji, $ZodGUID, $ZodIPv4, $ZodIPv6, $ZodISODate, $ZodISODateTime, $ZodISODuration, $ZodISOTime, $ZodIntersection, $ZodJWT, $ZodKSUID, $ZodNanoID, $ZodNonOptional, $ZodNullable, $ZodOptional, $ZodPipe, $ZodPrefault, $ZodReadonly, $ZodString, $ZodStringFormat, $ZodTransform, $ZodType, $ZodULID, $ZodURL, $ZodUUID, $ZodUnion, $ZodXID };
755
- //# sourceMappingURL=schemas.js.map