@ray-js/robot-data-stream 0.0.14 → 0.0.15-beta.1

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 (156) hide show
  1. package/lib/mqtt/createCommonOptions.d.ts +4 -2
  2. package/lib/mqtt/createCommonOptions.js +10 -5
  3. package/lib/mqtt/hooks/useStructuredMessage.d.ts +14 -0
  4. package/lib/mqtt/hooks/useStructuredMessage.js +131 -0
  5. package/lib/mqtt/mqttProvider.d.ts +19 -1
  6. package/lib/mqtt/mqttProvider.js +69 -8
  7. package/lib/mqtt/promise.d.ts +57 -4
  8. package/lib/mqtt/promise.js +115 -36
  9. package/lib/mqtt/type/fun.d.ts +49 -0
  10. package/lib/mqtt/type/fun.js +145 -0
  11. package/lib/mqtt/type/index.d.ts +0 -7
  12. package/lib/mqtt/type/index.js +0 -1
  13. package/lib/mqtt/type/protocols/base.d.ts +5 -0
  14. package/lib/mqtt/type/protocols/base.js +32 -0
  15. package/lib/mqtt/type/protocols/carpetCleanProtocol.d.ts +8 -0
  16. package/lib/mqtt/type/protocols/carpetCleanProtocol.js +16 -0
  17. package/lib/mqtt/type/protocols/carpetProtocol.d.ts +41 -0
  18. package/lib/mqtt/type/protocols/carpetProtocol.js +202 -0
  19. package/lib/mqtt/type/protocols/devInfoProtocol.d.ts +5 -0
  20. package/lib/mqtt/type/protocols/devInfoProtocol.js +12 -0
  21. package/lib/mqtt/type/protocols/deviceModelProtocol.d.ts +8 -0
  22. package/lib/mqtt/type/protocols/deviceModelProtocol.js +34 -0
  23. package/lib/mqtt/type/protocols/furnitureModelProtocol.d.ts +10 -0
  24. package/lib/mqtt/type/protocols/furnitureModelProtocol.js +35 -0
  25. package/lib/mqtt/type/protocols/historyMapProtocol.d.ts +17 -0
  26. package/lib/mqtt/type/protocols/historyMapProtocol.js +37 -0
  27. package/lib/mqtt/type/protocols/index.d.ts +20 -0
  28. package/lib/mqtt/type/protocols/index.js +20 -0
  29. package/lib/mqtt/type/protocols/partDivisionProtocol.d.ts +8 -0
  30. package/lib/mqtt/type/protocols/partDivisionProtocol.js +12 -0
  31. package/lib/mqtt/type/protocols/partMergeProtocol.d.ts +7 -0
  32. package/lib/mqtt/type/protocols/partMergeProtocol.js +12 -0
  33. package/lib/mqtt/type/protocols/passwordProtocol.d.ts +11 -0
  34. package/lib/mqtt/type/protocols/passwordProtocol.js +25 -0
  35. package/lib/mqtt/type/protocols/quietHoursProtocol.d.ts +8 -0
  36. package/lib/mqtt/type/protocols/quietHoursProtocol.js +35 -0
  37. package/lib/mqtt/type/protocols/resetMapProtocol.d.ts +4 -0
  38. package/lib/mqtt/type/protocols/resetMapProtocol.js +1 -0
  39. package/lib/mqtt/type/protocols/roomPropertyProtocol.d.ts +14 -0
  40. package/lib/mqtt/type/protocols/roomPropertyProtocol.js +113 -0
  41. package/lib/mqtt/type/protocols/scheduleProtocol.d.ts +18 -0
  42. package/lib/mqtt/type/protocols/scheduleProtocol.js +100 -0
  43. package/lib/mqtt/type/protocols/selectRoomCleanProtocol.d.ts +8 -0
  44. package/lib/mqtt/type/protocols/selectRoomCleanProtocol.js +40 -0
  45. package/lib/mqtt/type/protocols/spotCleanProtocol.d.ts +9 -0
  46. package/lib/mqtt/type/protocols/spotCleanProtocol.js +72 -0
  47. package/lib/mqtt/type/protocols/virtualAreaProtocol.d.ts +8 -0
  48. package/lib/mqtt/type/protocols/virtualAreaProtocol.js +36 -0
  49. package/lib/mqtt/type/protocols/virtualWallProtocol.d.ts +8 -0
  50. package/lib/mqtt/type/protocols/virtualWallProtocol.js +25 -0
  51. package/lib/mqtt/type/protocols/voiceProtocol.d.ts +8 -0
  52. package/lib/mqtt/type/protocols/voiceProtocol.js +23 -0
  53. package/lib/mqtt/type/protocols/wifiMapProtocol.d.ts +8 -0
  54. package/lib/mqtt/type/protocols/wifiMapProtocol.js +14 -0
  55. package/lib/mqtt/type/protocols/zoneCleanProtocol.d.ts +8 -0
  56. package/lib/mqtt/type/protocols/zoneCleanProtocol.js +49 -0
  57. package/lib/mqtt/useCarpet.d.ts +7 -67
  58. package/lib/mqtt/useCarpet.js +101 -181
  59. package/lib/mqtt/useCarpetClean.d.ts +2 -11
  60. package/lib/mqtt/useCarpetClean.js +24 -51
  61. package/lib/mqtt/useDevInfo.d.ts +8 -6
  62. package/lib/mqtt/useDevInfo.js +44 -36
  63. package/lib/mqtt/useDeviceModel.d.ts +6 -19
  64. package/lib/mqtt/useDeviceModel.js +29 -42
  65. package/lib/mqtt/useFurnitureModel.d.ts +6 -18
  66. package/lib/mqtt/useFurnitureModel.js +29 -43
  67. package/lib/mqtt/useHistoryMap.d.ts +2 -18
  68. package/lib/mqtt/useHistoryMap.js +102 -119
  69. package/lib/mqtt/usePartDivision.d.ts +2 -9
  70. package/lib/mqtt/usePartDivision.js +48 -57
  71. package/lib/mqtt/usePartMerge.d.ts +2 -8
  72. package/lib/mqtt/usePartMerge.js +34 -49
  73. package/lib/mqtt/usePassword.d.ts +6 -13
  74. package/lib/mqtt/usePassword.js +84 -74
  75. package/lib/mqtt/useQuiteHours.d.ts +4 -37
  76. package/lib/mqtt/useQuiteHours.js +66 -100
  77. package/lib/mqtt/useResetMap.d.ts +2 -8
  78. package/lib/mqtt/useResetMap.js +27 -34
  79. package/lib/mqtt/useRoomProperty.d.ts +8 -9
  80. package/lib/mqtt/useRoomProperty.js +67 -65
  81. package/lib/mqtt/useSchedule.d.ts +3 -23
  82. package/lib/mqtt/useSchedule.js +72 -101
  83. package/lib/mqtt/useSelectRoomClean.d.ts +3 -24
  84. package/lib/mqtt/useSelectRoomClean.js +107 -133
  85. package/lib/mqtt/useSpotClean.d.ts +5 -15
  86. package/lib/mqtt/useSpotClean.js +68 -121
  87. package/lib/mqtt/useVirtualArea.d.ts +6 -17
  88. package/lib/mqtt/useVirtualArea.js +109 -119
  89. package/lib/mqtt/useVirtualWall.d.ts +2 -18
  90. package/lib/mqtt/useVirtualWall.js +69 -90
  91. package/lib/mqtt/useVoice.d.ts +2 -16
  92. package/lib/mqtt/useVoice.js +48 -68
  93. package/lib/mqtt/useWifiMap.d.ts +6 -5
  94. package/lib/mqtt/useWifiMap.js +43 -42
  95. package/lib/mqtt/useZoneClean.d.ts +2 -21
  96. package/lib/mqtt/useZoneClean.js +125 -137
  97. package/lib/myLib/zod/mini/index.d.cts +1 -0
  98. package/lib/myLib/zod/mini/index.d.ts +1 -0
  99. package/lib/myLib/zod/mini/index.js +1 -0
  100. package/lib/myLib/zod/mini/package.json +6 -0
  101. package/lib/myLib/zod/src/mini/index.d.ts +1 -0
  102. package/lib/myLib/zod/src/mini/index.js +1 -0
  103. package/lib/myLib/zod/src/v4/core/api.d.ts +306 -0
  104. package/lib/myLib/zod/src/v4/core/api.js +1256 -0
  105. package/lib/myLib/zod/src/v4/core/checks.d.ts +278 -0
  106. package/lib/myLib/zod/src/v4/core/checks.js +816 -0
  107. package/lib/myLib/zod/src/v4/core/config.d.ts +9 -0
  108. package/lib/myLib/zod/src/v4/core/config.js +5 -0
  109. package/lib/myLib/zod/src/v4/core/core.d.ts +70 -0
  110. package/lib/myLib/zod/src/v4/core/core.js +95 -0
  111. package/lib/myLib/zod/src/v4/core/doc.d.ts +14 -0
  112. package/lib/myLib/zod/src/v4/core/doc.js +42 -0
  113. package/lib/myLib/zod/src/v4/core/errors.d.ts +220 -0
  114. package/lib/myLib/zod/src/v4/core/errors.js +232 -0
  115. package/lib/myLib/zod/src/v4/core/index.d.ts +15 -0
  116. package/lib/myLib/zod/src/v4/core/index.js +15 -0
  117. package/lib/myLib/zod/src/v4/core/json-schema-generator.d.ts +65 -0
  118. package/lib/myLib/zod/src/v4/core/json-schema-generator.js +120 -0
  119. package/lib/myLib/zod/src/v4/core/json-schema-processors.d.ts +49 -0
  120. package/lib/myLib/zod/src/v4/core/json-schema-processors.js +593 -0
  121. package/lib/myLib/zod/src/v4/core/json-schema.d.ts +88 -0
  122. package/lib/myLib/zod/src/v4/core/json-schema.js +1 -0
  123. package/lib/myLib/zod/src/v4/core/parse.d.ts +49 -0
  124. package/lib/myLib/zod/src/v4/core/parse.js +147 -0
  125. package/lib/myLib/zod/src/v4/core/regexes.d.ts +78 -0
  126. package/lib/myLib/zod/src/v4/core/regexes.js +146 -0
  127. package/lib/myLib/zod/src/v4/core/registries.d.ts +35 -0
  128. package/lib/myLib/zod/src/v4/core/registries.js +51 -0
  129. package/lib/myLib/zod/src/v4/core/schemas.d.ts +1136 -0
  130. package/lib/myLib/zod/src/v4/core/schemas.js +2745 -0
  131. package/lib/myLib/zod/src/v4/core/standard-schema.d.ts +126 -0
  132. package/lib/myLib/zod/src/v4/core/standard-schema.js +1 -0
  133. package/lib/myLib/zod/src/v4/core/to-json-schema.d.ts +114 -0
  134. package/lib/myLib/zod/src/v4/core/to-json-schema.js +488 -0
  135. package/lib/myLib/zod/src/v4/core/util.d.ts +199 -0
  136. package/lib/myLib/zod/src/v4/core/util.js +656 -0
  137. package/lib/myLib/zod/src/v4/core/versions.d.ts +5 -0
  138. package/lib/myLib/zod/src/v4/core/versions.js +5 -0
  139. package/lib/myLib/zod/src/v4/core/zsf.d.ts +91 -0
  140. package/lib/myLib/zod/src/v4/core/zsf.js +1 -0
  141. package/lib/myLib/zod/src/v4/mini/checks.d.ts +1 -0
  142. package/lib/myLib/zod/src/v4/mini/checks.js +1 -0
  143. package/lib/myLib/zod/src/v4/mini/coerce.d.ts +7 -0
  144. package/lib/myLib/zod/src/v4/mini/coerce.js +27 -0
  145. package/lib/myLib/zod/src/v4/mini/external.d.ts +11 -0
  146. package/lib/myLib/zod/src/v4/mini/external.js +16 -0
  147. package/lib/myLib/zod/src/v4/mini/index.d.ts +3 -0
  148. package/lib/myLib/zod/src/v4/mini/index.js +3 -0
  149. package/lib/myLib/zod/src/v4/mini/iso.d.ts +22 -0
  150. package/lib/myLib/zod/src/v4/mini/iso.js +46 -0
  151. package/lib/myLib/zod/src/v4/mini/parse.d.ts +1 -0
  152. package/lib/myLib/zod/src/v4/mini/parse.js +1 -0
  153. package/lib/myLib/zod/src/v4/mini/schemas.js +1244 -0
  154. package/lib/utils/index.d.ts +1 -0
  155. package/lib/utils/index.js +2 -1
  156. package/package.json +5 -3
@@ -0,0 +1,1256 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import "core-js/modules/esnext.iterator.map.js";
3
+ import * as checks from "./checks.js";
4
+ import * as registries from "./registries.js";
5
+ import * as schemas from "./schemas.js";
6
+ import * as util from "./util.js";
7
+
8
+ // strips types that are not exposed in the public factory
9
+ // incl. `error`, `check`
10
+
11
+ // strips types that are not exposed in the public factory
12
+ // incl. `type`, `checks`, `error`, `check`, `format`
13
+
14
+ // String
15
+
16
+ // @__NO_SIDE_EFFECTS__
17
+ export function _string(Class, params) {
18
+ return new Class(_objectSpread({
19
+ type: "string"
20
+ }, util.normalizeParams(params)));
21
+ }
22
+
23
+ // @__NO_SIDE_EFFECTS__
24
+ export function _coercedString(Class, params) {
25
+ return new Class(_objectSpread({
26
+ type: "string",
27
+ coerce: true
28
+ }, util.normalizeParams(params)));
29
+ }
30
+
31
+ // custom format
32
+
33
+ // Email
34
+
35
+ // @__NO_SIDE_EFFECTS__
36
+ export function _email(Class, params) {
37
+ return new Class(_objectSpread({
38
+ type: "string",
39
+ format: "email",
40
+ check: "string_format",
41
+ abort: false
42
+ }, util.normalizeParams(params)));
43
+ }
44
+
45
+ // GUID
46
+
47
+ // @__NO_SIDE_EFFECTS__
48
+ export function _guid(Class, params) {
49
+ return new Class(_objectSpread({
50
+ type: "string",
51
+ format: "guid",
52
+ check: "string_format",
53
+ abort: false
54
+ }, util.normalizeParams(params)));
55
+ }
56
+
57
+ // UUID
58
+
59
+ // @__NO_SIDE_EFFECTS__
60
+ export function _uuid(Class, params) {
61
+ return new Class(_objectSpread({
62
+ type: "string",
63
+ format: "uuid",
64
+ check: "string_format",
65
+ abort: false
66
+ }, util.normalizeParams(params)));
67
+ }
68
+
69
+ // UUIDv4
70
+
71
+ // @__NO_SIDE_EFFECTS__
72
+ export function _uuidv4(Class, params) {
73
+ return new Class(_objectSpread({
74
+ type: "string",
75
+ format: "uuid",
76
+ check: "string_format",
77
+ abort: false,
78
+ version: "v4"
79
+ }, util.normalizeParams(params)));
80
+ }
81
+
82
+ // UUIDv6
83
+
84
+ // @__NO_SIDE_EFFECTS__
85
+ export function _uuidv6(Class, params) {
86
+ return new Class(_objectSpread({
87
+ type: "string",
88
+ format: "uuid",
89
+ check: "string_format",
90
+ abort: false,
91
+ version: "v6"
92
+ }, util.normalizeParams(params)));
93
+ }
94
+
95
+ // UUIDv7
96
+
97
+ // @__NO_SIDE_EFFECTS__
98
+ export function _uuidv7(Class, params) {
99
+ return new Class(_objectSpread({
100
+ type: "string",
101
+ format: "uuid",
102
+ check: "string_format",
103
+ abort: false,
104
+ version: "v7"
105
+ }, util.normalizeParams(params)));
106
+ }
107
+
108
+ // URL
109
+
110
+ // @__NO_SIDE_EFFECTS__
111
+ export function _url(Class, params) {
112
+ return new Class(_objectSpread({
113
+ type: "string",
114
+ format: "url",
115
+ check: "string_format",
116
+ abort: false
117
+ }, util.normalizeParams(params)));
118
+ }
119
+
120
+ // Emoji
121
+
122
+ // @__NO_SIDE_EFFECTS__
123
+ export function _emoji(Class, params) {
124
+ return new Class(_objectSpread({
125
+ type: "string",
126
+ format: "emoji",
127
+ check: "string_format",
128
+ abort: false
129
+ }, util.normalizeParams(params)));
130
+ }
131
+
132
+ // NanoID
133
+
134
+ // @__NO_SIDE_EFFECTS__
135
+ export function _nanoid(Class, params) {
136
+ return new Class(_objectSpread({
137
+ type: "string",
138
+ format: "nanoid",
139
+ check: "string_format",
140
+ abort: false
141
+ }, util.normalizeParams(params)));
142
+ }
143
+
144
+ // CUID
145
+
146
+ // @__NO_SIDE_EFFECTS__
147
+ export function _cuid(Class, params) {
148
+ return new Class(_objectSpread({
149
+ type: "string",
150
+ format: "cuid",
151
+ check: "string_format",
152
+ abort: false
153
+ }, util.normalizeParams(params)));
154
+ }
155
+
156
+ // CUID2
157
+
158
+ // @__NO_SIDE_EFFECTS__
159
+ export function _cuid2(Class, params) {
160
+ return new Class(_objectSpread({
161
+ type: "string",
162
+ format: "cuid2",
163
+ check: "string_format",
164
+ abort: false
165
+ }, util.normalizeParams(params)));
166
+ }
167
+
168
+ // ULID
169
+
170
+ // @__NO_SIDE_EFFECTS__
171
+ export function _ulid(Class, params) {
172
+ return new Class(_objectSpread({
173
+ type: "string",
174
+ format: "ulid",
175
+ check: "string_format",
176
+ abort: false
177
+ }, util.normalizeParams(params)));
178
+ }
179
+
180
+ // XID
181
+
182
+ // @__NO_SIDE_EFFECTS__
183
+ export function _xid(Class, params) {
184
+ return new Class(_objectSpread({
185
+ type: "string",
186
+ format: "xid",
187
+ check: "string_format",
188
+ abort: false
189
+ }, util.normalizeParams(params)));
190
+ }
191
+
192
+ // KSUID
193
+
194
+ // @__NO_SIDE_EFFECTS__
195
+ export function _ksuid(Class, params) {
196
+ return new Class(_objectSpread({
197
+ type: "string",
198
+ format: "ksuid",
199
+ check: "string_format",
200
+ abort: false
201
+ }, util.normalizeParams(params)));
202
+ }
203
+
204
+ // IPv4
205
+
206
+ // @__NO_SIDE_EFFECTS__
207
+ export function _ipv4(Class, params) {
208
+ return new Class(_objectSpread({
209
+ type: "string",
210
+ format: "ipv4",
211
+ check: "string_format",
212
+ abort: false
213
+ }, util.normalizeParams(params)));
214
+ }
215
+
216
+ // IPv6
217
+
218
+ // @__NO_SIDE_EFFECTS__
219
+ export function _ipv6(Class, params) {
220
+ return new Class(_objectSpread({
221
+ type: "string",
222
+ format: "ipv6",
223
+ check: "string_format",
224
+ abort: false
225
+ }, util.normalizeParams(params)));
226
+ }
227
+
228
+ // MAC
229
+
230
+ // @__NO_SIDE_EFFECTS__
231
+ export function _mac(Class, params) {
232
+ return new Class(_objectSpread({
233
+ type: "string",
234
+ format: "mac",
235
+ check: "string_format",
236
+ abort: false
237
+ }, util.normalizeParams(params)));
238
+ }
239
+
240
+ // CIDRv4
241
+
242
+ // @__NO_SIDE_EFFECTS__
243
+ export function _cidrv4(Class, params) {
244
+ return new Class(_objectSpread({
245
+ type: "string",
246
+ format: "cidrv4",
247
+ check: "string_format",
248
+ abort: false
249
+ }, util.normalizeParams(params)));
250
+ }
251
+
252
+ // CIDRv6
253
+
254
+ // @__NO_SIDE_EFFECTS__
255
+ export function _cidrv6(Class, params) {
256
+ return new Class(_objectSpread({
257
+ type: "string",
258
+ format: "cidrv6",
259
+ check: "string_format",
260
+ abort: false
261
+ }, util.normalizeParams(params)));
262
+ }
263
+
264
+ // Base64
265
+
266
+ // @__NO_SIDE_EFFECTS__
267
+ export function _base64(Class, params) {
268
+ return new Class(_objectSpread({
269
+ type: "string",
270
+ format: "base64",
271
+ check: "string_format",
272
+ abort: false
273
+ }, util.normalizeParams(params)));
274
+ }
275
+
276
+ // base64url
277
+
278
+ // @__NO_SIDE_EFFECTS__
279
+ export function _base64url(Class, params) {
280
+ return new Class(_objectSpread({
281
+ type: "string",
282
+ format: "base64url",
283
+ check: "string_format",
284
+ abort: false
285
+ }, util.normalizeParams(params)));
286
+ }
287
+
288
+ // E164
289
+
290
+ // @__NO_SIDE_EFFECTS__
291
+ export function _e164(Class, params) {
292
+ return new Class(_objectSpread({
293
+ type: "string",
294
+ format: "e164",
295
+ check: "string_format",
296
+ abort: false
297
+ }, util.normalizeParams(params)));
298
+ }
299
+
300
+ // JWT
301
+
302
+ // @__NO_SIDE_EFFECTS__
303
+ export function _jwt(Class, params) {
304
+ return new Class(_objectSpread({
305
+ type: "string",
306
+ format: "jwt",
307
+ check: "string_format",
308
+ abort: false
309
+ }, util.normalizeParams(params)));
310
+ }
311
+ export const TimePrecision = {
312
+ Any: null,
313
+ Minute: -1,
314
+ Second: 0,
315
+ Millisecond: 3,
316
+ Microsecond: 6
317
+ };
318
+ // ISODateTime
319
+
320
+ // @__NO_SIDE_EFFECTS__
321
+ export function _isoDateTime(Class, params) {
322
+ return new Class(_objectSpread({
323
+ type: "string",
324
+ format: "datetime",
325
+ check: "string_format",
326
+ offset: false,
327
+ local: false,
328
+ precision: null
329
+ }, util.normalizeParams(params)));
330
+ }
331
+
332
+ // ISODate
333
+
334
+ // @__NO_SIDE_EFFECTS__
335
+ export function _isoDate(Class, params) {
336
+ return new Class(_objectSpread({
337
+ type: "string",
338
+ format: "date",
339
+ check: "string_format"
340
+ }, util.normalizeParams(params)));
341
+ }
342
+
343
+ // ISOTime
344
+
345
+ // @__NO_SIDE_EFFECTS__
346
+ export function _isoTime(Class, params) {
347
+ return new Class(_objectSpread({
348
+ type: "string",
349
+ format: "time",
350
+ check: "string_format",
351
+ precision: null
352
+ }, util.normalizeParams(params)));
353
+ }
354
+
355
+ // ISODuration
356
+
357
+ // @__NO_SIDE_EFFECTS__
358
+ export function _isoDuration(Class, params) {
359
+ return new Class(_objectSpread({
360
+ type: "string",
361
+ format: "duration",
362
+ check: "string_format"
363
+ }, util.normalizeParams(params)));
364
+ }
365
+
366
+ // Number
367
+
368
+ // @__NO_SIDE_EFFECTS__
369
+ export function _number(Class, params) {
370
+ return new Class(_objectSpread({
371
+ type: "number",
372
+ checks: []
373
+ }, util.normalizeParams(params)));
374
+ }
375
+
376
+ // @__NO_SIDE_EFFECTS__
377
+ export function _coercedNumber(Class, params) {
378
+ return new Class(_objectSpread({
379
+ type: "number",
380
+ coerce: true,
381
+ checks: []
382
+ }, util.normalizeParams(params)));
383
+ }
384
+
385
+ // @__NO_SIDE_EFFECTS__
386
+ export function _int(Class, params) {
387
+ return new Class(_objectSpread({
388
+ type: "number",
389
+ check: "number_format",
390
+ abort: false,
391
+ format: "safeint"
392
+ }, util.normalizeParams(params)));
393
+ }
394
+ // @__NO_SIDE_EFFECTS__
395
+ export function _float32(Class, params) {
396
+ return new Class(_objectSpread({
397
+ type: "number",
398
+ check: "number_format",
399
+ abort: false,
400
+ format: "float32"
401
+ }, util.normalizeParams(params)));
402
+ }
403
+ // @__NO_SIDE_EFFECTS__
404
+ export function _float64(Class, params) {
405
+ return new Class(_objectSpread({
406
+ type: "number",
407
+ check: "number_format",
408
+ abort: false,
409
+ format: "float64"
410
+ }, util.normalizeParams(params)));
411
+ }
412
+ // @__NO_SIDE_EFFECTS__
413
+ export function _int32(Class, params) {
414
+ return new Class(_objectSpread({
415
+ type: "number",
416
+ check: "number_format",
417
+ abort: false,
418
+ format: "int32"
419
+ }, util.normalizeParams(params)));
420
+ }
421
+ // @__NO_SIDE_EFFECTS__
422
+ export function _uint32(Class, params) {
423
+ return new Class(_objectSpread({
424
+ type: "number",
425
+ check: "number_format",
426
+ abort: false,
427
+ format: "uint32"
428
+ }, util.normalizeParams(params)));
429
+ }
430
+
431
+ // Boolean
432
+
433
+ // @__NO_SIDE_EFFECTS__
434
+ export function _boolean(Class, params) {
435
+ return new Class(_objectSpread({
436
+ type: "boolean"
437
+ }, util.normalizeParams(params)));
438
+ }
439
+ // @__NO_SIDE_EFFECTS__
440
+ export function _coercedBoolean(Class, params) {
441
+ return new Class(_objectSpread({
442
+ type: "boolean",
443
+ coerce: true
444
+ }, util.normalizeParams(params)));
445
+ }
446
+
447
+ // BigInt
448
+
449
+ // @__NO_SIDE_EFFECTS__
450
+ export function _bigint(Class, params) {
451
+ return new Class(_objectSpread({
452
+ type: "bigint"
453
+ }, util.normalizeParams(params)));
454
+ }
455
+ // @__NO_SIDE_EFFECTS__
456
+ export function _coercedBigint(Class, params) {
457
+ return new Class(_objectSpread({
458
+ type: "bigint",
459
+ coerce: true
460
+ }, util.normalizeParams(params)));
461
+ }
462
+
463
+ // @__NO_SIDE_EFFECTS__
464
+ export function _int64(Class, params) {
465
+ return new Class(_objectSpread({
466
+ type: "bigint",
467
+ check: "bigint_format",
468
+ abort: false,
469
+ format: "int64"
470
+ }, util.normalizeParams(params)));
471
+ }
472
+ // @__NO_SIDE_EFFECTS__
473
+ export function _uint64(Class, params) {
474
+ return new Class(_objectSpread({
475
+ type: "bigint",
476
+ check: "bigint_format",
477
+ abort: false,
478
+ format: "uint64"
479
+ }, util.normalizeParams(params)));
480
+ }
481
+
482
+ // Symbol
483
+
484
+ // @__NO_SIDE_EFFECTS__
485
+ export function _symbol(Class, params) {
486
+ return new Class(_objectSpread({
487
+ type: "symbol"
488
+ }, util.normalizeParams(params)));
489
+ }
490
+
491
+ // Undefined
492
+
493
+ // @__NO_SIDE_EFFECTS__
494
+ export function _undefined(Class, params) {
495
+ return new Class(_objectSpread({
496
+ type: "undefined"
497
+ }, util.normalizeParams(params)));
498
+ }
499
+
500
+ // Null
501
+
502
+ // @__NO_SIDE_EFFECTS__
503
+ export function _null(Class, params) {
504
+ return new Class(_objectSpread({
505
+ type: "null"
506
+ }, util.normalizeParams(params)));
507
+ }
508
+
509
+ // Any
510
+
511
+ // @__NO_SIDE_EFFECTS__
512
+ export function _any(Class) {
513
+ return new Class({
514
+ type: "any"
515
+ });
516
+ }
517
+
518
+ // Unknown
519
+
520
+ // @__NO_SIDE_EFFECTS__
521
+ export function _unknown(Class) {
522
+ return new Class({
523
+ type: "unknown"
524
+ });
525
+ }
526
+
527
+ // Never
528
+
529
+ // @__NO_SIDE_EFFECTS__
530
+ export function _never(Class, params) {
531
+ return new Class(_objectSpread({
532
+ type: "never"
533
+ }, util.normalizeParams(params)));
534
+ }
535
+
536
+ // Void
537
+
538
+ // @__NO_SIDE_EFFECTS__
539
+ export function _void(Class, params) {
540
+ return new Class(_objectSpread({
541
+ type: "void"
542
+ }, util.normalizeParams(params)));
543
+ }
544
+
545
+ // Date
546
+
547
+ // @__NO_SIDE_EFFECTS__
548
+ export function _date(Class, params) {
549
+ return new Class(_objectSpread({
550
+ type: "date"
551
+ }, util.normalizeParams(params)));
552
+ }
553
+ // @__NO_SIDE_EFFECTS__
554
+ export function _coercedDate(Class, params) {
555
+ return new Class(_objectSpread({
556
+ type: "date",
557
+ coerce: true
558
+ }, util.normalizeParams(params)));
559
+ }
560
+
561
+ // NaN
562
+
563
+ // @__NO_SIDE_EFFECTS__
564
+ export function _nan(Class, params) {
565
+ return new Class(_objectSpread({
566
+ type: "nan"
567
+ }, util.normalizeParams(params)));
568
+ }
569
+
570
+ // export type $ZodCheckParams = CheckParams<checks.$ZodCheck, "abort" | "when">;
571
+
572
+ // @__NO_SIDE_EFFECTS__
573
+ export function _lt(value, params) {
574
+ return new checks.$ZodCheckLessThan(_objectSpread(_objectSpread({
575
+ check: "less_than"
576
+ }, util.normalizeParams(params)), {}, {
577
+ value,
578
+ inclusive: false
579
+ }));
580
+ }
581
+
582
+ // @__NO_SIDE_EFFECTS__
583
+ export function _lte(value, params) {
584
+ return new checks.$ZodCheckLessThan(_objectSpread(_objectSpread({
585
+ check: "less_than"
586
+ }, util.normalizeParams(params)), {}, {
587
+ value,
588
+ inclusive: true
589
+ }));
590
+ }
591
+ export { /** @deprecated Use `z.lte()` instead. */
592
+ _lte as _max };
593
+
594
+ // ZodCheckGreaterThan
595
+
596
+ // @__NO_SIDE_EFFECTS__
597
+ export function _gt(value, params) {
598
+ return new checks.$ZodCheckGreaterThan(_objectSpread(_objectSpread({
599
+ check: "greater_than"
600
+ }, util.normalizeParams(params)), {}, {
601
+ value,
602
+ inclusive: false
603
+ }));
604
+ }
605
+
606
+ // @__NO_SIDE_EFFECTS__
607
+ export function _gte(value, params) {
608
+ return new checks.$ZodCheckGreaterThan(_objectSpread(_objectSpread({
609
+ check: "greater_than"
610
+ }, util.normalizeParams(params)), {}, {
611
+ value,
612
+ inclusive: true
613
+ }));
614
+ }
615
+ export { /** @deprecated Use `z.gte()` instead. */
616
+ _gte as _min };
617
+
618
+ // @__NO_SIDE_EFFECTS__
619
+ export function _positive(params) {
620
+ return _gt(0, params);
621
+ }
622
+
623
+ // negative
624
+ // @__NO_SIDE_EFFECTS__
625
+ export function _negative(params) {
626
+ return _lt(0, params);
627
+ }
628
+
629
+ // nonpositive
630
+ // @__NO_SIDE_EFFECTS__
631
+ export function _nonpositive(params) {
632
+ return _lte(0, params);
633
+ }
634
+
635
+ // nonnegative
636
+ // @__NO_SIDE_EFFECTS__
637
+ export function _nonnegative(params) {
638
+ return _gte(0, params);
639
+ }
640
+ // @__NO_SIDE_EFFECTS__
641
+ export function _multipleOf(value, params) {
642
+ return new checks.$ZodCheckMultipleOf(_objectSpread(_objectSpread({
643
+ check: "multiple_of"
644
+ }, util.normalizeParams(params)), {}, {
645
+ value
646
+ }));
647
+ }
648
+ // @__NO_SIDE_EFFECTS__
649
+ export function _maxSize(maximum, params) {
650
+ return new checks.$ZodCheckMaxSize(_objectSpread(_objectSpread({
651
+ check: "max_size"
652
+ }, util.normalizeParams(params)), {}, {
653
+ maximum
654
+ }));
655
+ }
656
+ // @__NO_SIDE_EFFECTS__
657
+ export function _minSize(minimum, params) {
658
+ return new checks.$ZodCheckMinSize(_objectSpread(_objectSpread({
659
+ check: "min_size"
660
+ }, util.normalizeParams(params)), {}, {
661
+ minimum
662
+ }));
663
+ }
664
+ // @__NO_SIDE_EFFECTS__
665
+ export function _size(size, params) {
666
+ return new checks.$ZodCheckSizeEquals(_objectSpread(_objectSpread({
667
+ check: "size_equals"
668
+ }, util.normalizeParams(params)), {}, {
669
+ size
670
+ }));
671
+ }
672
+ // @__NO_SIDE_EFFECTS__
673
+ export function _maxLength(maximum, params) {
674
+ const ch = new checks.$ZodCheckMaxLength(_objectSpread(_objectSpread({
675
+ check: "max_length"
676
+ }, util.normalizeParams(params)), {}, {
677
+ maximum
678
+ }));
679
+ return ch;
680
+ }
681
+ // @__NO_SIDE_EFFECTS__
682
+ export function _minLength(minimum, params) {
683
+ return new checks.$ZodCheckMinLength(_objectSpread(_objectSpread({
684
+ check: "min_length"
685
+ }, util.normalizeParams(params)), {}, {
686
+ minimum
687
+ }));
688
+ }
689
+ // @__NO_SIDE_EFFECTS__
690
+ export function _length(length, params) {
691
+ return new checks.$ZodCheckLengthEquals(_objectSpread(_objectSpread({
692
+ check: "length_equals"
693
+ }, util.normalizeParams(params)), {}, {
694
+ length
695
+ }));
696
+ }
697
+ // @__NO_SIDE_EFFECTS__
698
+ export function _regex(pattern, params) {
699
+ return new checks.$ZodCheckRegex(_objectSpread(_objectSpread({
700
+ check: "string_format",
701
+ format: "regex"
702
+ }, util.normalizeParams(params)), {}, {
703
+ pattern
704
+ }));
705
+ }
706
+ // @__NO_SIDE_EFFECTS__
707
+ export function _lowercase(params) {
708
+ return new checks.$ZodCheckLowerCase(_objectSpread({
709
+ check: "string_format",
710
+ format: "lowercase"
711
+ }, util.normalizeParams(params)));
712
+ }
713
+ // @__NO_SIDE_EFFECTS__
714
+ export function _uppercase(params) {
715
+ return new checks.$ZodCheckUpperCase(_objectSpread({
716
+ check: "string_format",
717
+ format: "uppercase"
718
+ }, util.normalizeParams(params)));
719
+ }
720
+ // @__NO_SIDE_EFFECTS__
721
+ export function _includes(includes, params) {
722
+ return new checks.$ZodCheckIncludes(_objectSpread(_objectSpread({
723
+ check: "string_format",
724
+ format: "includes"
725
+ }, util.normalizeParams(params)), {}, {
726
+ includes
727
+ }));
728
+ }
729
+ // @__NO_SIDE_EFFECTS__
730
+ export function _startsWith(prefix, params) {
731
+ return new checks.$ZodCheckStartsWith(_objectSpread(_objectSpread({
732
+ check: "string_format",
733
+ format: "starts_with"
734
+ }, util.normalizeParams(params)), {}, {
735
+ prefix
736
+ }));
737
+ }
738
+ // @__NO_SIDE_EFFECTS__
739
+ export function _endsWith(suffix, params) {
740
+ return new checks.$ZodCheckEndsWith(_objectSpread(_objectSpread({
741
+ check: "string_format",
742
+ format: "ends_with"
743
+ }, util.normalizeParams(params)), {}, {
744
+ suffix
745
+ }));
746
+ }
747
+ // @__NO_SIDE_EFFECTS__
748
+ export function _property(property, schema, params) {
749
+ return new checks.$ZodCheckProperty(_objectSpread({
750
+ check: "property",
751
+ property,
752
+ schema
753
+ }, util.normalizeParams(params)));
754
+ }
755
+ // @__NO_SIDE_EFFECTS__
756
+ export function _mime(types, params) {
757
+ return new checks.$ZodCheckMimeType(_objectSpread({
758
+ check: "mime_type",
759
+ mime: types
760
+ }, util.normalizeParams(params)));
761
+ }
762
+
763
+ // @__NO_SIDE_EFFECTS__
764
+ export function _overwrite(tx) {
765
+ return new checks.$ZodCheckOverwrite({
766
+ check: "overwrite",
767
+ tx
768
+ });
769
+ }
770
+ // normalize
771
+ // @__NO_SIDE_EFFECTS__
772
+ export function _normalize(form) {
773
+ return _overwrite(input => input.normalize(form));
774
+ }
775
+
776
+ // trim
777
+ // @__NO_SIDE_EFFECTS__
778
+ export function _trim() {
779
+ return _overwrite(input => input.trim());
780
+ }
781
+ // toLowerCase
782
+ // @__NO_SIDE_EFFECTS__
783
+ export function _toLowerCase() {
784
+ return _overwrite(input => input.toLowerCase());
785
+ }
786
+ // toUpperCase
787
+ // @__NO_SIDE_EFFECTS__
788
+ export function _toUpperCase() {
789
+ return _overwrite(input => input.toUpperCase());
790
+ }
791
+ // slugify
792
+ // @__NO_SIDE_EFFECTS__
793
+ export function _slugify() {
794
+ return _overwrite(input => util.slugify(input));
795
+ }
796
+
797
+ /////// collections ///////
798
+
799
+ // Array
800
+
801
+ // @__NO_SIDE_EFFECTS__
802
+ export function _array(Class, element, params) {
803
+ return new Class(_objectSpread({
804
+ type: "array",
805
+ element
806
+ }, util.normalizeParams(params)));
807
+ }
808
+
809
+ // ZodUnion
810
+
811
+ // @__NO_SIDE_EFFECTS__
812
+ export function _union(Class, options, params) {
813
+ return new Class(_objectSpread({
814
+ type: "union",
815
+ options
816
+ }, util.normalizeParams(params)));
817
+ }
818
+
819
+ // ZodXor
820
+
821
+ export function _xor(Class, options, params) {
822
+ return new Class(_objectSpread({
823
+ type: "union",
824
+ options,
825
+ inclusive: false
826
+ }, util.normalizeParams(params)));
827
+ }
828
+
829
+ // ZodDiscriminatedUnion
830
+
831
+ // @__NO_SIDE_EFFECTS__
832
+ export function _discriminatedUnion(Class, discriminator, options, params) {
833
+ return new Class(_objectSpread({
834
+ type: "union",
835
+ options,
836
+ discriminator
837
+ }, util.normalizeParams(params)));
838
+ }
839
+
840
+ // ZodIntersection
841
+
842
+ // @__NO_SIDE_EFFECTS__
843
+ export function _intersection(Class, left, right) {
844
+ return new Class({
845
+ type: "intersection",
846
+ left,
847
+ right
848
+ });
849
+ }
850
+
851
+ // ZodTuple
852
+
853
+ // @__NO_SIDE_EFFECTS__
854
+
855
+ // @__NO_SIDE_EFFECTS__
856
+
857
+ // export function _tuple(
858
+ // Class: util.SchemaClass<schemas.$ZodTuple>,
859
+ // items: [],
860
+ // params?: string | $ZodTupleParams
861
+ // ): schemas.$ZodTuple<[], null>;
862
+ // @__NO_SIDE_EFFECTS__
863
+ export function _tuple(Class, items, _paramsOrRest, _params) {
864
+ const hasRest = _paramsOrRest instanceof schemas.$ZodType;
865
+ const params = hasRest ? _params : _paramsOrRest;
866
+ const rest = hasRest ? _paramsOrRest : null;
867
+ return new Class(_objectSpread({
868
+ type: "tuple",
869
+ items,
870
+ rest
871
+ }, util.normalizeParams(params)));
872
+ }
873
+
874
+ // ZodRecord
875
+
876
+ // @__NO_SIDE_EFFECTS__
877
+ export function _record(Class, keyType, valueType, params) {
878
+ return new Class(_objectSpread({
879
+ type: "record",
880
+ keyType,
881
+ valueType
882
+ }, util.normalizeParams(params)));
883
+ }
884
+
885
+ // ZodMap
886
+
887
+ // @__NO_SIDE_EFFECTS__
888
+ export function _map(Class, keyType, valueType, params) {
889
+ return new Class(_objectSpread({
890
+ type: "map",
891
+ keyType,
892
+ valueType
893
+ }, util.normalizeParams(params)));
894
+ }
895
+
896
+ // ZodSet
897
+
898
+ // @__NO_SIDE_EFFECTS__
899
+ export function _set(Class, valueType, params) {
900
+ return new Class(_objectSpread({
901
+ type: "set",
902
+ valueType
903
+ }, util.normalizeParams(params)));
904
+ }
905
+
906
+ // ZodEnum
907
+
908
+ // @__NO_SIDE_EFFECTS__
909
+
910
+ // @__NO_SIDE_EFFECTS__
911
+
912
+ // @__NO_SIDE_EFFECTS__
913
+ export function _enum(Class, values, params) {
914
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map(v => [v, v])) : values;
915
+ // if (Array.isArray(values)) {
916
+ // for (const value of values) {
917
+ // entries[value] = value;
918
+ // }
919
+ // } else {
920
+ // Object.assign(entries, values);
921
+ // }
922
+ // const entries: util.EnumLike = {};
923
+ // for (const val of values) {
924
+ // entries[val] = val;
925
+ // }
926
+
927
+ return new Class(_objectSpread({
928
+ type: "enum",
929
+ entries
930
+ }, util.normalizeParams(params)));
931
+ }
932
+
933
+ // @__NO_SIDE_EFFECTS__
934
+ /** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
935
+ *
936
+ * ```ts
937
+ * enum Colors { red, green, blue }
938
+ * z.enum(Colors);
939
+ * ```
940
+ */
941
+ export function _nativeEnum(Class, entries, params) {
942
+ return new Class(_objectSpread({
943
+ type: "enum",
944
+ entries
945
+ }, util.normalizeParams(params)));
946
+ }
947
+
948
+ // ZodLiteral
949
+
950
+ // @__NO_SIDE_EFFECTS__
951
+ export function _literal(Class, value, params) {
952
+ return new Class(_objectSpread({
953
+ type: "literal",
954
+ values: Array.isArray(value) ? value : [value]
955
+ }, util.normalizeParams(params)));
956
+ }
957
+
958
+ // ZodFile
959
+
960
+ // @__NO_SIDE_EFFECTS__
961
+ export function _file(Class, params) {
962
+ return new Class(_objectSpread({
963
+ type: "file"
964
+ }, util.normalizeParams(params)));
965
+ }
966
+
967
+ // ZodTransform
968
+
969
+ // @__NO_SIDE_EFFECTS__
970
+ export function _transform(Class, fn) {
971
+ return new Class({
972
+ type: "transform",
973
+ transform: fn
974
+ });
975
+ }
976
+
977
+ // ZodOptional
978
+
979
+ // @__NO_SIDE_EFFECTS__
980
+ export function _optional(Class, innerType) {
981
+ return new Class({
982
+ type: "optional",
983
+ innerType
984
+ });
985
+ }
986
+
987
+ // ZodNullable
988
+
989
+ // @__NO_SIDE_EFFECTS__
990
+ export function _nullable(Class, innerType) {
991
+ return new Class({
992
+ type: "nullable",
993
+ innerType
994
+ });
995
+ }
996
+
997
+ // ZodDefault
998
+
999
+ // @__NO_SIDE_EFFECTS__
1000
+ export function _default(Class, innerType, defaultValue) {
1001
+ return new Class({
1002
+ type: "default",
1003
+ innerType,
1004
+ get defaultValue() {
1005
+ return typeof defaultValue === "function" ? defaultValue() : util.shallowClone(defaultValue);
1006
+ }
1007
+ });
1008
+ }
1009
+
1010
+ // ZodNonOptional
1011
+
1012
+ // @__NO_SIDE_EFFECTS__
1013
+ export function _nonoptional(Class, innerType, params) {
1014
+ return new Class(_objectSpread({
1015
+ type: "nonoptional",
1016
+ innerType
1017
+ }, util.normalizeParams(params)));
1018
+ }
1019
+
1020
+ // ZodSuccess
1021
+
1022
+ // @__NO_SIDE_EFFECTS__
1023
+ export function _success(Class, innerType) {
1024
+ return new Class({
1025
+ type: "success",
1026
+ innerType
1027
+ });
1028
+ }
1029
+
1030
+ // ZodCatch
1031
+
1032
+ // @__NO_SIDE_EFFECTS__
1033
+ export function _catch(Class, innerType, catchValue) {
1034
+ return new Class({
1035
+ type: "catch",
1036
+ innerType,
1037
+ catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
1038
+ });
1039
+ }
1040
+
1041
+ // ZodPipe
1042
+
1043
+ // @__NO_SIDE_EFFECTS__
1044
+ export function _pipe(Class, in_, out) {
1045
+ return new Class({
1046
+ type: "pipe",
1047
+ in: in_,
1048
+ out
1049
+ });
1050
+ }
1051
+
1052
+ // ZodReadonly
1053
+
1054
+ // @__NO_SIDE_EFFECTS__
1055
+ export function _readonly(Class, innerType) {
1056
+ return new Class({
1057
+ type: "readonly",
1058
+ innerType
1059
+ });
1060
+ }
1061
+
1062
+ // ZodTemplateLiteral
1063
+
1064
+ // @__NO_SIDE_EFFECTS__
1065
+ export function _templateLiteral(Class, parts, params) {
1066
+ return new Class(_objectSpread({
1067
+ type: "template_literal",
1068
+ parts
1069
+ }, util.normalizeParams(params)));
1070
+ }
1071
+
1072
+ // ZodLazy
1073
+
1074
+ // @__NO_SIDE_EFFECTS__
1075
+ export function _lazy(Class, getter) {
1076
+ return new Class({
1077
+ type: "lazy",
1078
+ getter
1079
+ });
1080
+ }
1081
+
1082
+ // ZodPromise
1083
+
1084
+ // @__NO_SIDE_EFFECTS__
1085
+ export function _promise(Class, innerType) {
1086
+ return new Class({
1087
+ type: "promise",
1088
+ innerType
1089
+ });
1090
+ }
1091
+
1092
+ // ZodCustom
1093
+
1094
+ // @__NO_SIDE_EFFECTS__
1095
+ export function _custom(Class, fn, _params) {
1096
+ const norm = util.normalizeParams(_params);
1097
+ norm.abort ??= true; // default to abort:false
1098
+ const schema = new Class(_objectSpread({
1099
+ type: "custom",
1100
+ check: "custom",
1101
+ fn: fn
1102
+ }, norm));
1103
+ return schema;
1104
+ }
1105
+
1106
+ // same as _custom but defaults to abort:false
1107
+ // @__NO_SIDE_EFFECTS__
1108
+ export function _refine(Class, fn, _params) {
1109
+ const schema = new Class(_objectSpread({
1110
+ type: "custom",
1111
+ check: "custom",
1112
+ fn: fn
1113
+ }, util.normalizeParams(_params)));
1114
+ return schema;
1115
+ }
1116
+ // @__NO_SIDE_EFFECTS__
1117
+ export function _superRefine(fn) {
1118
+ const ch = _check(payload => {
1119
+ payload.addIssue = issue => {
1120
+ if (typeof issue === "string") {
1121
+ payload.issues.push(util.issue(issue, payload.value, ch._zod.def));
1122
+ } else {
1123
+ // for Zod 3 backwards compatibility
1124
+ const _issue = issue;
1125
+ if (_issue.fatal) _issue.continue = false;
1126
+ _issue.code ??= "custom";
1127
+ _issue.input ??= payload.value;
1128
+ _issue.inst ??= ch;
1129
+ _issue.continue ??= !ch._zod.def.abort; // abort is always undefined, so this is always true...
1130
+ payload.issues.push(util.issue(_issue));
1131
+ }
1132
+ };
1133
+ return fn(payload.value, payload);
1134
+ });
1135
+ return ch;
1136
+ }
1137
+
1138
+ // @__NO_SIDE_EFFECTS__
1139
+ export function _check(fn, params) {
1140
+ const ch = new checks.$ZodCheck(_objectSpread({
1141
+ check: "custom"
1142
+ }, util.normalizeParams(params)));
1143
+ ch._zod.check = fn;
1144
+ return ch;
1145
+ }
1146
+
1147
+ // @__NO_SIDE_EFFECTS__
1148
+ export function describe(description) {
1149
+ const ch = new checks.$ZodCheck({
1150
+ check: "describe"
1151
+ });
1152
+ ch._zod.onattach = [inst => {
1153
+ var _registries$globalReg;
1154
+ const existing = (_registries$globalReg = registries.globalRegistry.get(inst)) !== null && _registries$globalReg !== void 0 ? _registries$globalReg : {};
1155
+ registries.globalRegistry.add(inst, _objectSpread(_objectSpread({}, existing), {}, {
1156
+ description
1157
+ }));
1158
+ }];
1159
+ ch._zod.check = () => {}; // no-op check
1160
+ return ch;
1161
+ }
1162
+
1163
+ // @__NO_SIDE_EFFECTS__
1164
+ export function meta(metadata) {
1165
+ const ch = new checks.$ZodCheck({
1166
+ check: "meta"
1167
+ });
1168
+ ch._zod.onattach = [inst => {
1169
+ var _registries$globalReg2;
1170
+ const existing = (_registries$globalReg2 = registries.globalRegistry.get(inst)) !== null && _registries$globalReg2 !== void 0 ? _registries$globalReg2 : {};
1171
+ registries.globalRegistry.add(inst, _objectSpread(_objectSpread({}, existing), metadata));
1172
+ }];
1173
+ ch._zod.check = () => {}; // no-op check
1174
+ return ch;
1175
+ }
1176
+
1177
+ // export type $ZodCustomParams = CheckTypeParams<schemas.$ZodCustom, "fn">
1178
+
1179
+ ///////// STRINGBOOL /////////
1180
+
1181
+ // stringbool
1182
+
1183
+ // @__NO_SIDE_EFFECTS__
1184
+ export function _stringbool(Classes, _params) {
1185
+ var _params$truthy, _params$falsy, _Classes$Codec, _Classes$Boolean, _Classes$String;
1186
+ const params = util.normalizeParams(_params);
1187
+ let truthyArray = (_params$truthy = params.truthy) !== null && _params$truthy !== void 0 ? _params$truthy : ["true", "1", "yes", "on", "y", "enabled"];
1188
+ let falsyArray = (_params$falsy = params.falsy) !== null && _params$falsy !== void 0 ? _params$falsy : ["false", "0", "no", "off", "n", "disabled"];
1189
+ if (params.case !== "sensitive") {
1190
+ truthyArray = truthyArray.map(v => typeof v === "string" ? v.toLowerCase() : v);
1191
+ falsyArray = falsyArray.map(v => typeof v === "string" ? v.toLowerCase() : v);
1192
+ }
1193
+ const truthySet = new Set(truthyArray);
1194
+ const falsySet = new Set(falsyArray);
1195
+ const _Codec = (_Classes$Codec = Classes.Codec) !== null && _Classes$Codec !== void 0 ? _Classes$Codec : schemas.$ZodCodec;
1196
+ const _Boolean = (_Classes$Boolean = Classes.Boolean) !== null && _Classes$Boolean !== void 0 ? _Classes$Boolean : schemas.$ZodBoolean;
1197
+ const _String = (_Classes$String = Classes.String) !== null && _Classes$String !== void 0 ? _Classes$String : schemas.$ZodString;
1198
+ const stringSchema = new _String({
1199
+ type: "string",
1200
+ error: params.error
1201
+ });
1202
+ const booleanSchema = new _Boolean({
1203
+ type: "boolean",
1204
+ error: params.error
1205
+ });
1206
+ const codec = new _Codec({
1207
+ type: "pipe",
1208
+ in: stringSchema,
1209
+ out: booleanSchema,
1210
+ transform: (input, payload) => {
1211
+ let data = input;
1212
+ if (params.case !== "sensitive") data = data.toLowerCase();
1213
+ if (truthySet.has(data)) {
1214
+ return true;
1215
+ } else if (falsySet.has(data)) {
1216
+ return false;
1217
+ } else {
1218
+ payload.issues.push({
1219
+ code: "invalid_value",
1220
+ expected: "stringbool",
1221
+ values: [...truthySet, ...falsySet],
1222
+ input: payload.value,
1223
+ inst: codec,
1224
+ continue: false
1225
+ });
1226
+ return {};
1227
+ }
1228
+ },
1229
+ reverseTransform: input => {
1230
+ if (input === true) {
1231
+ return truthyArray[0] || "true";
1232
+ } else {
1233
+ return falsyArray[0] || "false";
1234
+ }
1235
+ },
1236
+ error: params.error
1237
+ });
1238
+ return codec;
1239
+ }
1240
+
1241
+ // @__NO_SIDE_EFFECTS__
1242
+ export function _stringFormat(Class, format, fnOrRegex) {
1243
+ let _params = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1244
+ const params = util.normalizeParams(_params);
1245
+ const def = _objectSpread(_objectSpread({}, util.normalizeParams(_params)), {}, {
1246
+ check: "string_format",
1247
+ type: "string",
1248
+ format,
1249
+ fn: typeof fnOrRegex === "function" ? fnOrRegex : val => fnOrRegex.test(val)
1250
+ }, params);
1251
+ if (fnOrRegex instanceof RegExp) {
1252
+ def.pattern = fnOrRegex;
1253
+ }
1254
+ const inst = new Class(def);
1255
+ return inst;
1256
+ }