@nuclearplayer/plugin-sdk 1.1.0 → 2.0.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 (3) hide show
  1. package/dist/index.d.ts +689 -15
  2. package/dist/index.js +2902 -210
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,274 +1,310 @@
1
- import { useState as l, useEffect as f, useMemo as g } from "react";
2
- class b {
3
- #e;
4
- constructor(t) {
5
- this.#e = t;
6
- }
7
- #t(t) {
8
- const e = this.#e;
9
- if (!e)
1
+ import { useState as Se, useEffect as Ce, useMemo as Ie } from "react";
2
+ class Ne {
3
+ #t;
4
+ constructor(e) {
5
+ this.#t = e;
6
+ }
7
+ #e(e) {
8
+ const t = this.#t;
9
+ if (!t)
10
10
  throw new Error("Favorites host not available");
11
- return t(e);
11
+ return e(t);
12
12
  }
13
13
  getTracks() {
14
- return this.#t((t) => t.getTracks());
14
+ return this.#e((e) => e.getTracks());
15
15
  }
16
16
  getAlbums() {
17
- return this.#t((t) => t.getAlbums());
17
+ return this.#e((e) => e.getAlbums());
18
18
  }
19
19
  getArtists() {
20
- return this.#t((t) => t.getArtists());
20
+ return this.#e((e) => e.getArtists());
21
21
  }
22
- addTrack(t) {
23
- return this.#t((e) => e.addTrack(t));
22
+ addTrack(e) {
23
+ return this.#e((t) => t.addTrack(e));
24
24
  }
25
- removeTrack(t) {
26
- return this.#t((e) => e.removeTrack(t));
25
+ removeTrack(e) {
26
+ return this.#e((t) => t.removeTrack(e));
27
27
  }
28
- isTrackFavorite(t) {
29
- return this.#t((e) => e.isTrackFavorite(t));
28
+ isTrackFavorite(e) {
29
+ return this.#e((t) => t.isTrackFavorite(e));
30
30
  }
31
- addAlbum(t) {
32
- return this.#t((e) => e.addAlbum(t));
31
+ addAlbum(e) {
32
+ return this.#e((t) => t.addAlbum(e));
33
33
  }
34
- removeAlbum(t) {
35
- return this.#t((e) => e.removeAlbum(t));
34
+ removeAlbum(e) {
35
+ return this.#e((t) => t.removeAlbum(e));
36
36
  }
37
- isAlbumFavorite(t) {
38
- return this.#t((e) => e.isAlbumFavorite(t));
37
+ isAlbumFavorite(e) {
38
+ return this.#e((t) => t.isAlbumFavorite(e));
39
39
  }
40
- addArtist(t) {
41
- return this.#t((e) => e.addArtist(t));
40
+ addArtist(e) {
41
+ return this.#e((t) => t.addArtist(e));
42
42
  }
43
- removeArtist(t) {
44
- return this.#t((e) => e.removeArtist(t));
43
+ removeArtist(e) {
44
+ return this.#e((t) => t.removeArtist(e));
45
45
  }
46
- isArtistFavorite(t) {
47
- return this.#t((e) => e.isArtistFavorite(t));
46
+ isArtistFavorite(e) {
47
+ return this.#e((t) => t.isArtistFavorite(e));
48
48
  }
49
- subscribe(t) {
50
- return this.#t((e) => e.subscribe(t));
49
+ subscribe(e) {
50
+ return this.#e((t) => t.subscribe(e));
51
51
  }
52
52
  }
53
- const m = (s) => {
54
- if (s instanceof Headers) {
55
- const t = {};
56
- return s.forEach((e, r) => {
57
- t[r] = e;
58
- }), t;
59
- }
60
- return Array.isArray(s) ? Object.fromEntries(s) : s;
53
+ const Oe = (r) => {
54
+ if (r instanceof Headers) {
55
+ const e = {};
56
+ return r.forEach((t, s) => {
57
+ e[s] = t;
58
+ }), e;
59
+ }
60
+ return Array.isArray(r) ? Object.fromEntries(r) : r;
61
61
  };
62
- function A(s) {
63
- return async (t, e) => {
64
- const r = String(t instanceof Request ? t.url : t), a = e?.headers ? m(e.headers) : void 0, n = typeof e?.body == "string" ? e.body : void 0, u = await s.fetch(r, {
65
- method: e?.method,
62
+ function Re(r) {
63
+ return async (e, t) => {
64
+ const s = String(e instanceof Request ? e.url : e), a = t?.headers ? Oe(t.headers) : void 0, n = typeof t?.body == "string" ? t.body : void 0, i = await r.fetch(s, {
65
+ method: t?.method,
66
66
  headers: a,
67
67
  body: n
68
68
  });
69
- return new Response(u.body, {
70
- status: u.status,
71
- headers: new Headers(u.headers)
69
+ return new Response(i.body, {
70
+ status: i.status,
71
+ headers: new Headers(i.headers)
72
72
  });
73
73
  };
74
74
  }
75
- const v = {
75
+ const Ze = {
76
76
  fetch: async () => ({
77
77
  status: 501,
78
78
  headers: {},
79
79
  body: "HTTP host not configured"
80
80
  })
81
81
  };
82
- class w {
82
+ class Ee {
83
83
  fetch;
84
- constructor(t) {
85
- this.fetch = A(t ?? v);
84
+ constructor(e) {
85
+ this.fetch = Re(e ?? Ze);
86
86
  }
87
87
  }
88
- class T {
89
- #e;
90
- constructor(t) {
91
- this.#e = t;
88
+ const je = {
89
+ log: () => {
90
+ }
91
+ };
92
+ class $e {
93
+ host;
94
+ constructor(e) {
95
+ this.host = e ?? je;
96
+ }
97
+ trace(e) {
98
+ this.host.log("trace", e);
99
+ }
100
+ debug(e) {
101
+ this.host.log("debug", e);
102
+ }
103
+ info(e) {
104
+ this.host.log("info", e);
105
+ }
106
+ warn(e) {
107
+ this.host.log("warn", e);
108
+ }
109
+ error(e) {
110
+ this.host.log("error", e);
92
111
  }
93
- #t(t) {
94
- const e = this.#e;
95
- if (!e)
112
+ log(e, t) {
113
+ this.host.log(e, t);
114
+ }
115
+ }
116
+ class Me {
117
+ #t;
118
+ constructor(e) {
119
+ this.#t = e;
120
+ }
121
+ #e(e) {
122
+ const t = this.#t;
123
+ if (!t)
96
124
  throw new Error("Metadata host not available");
97
- return t(e);
125
+ return e(t);
126
+ }
127
+ search(e, t) {
128
+ return this.#e((s) => s.search(e, t));
98
129
  }
99
- search(t, e) {
100
- return this.#t((r) => r.search(t, e));
130
+ fetchArtistBio(e, t) {
131
+ return this.#e((s) => s.fetchArtistBio(e, t));
101
132
  }
102
- fetchArtistDetails(t, e) {
103
- return this.#t((r) => r.fetchArtistDetails(t, e));
133
+ fetchArtistSocialStats(e, t) {
134
+ return this.#e(
135
+ (s) => s.fetchArtistSocialStats(e, t)
136
+ );
137
+ }
138
+ fetchArtistAlbums(e, t) {
139
+ return this.#e((s) => s.fetchArtistAlbums(e, t));
104
140
  }
105
- fetchArtistAlbums(t, e) {
106
- return this.#t((r) => r.fetchArtistAlbums(t, e));
141
+ fetchArtistTopTracks(e, t) {
142
+ return this.#e((s) => s.fetchArtistTopTracks(e, t));
107
143
  }
108
- fetchArtistTopTracks(t, e) {
109
- return this.#t((r) => r.fetchArtistTopTracks(t, e));
144
+ fetchArtistPlaylists(e, t) {
145
+ return this.#e((s) => s.fetchArtistPlaylists(e, t));
110
146
  }
111
- fetchArtistRelatedArtists(t, e) {
112
- return this.#t(
113
- (r) => r.fetchArtistRelatedArtists(t, e)
147
+ fetchArtistRelatedArtists(e, t) {
148
+ return this.#e(
149
+ (s) => s.fetchArtistRelatedArtists(e, t)
114
150
  );
115
151
  }
116
- fetchAlbumDetails(t, e) {
117
- return this.#t((r) => r.fetchAlbumDetails(t, e));
152
+ fetchAlbumDetails(e, t) {
153
+ return this.#e((s) => s.fetchAlbumDetails(e, t));
118
154
  }
119
155
  }
120
- class p {
121
- #e;
122
- constructor(t) {
123
- this.#e = t;
124
- }
125
- #t(t) {
126
- const e = this.#e;
127
- if (!e)
156
+ class Pe {
157
+ #t;
158
+ constructor(e) {
159
+ this.#t = e;
160
+ }
161
+ #e(e) {
162
+ const t = this.#t;
163
+ if (!t)
128
164
  throw new Error("Providers host not available");
129
- return t(e);
165
+ return e(t);
130
166
  }
131
- register(t) {
132
- return this.#t((e) => e.register(t));
167
+ register(e) {
168
+ return this.#e((t) => t.register(e));
133
169
  }
134
- unregister(t) {
135
- return this.#t((e) => e.unregister(t));
170
+ unregister(e) {
171
+ return this.#e((t) => t.unregister(e));
136
172
  }
137
- list(t) {
138
- return this.#t((e) => e.list(t));
173
+ list(e) {
174
+ return this.#e((t) => t.list(e));
139
175
  }
140
- get(t) {
141
- return this.#t((e) => e.get(t));
176
+ get(e) {
177
+ return this.#e((t) => t.get(e));
142
178
  }
143
179
  }
144
- class I {
145
- #e;
146
- constructor(t) {
147
- this.#e = t;
148
- }
149
- #t(t) {
150
- const e = this.#e;
151
- if (!e)
180
+ class Ve {
181
+ #t;
182
+ constructor(e) {
183
+ this.#t = e;
184
+ }
185
+ #e(e) {
186
+ const t = this.#t;
187
+ if (!t)
152
188
  throw new Error("Queue host not available");
153
- return t(e);
189
+ return e(t);
154
190
  }
155
191
  getQueue() {
156
- return this.#t((t) => t.getQueue());
192
+ return this.#e((e) => e.getQueue());
157
193
  }
158
194
  getCurrentItem() {
159
- return this.#t((t) => t.getCurrentItem());
195
+ return this.#e((e) => e.getCurrentItem());
160
196
  }
161
- addToQueue(t) {
162
- return this.#t((e) => e.addToQueue(t));
197
+ addToQueue(e) {
198
+ return this.#e((t) => t.addToQueue(e));
163
199
  }
164
- addNext(t) {
165
- return this.#t((e) => e.addNext(t));
200
+ addNext(e) {
201
+ return this.#e((t) => t.addNext(e));
166
202
  }
167
- addAt(t, e) {
168
- return this.#t((r) => r.addAt(t, e));
203
+ addAt(e, t) {
204
+ return this.#e((s) => s.addAt(e, t));
169
205
  }
170
- removeByIds(t) {
171
- return this.#t((e) => e.removeByIds(t));
206
+ removeByIds(e) {
207
+ return this.#e((t) => t.removeByIds(e));
172
208
  }
173
- removeByIndices(t) {
174
- return this.#t((e) => e.removeByIndices(t));
209
+ removeByIndices(e) {
210
+ return this.#e((t) => t.removeByIndices(e));
175
211
  }
176
212
  clearQueue() {
177
- return this.#t((t) => t.clearQueue());
213
+ return this.#e((e) => e.clearQueue());
178
214
  }
179
- reorder(t, e) {
180
- return this.#t((r) => r.reorder(t, e));
215
+ reorder(e, t) {
216
+ return this.#e((s) => s.reorder(e, t));
181
217
  }
182
- updateItemState(t, e) {
183
- return this.#t((r) => r.updateItemState(t, e));
218
+ updateItemState(e, t) {
219
+ return this.#e((s) => s.updateItemState(e, t));
184
220
  }
185
221
  goToNext() {
186
- return this.#t((t) => t.goToNext());
222
+ return this.#e((e) => e.goToNext());
187
223
  }
188
224
  goToPrevious() {
189
- return this.#t((t) => t.goToPrevious());
225
+ return this.#e((e) => e.goToPrevious());
190
226
  }
191
- goToIndex(t) {
192
- return this.#t((e) => e.goToIndex(t));
227
+ goToIndex(e) {
228
+ return this.#e((t) => t.goToIndex(e));
193
229
  }
194
- goToId(t) {
195
- return this.#t((e) => e.goToId(t));
230
+ goToId(e) {
231
+ return this.#e((t) => t.goToId(e));
196
232
  }
197
- setRepeatMode(t) {
198
- return this.#t((e) => e.setRepeatMode(t));
233
+ setRepeatMode(e) {
234
+ return this.#e((t) => t.setRepeatMode(e));
199
235
  }
200
- setShuffleEnabled(t) {
201
- return this.#t((e) => e.setShuffleEnabled(t));
236
+ setShuffleEnabled(e) {
237
+ return this.#e((t) => t.setShuffleEnabled(e));
202
238
  }
203
- subscribe(t) {
204
- return this.#t((e) => e.subscribe(t));
239
+ subscribe(e) {
240
+ return this.#e((t) => t.subscribe(e));
205
241
  }
206
- subscribeToCurrentItem(t) {
207
- return this.#t((e) => e.subscribeToCurrentItem(t));
242
+ subscribeToCurrentItem(e) {
243
+ return this.#e((t) => t.subscribeToCurrentItem(e));
208
244
  }
209
245
  }
210
- class H {
211
- #e;
212
- constructor(t) {
213
- this.#e = t;
214
- }
215
- #t(t) {
216
- const e = this.#e;
217
- if (!e)
246
+ class Le {
247
+ #t;
248
+ constructor(e) {
249
+ this.#t = e;
250
+ }
251
+ #e(e) {
252
+ const t = this.#t;
253
+ if (!t)
218
254
  throw new Error("Settings host not available");
219
- return t(e);
255
+ return e(t);
220
256
  }
221
- register(t) {
222
- return this.#t((e) => e.register(t));
257
+ register(e) {
258
+ return this.#e((t) => t.register(e));
223
259
  }
224
- get(t) {
225
- return this.#t((e) => e.get(t));
260
+ get(e) {
261
+ return this.#e((t) => t.get(e));
226
262
  }
227
- set(t, e) {
228
- return this.#t((r) => r.set(t, e));
263
+ set(e, t) {
264
+ return this.#e((s) => s.set(e, t));
229
265
  }
230
- subscribe(t, e) {
231
- return this.#t((r) => r.subscribe(t, e));
266
+ subscribe(e, t) {
267
+ return this.#e((s) => s.subscribe(e, t));
232
268
  }
233
269
  }
234
- class y {
235
- #e;
236
- constructor(t) {
237
- this.#e = t;
238
- }
239
- #t(t) {
240
- const e = this.#e;
241
- if (!e)
270
+ class ze {
271
+ #t;
272
+ constructor(e) {
273
+ this.#t = e;
274
+ }
275
+ #e(e) {
276
+ const t = this.#t;
277
+ if (!t)
242
278
  throw new Error("Streaming host not available");
243
- return t(e);
279
+ return e(t);
244
280
  }
245
- resolveCandidatesForTrack(t) {
246
- return this.#t((e) => e.resolveCandidatesForTrack(t));
281
+ resolveCandidatesForTrack(e) {
282
+ return this.#e((t) => t.resolveCandidatesForTrack(e));
247
283
  }
248
- resolveStreamForCandidate(t) {
249
- return this.#t((e) => e.resolveStreamForCandidate(t));
284
+ resolveStreamForCandidate(e) {
285
+ return this.#e((t) => t.resolveStreamForCandidate(e));
250
286
  }
251
287
  }
252
- class S {
288
+ class De {
253
289
  host;
254
- constructor(t) {
255
- this.host = t;
290
+ constructor(e) {
291
+ this.host = e;
256
292
  }
257
293
  get available() {
258
294
  return !!this.host;
259
295
  }
260
- async search(t, e) {
296
+ async search(e, t) {
261
297
  if (!this.host)
262
298
  throw new Error("YtdlpAPI: No host configured");
263
- return this.host.search(t, e);
299
+ return this.host.search(e, t);
264
300
  }
265
- async getStream(t) {
301
+ async getStream(e) {
266
302
  if (!this.host)
267
303
  throw new Error("YtdlpAPI: No host configured");
268
- return this.host.getStream(t);
304
+ return this.host.getStream(e);
269
305
  }
270
306
  }
271
- class F {
307
+ class Fe {
272
308
  Settings;
273
309
  Providers;
274
310
  Queue;
@@ -277,48 +313,49 @@ class F {
277
313
  Http;
278
314
  Ytdlp;
279
315
  Favorites;
280
- constructor(t) {
281
- this.Settings = new H(t?.settingsHost), this.Providers = new p(t?.providersHost), this.Queue = new I(t?.queueHost), this.Streaming = new y(t?.streamingHost), this.Metadata = new T(t?.metadataHost), this.Http = new w(t?.httpHost), this.Ytdlp = new S(t?.ytdlpHost), this.Favorites = new b(t?.favoritesHost);
316
+ Logger;
317
+ constructor(e) {
318
+ this.Settings = new Le(e?.settingsHost), this.Providers = new Pe(e?.providersHost), this.Queue = new Ve(e?.queueHost), this.Streaming = new ze(e?.streamingHost), this.Metadata = new Me(e?.metadataHost), this.Http = new Ee(e?.httpHost), this.Ytdlp = new De(e?.ytdlpHost), this.Favorites = new Ne(e?.favoritesHost), this.Logger = new $e(e?.loggerHost);
282
319
  }
283
320
  }
284
- class P extends F {
321
+ class bt extends Fe {
285
322
  }
286
- class M extends Error {
287
- constructor(t) {
288
- super(`Missing capability: ${t}`), this.name = "MissingCapabilityError";
323
+ class wt extends Error {
324
+ constructor(e) {
325
+ super(`Missing capability: ${e}`), this.name = "MissingCapabilityError";
289
326
  }
290
327
  }
291
- const C = (s, t) => {
292
- const [e, r] = l(void 0);
293
- f(() => {
294
- if (!s)
328
+ const At = (r, e) => {
329
+ const [t, s] = Se(void 0);
330
+ Ce(() => {
331
+ if (!r)
295
332
  return;
296
- let n = !0, u = !1;
297
- const i = s.subscribe(t, (o) => {
298
- n && (u = !0, r(o));
333
+ let n = !0, i = !1;
334
+ const o = r.subscribe(e, (u) => {
335
+ n && (i = !0, s(u));
299
336
  });
300
- return s.get(t).then((o) => {
301
- n && (u || r(o));
337
+ return r.get(e).then((u) => {
338
+ n && (i || s(u));
302
339
  }), () => {
303
- n = !1, i && i();
340
+ n = !1, o && o();
304
341
  };
305
- }, [t, s]);
306
- const a = g(
342
+ }, [e, r]);
343
+ const a = Ie(
307
344
  () => (n) => {
308
- s && s.set(t, n);
345
+ r && r.set(e, n);
309
346
  },
310
- [t, s]
347
+ [e, r]
311
348
  );
312
- return [e, a];
349
+ return [t, a];
313
350
  };
314
- function R(s, t, e) {
315
- if (!s?.items?.length)
351
+ function Tt(r, e, t) {
352
+ if (!r?.items?.length)
316
353
  return;
317
- const r = s.items.filter((i) => !(i.purpose && i.purpose !== t || !i.url));
318
- if (!r.length)
319
- return s.items[0];
320
- const a = (i) => !i.width || !i.height ? 1 : i.width / i.height, u = ((i) => {
321
- switch (i) {
354
+ const s = r.items.filter((o) => !(o.purpose && o.purpose !== e || !o.url));
355
+ if (!s.length)
356
+ return r.items[0];
357
+ const a = (o) => !o.width || !o.height ? 1 : o.width / o.height, i = ((o) => {
358
+ switch (o) {
322
359
  case "avatar":
323
360
  case "thumbnail":
324
361
  return 1;
@@ -329,22 +366,2677 @@ function R(s, t, e) {
329
366
  default:
330
367
  return 1;
331
368
  }
332
- })(t);
333
- return r.map((i) => {
334
- const o = Math.min(i.width || 0, i.height || 0), h = Math.abs(a(i) - u), c = Math.abs(o - e), d = o < e ? e / o : 1;
369
+ })(e);
370
+ return s.map((o) => {
371
+ const u = Math.min(o.width || 0, o.height || 0), f = Math.abs(a(o) - i), y = Math.abs(u - t), Z = u < t ? t / u : 1;
372
+ return {
373
+ artwork: o,
374
+ score: (Z > 1.5 ? -1e3 : 0) + -f * 50 + -y * 0.1
375
+ };
376
+ }).sort((o, u) => u.score - o.score)[0]?.artwork;
377
+ }
378
+ var _;
379
+ (function(r) {
380
+ r.assertEqual = (a) => {
381
+ };
382
+ function e(a) {
383
+ }
384
+ r.assertIs = e;
385
+ function t(a) {
386
+ throw new Error();
387
+ }
388
+ r.assertNever = t, r.arrayToEnum = (a) => {
389
+ const n = {};
390
+ for (const i of a)
391
+ n[i] = i;
392
+ return n;
393
+ }, r.getValidEnumValues = (a) => {
394
+ const n = r.objectKeys(a).filter((o) => typeof a[a[o]] != "number"), i = {};
395
+ for (const o of n)
396
+ i[o] = a[o];
397
+ return r.objectValues(i);
398
+ }, r.objectValues = (a) => r.objectKeys(a).map(function(n) {
399
+ return a[n];
400
+ }), r.objectKeys = typeof Object.keys == "function" ? (a) => Object.keys(a) : (a) => {
401
+ const n = [];
402
+ for (const i in a)
403
+ Object.prototype.hasOwnProperty.call(a, i) && n.push(i);
404
+ return n;
405
+ }, r.find = (a, n) => {
406
+ for (const i of a)
407
+ if (n(i))
408
+ return i;
409
+ }, r.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && Number.isFinite(a) && Math.floor(a) === a;
410
+ function s(a, n = " | ") {
411
+ return a.map((i) => typeof i == "string" ? `'${i}'` : i).join(n);
412
+ }
413
+ r.joinValues = s, r.jsonStringifyReplacer = (a, n) => typeof n == "bigint" ? n.toString() : n;
414
+ })(_ || (_ = {}));
415
+ var ne;
416
+ (function(r) {
417
+ r.mergeShapes = (e, t) => ({
418
+ ...e,
419
+ ...t
420
+ // second overwrites first
421
+ });
422
+ })(ne || (ne = {}));
423
+ const l = _.arrayToEnum([
424
+ "string",
425
+ "nan",
426
+ "number",
427
+ "integer",
428
+ "float",
429
+ "boolean",
430
+ "date",
431
+ "bigint",
432
+ "symbol",
433
+ "function",
434
+ "undefined",
435
+ "null",
436
+ "array",
437
+ "object",
438
+ "unknown",
439
+ "promise",
440
+ "void",
441
+ "never",
442
+ "map",
443
+ "set"
444
+ ]), S = (r) => {
445
+ switch (typeof r) {
446
+ case "undefined":
447
+ return l.undefined;
448
+ case "string":
449
+ return l.string;
450
+ case "number":
451
+ return Number.isNaN(r) ? l.nan : l.number;
452
+ case "boolean":
453
+ return l.boolean;
454
+ case "function":
455
+ return l.function;
456
+ case "bigint":
457
+ return l.bigint;
458
+ case "symbol":
459
+ return l.symbol;
460
+ case "object":
461
+ return Array.isArray(r) ? l.array : r === null ? l.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? l.promise : typeof Map < "u" && r instanceof Map ? l.map : typeof Set < "u" && r instanceof Set ? l.set : typeof Date < "u" && r instanceof Date ? l.date : l.object;
462
+ default:
463
+ return l.unknown;
464
+ }
465
+ }, d = _.arrayToEnum([
466
+ "invalid_type",
467
+ "invalid_literal",
468
+ "custom",
469
+ "invalid_union",
470
+ "invalid_union_discriminator",
471
+ "invalid_enum_value",
472
+ "unrecognized_keys",
473
+ "invalid_arguments",
474
+ "invalid_return_type",
475
+ "invalid_date",
476
+ "invalid_string",
477
+ "too_small",
478
+ "too_big",
479
+ "invalid_intersection_types",
480
+ "not_multiple_of",
481
+ "not_finite"
482
+ ]);
483
+ class T extends Error {
484
+ get errors() {
485
+ return this.issues;
486
+ }
487
+ constructor(e) {
488
+ super(), this.issues = [], this.addIssue = (s) => {
489
+ this.issues = [...this.issues, s];
490
+ }, this.addIssues = (s = []) => {
491
+ this.issues = [...this.issues, ...s];
492
+ };
493
+ const t = new.target.prototype;
494
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
495
+ }
496
+ format(e) {
497
+ const t = e || function(n) {
498
+ return n.message;
499
+ }, s = { _errors: [] }, a = (n) => {
500
+ for (const i of n.issues)
501
+ if (i.code === "invalid_union")
502
+ i.unionErrors.map(a);
503
+ else if (i.code === "invalid_return_type")
504
+ a(i.returnTypeError);
505
+ else if (i.code === "invalid_arguments")
506
+ a(i.argumentsError);
507
+ else if (i.path.length === 0)
508
+ s._errors.push(t(i));
509
+ else {
510
+ let o = s, u = 0;
511
+ for (; u < i.path.length; ) {
512
+ const f = i.path[u];
513
+ u === i.path.length - 1 ? (o[f] = o[f] || { _errors: [] }, o[f]._errors.push(t(i))) : o[f] = o[f] || { _errors: [] }, o = o[f], u++;
514
+ }
515
+ }
516
+ };
517
+ return a(this), s;
518
+ }
519
+ static assert(e) {
520
+ if (!(e instanceof T))
521
+ throw new Error(`Not a ZodError: ${e}`);
522
+ }
523
+ toString() {
524
+ return this.message;
525
+ }
526
+ get message() {
527
+ return JSON.stringify(this.issues, _.jsonStringifyReplacer, 2);
528
+ }
529
+ get isEmpty() {
530
+ return this.issues.length === 0;
531
+ }
532
+ flatten(e = (t) => t.message) {
533
+ const t = {}, s = [];
534
+ for (const a of this.issues)
535
+ if (a.path.length > 0) {
536
+ const n = a.path[0];
537
+ t[n] = t[n] || [], t[n].push(e(a));
538
+ } else
539
+ s.push(e(a));
540
+ return { formErrors: s, fieldErrors: t };
541
+ }
542
+ get formErrors() {
543
+ return this.flatten();
544
+ }
545
+ }
546
+ T.create = (r) => new T(r);
547
+ const X = (r, e) => {
548
+ let t;
549
+ switch (r.code) {
550
+ case d.invalid_type:
551
+ r.received === l.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
552
+ break;
553
+ case d.invalid_literal:
554
+ t = `Invalid literal value, expected ${JSON.stringify(r.expected, _.jsonStringifyReplacer)}`;
555
+ break;
556
+ case d.unrecognized_keys:
557
+ t = `Unrecognized key(s) in object: ${_.joinValues(r.keys, ", ")}`;
558
+ break;
559
+ case d.invalid_union:
560
+ t = "Invalid input";
561
+ break;
562
+ case d.invalid_union_discriminator:
563
+ t = `Invalid discriminator value. Expected ${_.joinValues(r.options)}`;
564
+ break;
565
+ case d.invalid_enum_value:
566
+ t = `Invalid enum value. Expected ${_.joinValues(r.options)}, received '${r.received}'`;
567
+ break;
568
+ case d.invalid_arguments:
569
+ t = "Invalid function arguments";
570
+ break;
571
+ case d.invalid_return_type:
572
+ t = "Invalid function return type";
573
+ break;
574
+ case d.invalid_date:
575
+ t = "Invalid date";
576
+ break;
577
+ case d.invalid_string:
578
+ typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : _.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
579
+ break;
580
+ case d.too_small:
581
+ r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "bigint" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
582
+ break;
583
+ case d.too_big:
584
+ r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
585
+ break;
586
+ case d.custom:
587
+ t = "Invalid input";
588
+ break;
589
+ case d.invalid_intersection_types:
590
+ t = "Intersection results could not be merged";
591
+ break;
592
+ case d.not_multiple_of:
593
+ t = `Number must be a multiple of ${r.multipleOf}`;
594
+ break;
595
+ case d.not_finite:
596
+ t = "Number must be finite";
597
+ break;
598
+ default:
599
+ t = e.defaultError, _.assertNever(r);
600
+ }
601
+ return { message: t };
602
+ };
603
+ let Be = X;
604
+ function Ue() {
605
+ return Be;
606
+ }
607
+ const He = (r) => {
608
+ const { data: e, path: t, errorMaps: s, issueData: a } = r, n = [...t, ...a.path || []], i = {
609
+ ...a,
610
+ path: n
611
+ };
612
+ if (a.message !== void 0)
613
+ return {
614
+ ...a,
615
+ path: n,
616
+ message: a.message
617
+ };
618
+ let o = "";
619
+ const u = s.filter((f) => !!f).slice().reverse();
620
+ for (const f of u)
621
+ o = f(i, { data: e, defaultError: o }).message;
622
+ return {
623
+ ...a,
624
+ path: n,
625
+ message: o
626
+ };
627
+ };
628
+ function c(r, e) {
629
+ const t = Ue(), s = He({
630
+ issueData: e,
631
+ data: r.data,
632
+ path: r.path,
633
+ errorMaps: [
634
+ r.common.contextualErrorMap,
635
+ // contextual error map is first priority
636
+ r.schemaErrorMap,
637
+ // then schema-bound map if available
638
+ t,
639
+ // then global override map
640
+ t === X ? void 0 : X
641
+ // then global default map
642
+ ].filter((a) => !!a)
643
+ });
644
+ r.common.issues.push(s);
645
+ }
646
+ class b {
647
+ constructor() {
648
+ this.value = "valid";
649
+ }
650
+ dirty() {
651
+ this.value === "valid" && (this.value = "dirty");
652
+ }
653
+ abort() {
654
+ this.value !== "aborted" && (this.value = "aborted");
655
+ }
656
+ static mergeArray(e, t) {
657
+ const s = [];
658
+ for (const a of t) {
659
+ if (a.status === "aborted")
660
+ return m;
661
+ a.status === "dirty" && e.dirty(), s.push(a.value);
662
+ }
663
+ return { status: e.value, value: s };
664
+ }
665
+ static async mergeObjectAsync(e, t) {
666
+ const s = [];
667
+ for (const a of t) {
668
+ const n = await a.key, i = await a.value;
669
+ s.push({
670
+ key: n,
671
+ value: i
672
+ });
673
+ }
674
+ return b.mergeObjectSync(e, s);
675
+ }
676
+ static mergeObjectSync(e, t) {
677
+ const s = {};
678
+ for (const a of t) {
679
+ const { key: n, value: i } = a;
680
+ if (n.status === "aborted" || i.status === "aborted")
681
+ return m;
682
+ n.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), n.value !== "__proto__" && (typeof i.value < "u" || a.alwaysSet) && (s[n.value] = i.value);
683
+ }
684
+ return { status: e.value, value: s };
685
+ }
686
+ }
687
+ const m = Object.freeze({
688
+ status: "aborted"
689
+ }), D = (r) => ({ status: "dirty", value: r }), w = (r) => ({ status: "valid", value: r }), ie = (r) => r.status === "aborted", oe = (r) => r.status === "dirty", $ = (r) => r.status === "valid", H = (r) => typeof Promise < "u" && r instanceof Promise;
690
+ var h;
691
+ (function(r) {
692
+ r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e?.message;
693
+ })(h || (h = {}));
694
+ class N {
695
+ constructor(e, t, s, a) {
696
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = a;
697
+ }
698
+ get path() {
699
+ return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
700
+ }
701
+ }
702
+ const de = (r, e) => {
703
+ if ($(e))
704
+ return { success: !0, data: e.value };
705
+ if (!r.common.issues.length)
706
+ throw new Error("Validation failed but no issues detected.");
707
+ return {
708
+ success: !1,
709
+ get error() {
710
+ if (this._error)
711
+ return this._error;
712
+ const t = new T(r.common.issues);
713
+ return this._error = t, this._error;
714
+ }
715
+ };
716
+ };
717
+ function g(r) {
718
+ if (!r)
719
+ return {};
720
+ const { errorMap: e, invalid_type_error: t, required_error: s, description: a } = r;
721
+ if (e && (t || s))
722
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
723
+ return e ? { errorMap: e, description: a } : { errorMap: (i, o) => {
724
+ const { message: u } = r;
725
+ return i.code === "invalid_enum_value" ? { message: u ?? o.defaultError } : typeof o.data > "u" ? { message: u ?? s ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: u ?? t ?? o.defaultError };
726
+ }, description: a };
727
+ }
728
+ class v {
729
+ get description() {
730
+ return this._def.description;
731
+ }
732
+ _getType(e) {
733
+ return S(e.data);
734
+ }
735
+ _getOrReturnCtx(e, t) {
736
+ return t || {
737
+ common: e.parent.common,
738
+ data: e.data,
739
+ parsedType: S(e.data),
740
+ schemaErrorMap: this._def.errorMap,
741
+ path: e.path,
742
+ parent: e.parent
743
+ };
744
+ }
745
+ _processInputParams(e) {
746
+ return {
747
+ status: new b(),
748
+ ctx: {
749
+ common: e.parent.common,
750
+ data: e.data,
751
+ parsedType: S(e.data),
752
+ schemaErrorMap: this._def.errorMap,
753
+ path: e.path,
754
+ parent: e.parent
755
+ }
756
+ };
757
+ }
758
+ _parseSync(e) {
759
+ const t = this._parse(e);
760
+ if (H(t))
761
+ throw new Error("Synchronous parse encountered promise.");
762
+ return t;
763
+ }
764
+ _parseAsync(e) {
765
+ const t = this._parse(e);
766
+ return Promise.resolve(t);
767
+ }
768
+ parse(e, t) {
769
+ const s = this.safeParse(e, t);
770
+ if (s.success)
771
+ return s.data;
772
+ throw s.error;
773
+ }
774
+ safeParse(e, t) {
775
+ const s = {
776
+ common: {
777
+ issues: [],
778
+ async: t?.async ?? !1,
779
+ contextualErrorMap: t?.errorMap
780
+ },
781
+ path: t?.path || [],
782
+ schemaErrorMap: this._def.errorMap,
783
+ parent: null,
784
+ data: e,
785
+ parsedType: S(e)
786
+ }, a = this._parseSync({ data: e, path: s.path, parent: s });
787
+ return de(s, a);
788
+ }
789
+ "~validate"(e) {
790
+ const t = {
791
+ common: {
792
+ issues: [],
793
+ async: !!this["~standard"].async
794
+ },
795
+ path: [],
796
+ schemaErrorMap: this._def.errorMap,
797
+ parent: null,
798
+ data: e,
799
+ parsedType: S(e)
800
+ };
801
+ if (!this["~standard"].async)
802
+ try {
803
+ const s = this._parseSync({ data: e, path: [], parent: t });
804
+ return $(s) ? {
805
+ value: s.value
806
+ } : {
807
+ issues: t.common.issues
808
+ };
809
+ } catch (s) {
810
+ s?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), t.common = {
811
+ issues: [],
812
+ async: !0
813
+ };
814
+ }
815
+ return this._parseAsync({ data: e, path: [], parent: t }).then((s) => $(s) ? {
816
+ value: s.value
817
+ } : {
818
+ issues: t.common.issues
819
+ });
820
+ }
821
+ async parseAsync(e, t) {
822
+ const s = await this.safeParseAsync(e, t);
823
+ if (s.success)
824
+ return s.data;
825
+ throw s.error;
826
+ }
827
+ async safeParseAsync(e, t) {
828
+ const s = {
829
+ common: {
830
+ issues: [],
831
+ contextualErrorMap: t?.errorMap,
832
+ async: !0
833
+ },
834
+ path: t?.path || [],
835
+ schemaErrorMap: this._def.errorMap,
836
+ parent: null,
837
+ data: e,
838
+ parsedType: S(e)
839
+ }, a = this._parse({ data: e, path: s.path, parent: s }), n = await (H(a) ? a : Promise.resolve(a));
840
+ return de(s, n);
841
+ }
842
+ refine(e, t) {
843
+ const s = (a) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(a) : t;
844
+ return this._refinement((a, n) => {
845
+ const i = e(a), o = () => n.addIssue({
846
+ code: d.custom,
847
+ ...s(a)
848
+ });
849
+ return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
850
+ });
851
+ }
852
+ refinement(e, t) {
853
+ return this._refinement((s, a) => e(s) ? !0 : (a.addIssue(typeof t == "function" ? t(s, a) : t), !1));
854
+ }
855
+ _refinement(e) {
856
+ return new V({
857
+ schema: this,
858
+ typeName: p.ZodEffects,
859
+ effect: { type: "refinement", refinement: e }
860
+ });
861
+ }
862
+ superRefine(e) {
863
+ return this._refinement(e);
864
+ }
865
+ constructor(e) {
866
+ this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
867
+ version: 1,
868
+ vendor: "zod",
869
+ validate: (t) => this["~validate"](t)
870
+ };
871
+ }
872
+ optional() {
873
+ return I.create(this, this._def);
874
+ }
875
+ nullable() {
876
+ return L.create(this, this._def);
877
+ }
878
+ nullish() {
879
+ return this.nullable().optional();
880
+ }
881
+ array() {
882
+ return A.create(this);
883
+ }
884
+ promise() {
885
+ return Y.create(this, this._def);
886
+ }
887
+ or(e) {
888
+ return q.create([this, e], this._def);
889
+ }
890
+ and(e) {
891
+ return Q.create(this, e, this._def);
892
+ }
893
+ transform(e) {
894
+ return new V({
895
+ ...g(this._def),
896
+ schema: this,
897
+ typeName: p.ZodEffects,
898
+ effect: { type: "transform", transform: e }
899
+ });
900
+ }
901
+ default(e) {
902
+ const t = typeof e == "function" ? e : () => e;
903
+ return new te({
904
+ ...g(this._def),
905
+ innerType: this,
906
+ defaultValue: t,
907
+ typeName: p.ZodDefault
908
+ });
909
+ }
910
+ brand() {
911
+ return new mt({
912
+ typeName: p.ZodBranded,
913
+ type: this,
914
+ ...g(this._def)
915
+ });
916
+ }
917
+ catch(e) {
918
+ const t = typeof e == "function" ? e : () => e;
919
+ return new se({
920
+ ...g(this._def),
921
+ innerType: this,
922
+ catchValue: t,
923
+ typeName: p.ZodCatch
924
+ });
925
+ }
926
+ describe(e) {
927
+ const t = this.constructor;
928
+ return new t({
929
+ ...this._def,
930
+ description: e
931
+ });
932
+ }
933
+ pipe(e) {
934
+ return ae.create(this, e);
935
+ }
936
+ readonly() {
937
+ return re.create(this);
938
+ }
939
+ isOptional() {
940
+ return this.safeParse(void 0).success;
941
+ }
942
+ isNullable() {
943
+ return this.safeParse(null).success;
944
+ }
945
+ }
946
+ const We = /^c[^\s-]{8,}$/i, qe = /^[0-9a-z]+$/, Qe = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Ye = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Je = /^[a-z0-9_-]{21}$/i, Ge = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Xe = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ke = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, et = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
947
+ let G;
948
+ const tt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, st = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, rt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, at = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, nt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, it = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, xe = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", ot = new RegExp(`^${xe}$`);
949
+ function ke(r) {
950
+ let e = "[0-5]\\d";
951
+ r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`);
952
+ const t = r.precision ? "+" : "?";
953
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
954
+ }
955
+ function dt(r) {
956
+ return new RegExp(`^${ke(r)}$`);
957
+ }
958
+ function ct(r) {
959
+ let e = `${xe}T${ke(r)}`;
960
+ const t = [];
961
+ return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
962
+ }
963
+ function ut(r, e) {
964
+ return !!((e === "v4" || !e) && tt.test(r) || (e === "v6" || !e) && rt.test(r));
965
+ }
966
+ function lt(r, e) {
967
+ if (!Ge.test(r))
968
+ return !1;
969
+ try {
970
+ const [t] = r.split(".");
971
+ if (!t)
972
+ return !1;
973
+ const s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), a = JSON.parse(atob(s));
974
+ return !(typeof a != "object" || a === null || "typ" in a && a?.typ !== "JWT" || !a.alg || e && a.alg !== e);
975
+ } catch {
976
+ return !1;
977
+ }
978
+ }
979
+ function ht(r, e) {
980
+ return !!((e === "v4" || !e) && st.test(r) || (e === "v6" || !e) && at.test(r));
981
+ }
982
+ class C extends v {
983
+ _parse(e) {
984
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== l.string) {
985
+ const n = this._getOrReturnCtx(e);
986
+ return c(n, {
987
+ code: d.invalid_type,
988
+ expected: l.string,
989
+ received: n.parsedType
990
+ }), m;
991
+ }
992
+ const s = new b();
993
+ let a;
994
+ for (const n of this._def.checks)
995
+ if (n.kind === "min")
996
+ e.data.length < n.value && (a = this._getOrReturnCtx(e, a), c(a, {
997
+ code: d.too_small,
998
+ minimum: n.value,
999
+ type: "string",
1000
+ inclusive: !0,
1001
+ exact: !1,
1002
+ message: n.message
1003
+ }), s.dirty());
1004
+ else if (n.kind === "max")
1005
+ e.data.length > n.value && (a = this._getOrReturnCtx(e, a), c(a, {
1006
+ code: d.too_big,
1007
+ maximum: n.value,
1008
+ type: "string",
1009
+ inclusive: !0,
1010
+ exact: !1,
1011
+ message: n.message
1012
+ }), s.dirty());
1013
+ else if (n.kind === "length") {
1014
+ const i = e.data.length > n.value, o = e.data.length < n.value;
1015
+ (i || o) && (a = this._getOrReturnCtx(e, a), i ? c(a, {
1016
+ code: d.too_big,
1017
+ maximum: n.value,
1018
+ type: "string",
1019
+ inclusive: !0,
1020
+ exact: !0,
1021
+ message: n.message
1022
+ }) : o && c(a, {
1023
+ code: d.too_small,
1024
+ minimum: n.value,
1025
+ type: "string",
1026
+ inclusive: !0,
1027
+ exact: !0,
1028
+ message: n.message
1029
+ }), s.dirty());
1030
+ } else if (n.kind === "email")
1031
+ Ke.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1032
+ validation: "email",
1033
+ code: d.invalid_string,
1034
+ message: n.message
1035
+ }), s.dirty());
1036
+ else if (n.kind === "emoji")
1037
+ G || (G = new RegExp(et, "u")), G.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1038
+ validation: "emoji",
1039
+ code: d.invalid_string,
1040
+ message: n.message
1041
+ }), s.dirty());
1042
+ else if (n.kind === "uuid")
1043
+ Ye.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1044
+ validation: "uuid",
1045
+ code: d.invalid_string,
1046
+ message: n.message
1047
+ }), s.dirty());
1048
+ else if (n.kind === "nanoid")
1049
+ Je.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1050
+ validation: "nanoid",
1051
+ code: d.invalid_string,
1052
+ message: n.message
1053
+ }), s.dirty());
1054
+ else if (n.kind === "cuid")
1055
+ We.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1056
+ validation: "cuid",
1057
+ code: d.invalid_string,
1058
+ message: n.message
1059
+ }), s.dirty());
1060
+ else if (n.kind === "cuid2")
1061
+ qe.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1062
+ validation: "cuid2",
1063
+ code: d.invalid_string,
1064
+ message: n.message
1065
+ }), s.dirty());
1066
+ else if (n.kind === "ulid")
1067
+ Qe.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1068
+ validation: "ulid",
1069
+ code: d.invalid_string,
1070
+ message: n.message
1071
+ }), s.dirty());
1072
+ else if (n.kind === "url")
1073
+ try {
1074
+ new URL(e.data);
1075
+ } catch {
1076
+ a = this._getOrReturnCtx(e, a), c(a, {
1077
+ validation: "url",
1078
+ code: d.invalid_string,
1079
+ message: n.message
1080
+ }), s.dirty();
1081
+ }
1082
+ else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1083
+ validation: "regex",
1084
+ code: d.invalid_string,
1085
+ message: n.message
1086
+ }), s.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (a = this._getOrReturnCtx(e, a), c(a, {
1087
+ code: d.invalid_string,
1088
+ validation: { includes: n.value, position: n.position },
1089
+ message: n.message
1090
+ }), s.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (a = this._getOrReturnCtx(e, a), c(a, {
1091
+ code: d.invalid_string,
1092
+ validation: { startsWith: n.value },
1093
+ message: n.message
1094
+ }), s.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (a = this._getOrReturnCtx(e, a), c(a, {
1095
+ code: d.invalid_string,
1096
+ validation: { endsWith: n.value },
1097
+ message: n.message
1098
+ }), s.dirty()) : n.kind === "datetime" ? ct(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1099
+ code: d.invalid_string,
1100
+ validation: "datetime",
1101
+ message: n.message
1102
+ }), s.dirty()) : n.kind === "date" ? ot.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1103
+ code: d.invalid_string,
1104
+ validation: "date",
1105
+ message: n.message
1106
+ }), s.dirty()) : n.kind === "time" ? dt(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1107
+ code: d.invalid_string,
1108
+ validation: "time",
1109
+ message: n.message
1110
+ }), s.dirty()) : n.kind === "duration" ? Xe.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1111
+ validation: "duration",
1112
+ code: d.invalid_string,
1113
+ message: n.message
1114
+ }), s.dirty()) : n.kind === "ip" ? ut(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
1115
+ validation: "ip",
1116
+ code: d.invalid_string,
1117
+ message: n.message
1118
+ }), s.dirty()) : n.kind === "jwt" ? lt(e.data, n.alg) || (a = this._getOrReturnCtx(e, a), c(a, {
1119
+ validation: "jwt",
1120
+ code: d.invalid_string,
1121
+ message: n.message
1122
+ }), s.dirty()) : n.kind === "cidr" ? ht(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
1123
+ validation: "cidr",
1124
+ code: d.invalid_string,
1125
+ message: n.message
1126
+ }), s.dirty()) : n.kind === "base64" ? nt.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1127
+ validation: "base64",
1128
+ code: d.invalid_string,
1129
+ message: n.message
1130
+ }), s.dirty()) : n.kind === "base64url" ? it.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1131
+ validation: "base64url",
1132
+ code: d.invalid_string,
1133
+ message: n.message
1134
+ }), s.dirty()) : _.assertNever(n);
1135
+ return { status: s.value, value: e.data };
1136
+ }
1137
+ _regex(e, t, s) {
1138
+ return this.refinement((a) => e.test(a), {
1139
+ validation: t,
1140
+ code: d.invalid_string,
1141
+ ...h.errToObj(s)
1142
+ });
1143
+ }
1144
+ _addCheck(e) {
1145
+ return new C({
1146
+ ...this._def,
1147
+ checks: [...this._def.checks, e]
1148
+ });
1149
+ }
1150
+ email(e) {
1151
+ return this._addCheck({ kind: "email", ...h.errToObj(e) });
1152
+ }
1153
+ url(e) {
1154
+ return this._addCheck({ kind: "url", ...h.errToObj(e) });
1155
+ }
1156
+ emoji(e) {
1157
+ return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
1158
+ }
1159
+ uuid(e) {
1160
+ return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
1161
+ }
1162
+ nanoid(e) {
1163
+ return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
1164
+ }
1165
+ cuid(e) {
1166
+ return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
1167
+ }
1168
+ cuid2(e) {
1169
+ return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
1170
+ }
1171
+ ulid(e) {
1172
+ return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
1173
+ }
1174
+ base64(e) {
1175
+ return this._addCheck({ kind: "base64", ...h.errToObj(e) });
1176
+ }
1177
+ base64url(e) {
1178
+ return this._addCheck({
1179
+ kind: "base64url",
1180
+ ...h.errToObj(e)
1181
+ });
1182
+ }
1183
+ jwt(e) {
1184
+ return this._addCheck({ kind: "jwt", ...h.errToObj(e) });
1185
+ }
1186
+ ip(e) {
1187
+ return this._addCheck({ kind: "ip", ...h.errToObj(e) });
1188
+ }
1189
+ cidr(e) {
1190
+ return this._addCheck({ kind: "cidr", ...h.errToObj(e) });
1191
+ }
1192
+ datetime(e) {
1193
+ return typeof e == "string" ? this._addCheck({
1194
+ kind: "datetime",
1195
+ precision: null,
1196
+ offset: !1,
1197
+ local: !1,
1198
+ message: e
1199
+ }) : this._addCheck({
1200
+ kind: "datetime",
1201
+ precision: typeof e?.precision > "u" ? null : e?.precision,
1202
+ offset: e?.offset ?? !1,
1203
+ local: e?.local ?? !1,
1204
+ ...h.errToObj(e?.message)
1205
+ });
1206
+ }
1207
+ date(e) {
1208
+ return this._addCheck({ kind: "date", message: e });
1209
+ }
1210
+ time(e) {
1211
+ return typeof e == "string" ? this._addCheck({
1212
+ kind: "time",
1213
+ precision: null,
1214
+ message: e
1215
+ }) : this._addCheck({
1216
+ kind: "time",
1217
+ precision: typeof e?.precision > "u" ? null : e?.precision,
1218
+ ...h.errToObj(e?.message)
1219
+ });
1220
+ }
1221
+ duration(e) {
1222
+ return this._addCheck({ kind: "duration", ...h.errToObj(e) });
1223
+ }
1224
+ regex(e, t) {
1225
+ return this._addCheck({
1226
+ kind: "regex",
1227
+ regex: e,
1228
+ ...h.errToObj(t)
1229
+ });
1230
+ }
1231
+ includes(e, t) {
1232
+ return this._addCheck({
1233
+ kind: "includes",
1234
+ value: e,
1235
+ position: t?.position,
1236
+ ...h.errToObj(t?.message)
1237
+ });
1238
+ }
1239
+ startsWith(e, t) {
1240
+ return this._addCheck({
1241
+ kind: "startsWith",
1242
+ value: e,
1243
+ ...h.errToObj(t)
1244
+ });
1245
+ }
1246
+ endsWith(e, t) {
1247
+ return this._addCheck({
1248
+ kind: "endsWith",
1249
+ value: e,
1250
+ ...h.errToObj(t)
1251
+ });
1252
+ }
1253
+ min(e, t) {
1254
+ return this._addCheck({
1255
+ kind: "min",
1256
+ value: e,
1257
+ ...h.errToObj(t)
1258
+ });
1259
+ }
1260
+ max(e, t) {
1261
+ return this._addCheck({
1262
+ kind: "max",
1263
+ value: e,
1264
+ ...h.errToObj(t)
1265
+ });
1266
+ }
1267
+ length(e, t) {
1268
+ return this._addCheck({
1269
+ kind: "length",
1270
+ value: e,
1271
+ ...h.errToObj(t)
1272
+ });
1273
+ }
1274
+ /**
1275
+ * Equivalent to `.min(1)`
1276
+ */
1277
+ nonempty(e) {
1278
+ return this.min(1, h.errToObj(e));
1279
+ }
1280
+ trim() {
1281
+ return new C({
1282
+ ...this._def,
1283
+ checks: [...this._def.checks, { kind: "trim" }]
1284
+ });
1285
+ }
1286
+ toLowerCase() {
1287
+ return new C({
1288
+ ...this._def,
1289
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1290
+ });
1291
+ }
1292
+ toUpperCase() {
1293
+ return new C({
1294
+ ...this._def,
1295
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1296
+ });
1297
+ }
1298
+ get isDatetime() {
1299
+ return !!this._def.checks.find((e) => e.kind === "datetime");
1300
+ }
1301
+ get isDate() {
1302
+ return !!this._def.checks.find((e) => e.kind === "date");
1303
+ }
1304
+ get isTime() {
1305
+ return !!this._def.checks.find((e) => e.kind === "time");
1306
+ }
1307
+ get isDuration() {
1308
+ return !!this._def.checks.find((e) => e.kind === "duration");
1309
+ }
1310
+ get isEmail() {
1311
+ return !!this._def.checks.find((e) => e.kind === "email");
1312
+ }
1313
+ get isURL() {
1314
+ return !!this._def.checks.find((e) => e.kind === "url");
1315
+ }
1316
+ get isEmoji() {
1317
+ return !!this._def.checks.find((e) => e.kind === "emoji");
1318
+ }
1319
+ get isUUID() {
1320
+ return !!this._def.checks.find((e) => e.kind === "uuid");
1321
+ }
1322
+ get isNANOID() {
1323
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
1324
+ }
1325
+ get isCUID() {
1326
+ return !!this._def.checks.find((e) => e.kind === "cuid");
1327
+ }
1328
+ get isCUID2() {
1329
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
1330
+ }
1331
+ get isULID() {
1332
+ return !!this._def.checks.find((e) => e.kind === "ulid");
1333
+ }
1334
+ get isIP() {
1335
+ return !!this._def.checks.find((e) => e.kind === "ip");
1336
+ }
1337
+ get isCIDR() {
1338
+ return !!this._def.checks.find((e) => e.kind === "cidr");
1339
+ }
1340
+ get isBase64() {
1341
+ return !!this._def.checks.find((e) => e.kind === "base64");
1342
+ }
1343
+ get isBase64url() {
1344
+ return !!this._def.checks.find((e) => e.kind === "base64url");
1345
+ }
1346
+ get minLength() {
1347
+ let e = null;
1348
+ for (const t of this._def.checks)
1349
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1350
+ return e;
1351
+ }
1352
+ get maxLength() {
1353
+ let e = null;
1354
+ for (const t of this._def.checks)
1355
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1356
+ return e;
1357
+ }
1358
+ }
1359
+ C.create = (r) => new C({
1360
+ checks: [],
1361
+ typeName: p.ZodString,
1362
+ coerce: r?.coerce ?? !1,
1363
+ ...g(r)
1364
+ });
1365
+ function ft(r, e) {
1366
+ const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, a = t > s ? t : s, n = Number.parseInt(r.toFixed(a).replace(".", "")), i = Number.parseInt(e.toFixed(a).replace(".", ""));
1367
+ return n % i / 10 ** a;
1368
+ }
1369
+ class M extends v {
1370
+ constructor() {
1371
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1372
+ }
1373
+ _parse(e) {
1374
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== l.number) {
1375
+ const n = this._getOrReturnCtx(e);
1376
+ return c(n, {
1377
+ code: d.invalid_type,
1378
+ expected: l.number,
1379
+ received: n.parsedType
1380
+ }), m;
1381
+ }
1382
+ let s;
1383
+ const a = new b();
1384
+ for (const n of this._def.checks)
1385
+ n.kind === "int" ? _.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
1386
+ code: d.invalid_type,
1387
+ expected: "integer",
1388
+ received: "float",
1389
+ message: n.message
1390
+ }), a.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (s = this._getOrReturnCtx(e, s), c(s, {
1391
+ code: d.too_small,
1392
+ minimum: n.value,
1393
+ type: "number",
1394
+ inclusive: n.inclusive,
1395
+ exact: !1,
1396
+ message: n.message
1397
+ }), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (s = this._getOrReturnCtx(e, s), c(s, {
1398
+ code: d.too_big,
1399
+ maximum: n.value,
1400
+ type: "number",
1401
+ inclusive: n.inclusive,
1402
+ exact: !1,
1403
+ message: n.message
1404
+ }), a.dirty()) : n.kind === "multipleOf" ? ft(e.data, n.value) !== 0 && (s = this._getOrReturnCtx(e, s), c(s, {
1405
+ code: d.not_multiple_of,
1406
+ multipleOf: n.value,
1407
+ message: n.message
1408
+ }), a.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
1409
+ code: d.not_finite,
1410
+ message: n.message
1411
+ }), a.dirty()) : _.assertNever(n);
1412
+ return { status: a.value, value: e.data };
1413
+ }
1414
+ gte(e, t) {
1415
+ return this.setLimit("min", e, !0, h.toString(t));
1416
+ }
1417
+ gt(e, t) {
1418
+ return this.setLimit("min", e, !1, h.toString(t));
1419
+ }
1420
+ lte(e, t) {
1421
+ return this.setLimit("max", e, !0, h.toString(t));
1422
+ }
1423
+ lt(e, t) {
1424
+ return this.setLimit("max", e, !1, h.toString(t));
1425
+ }
1426
+ setLimit(e, t, s, a) {
1427
+ return new M({
1428
+ ...this._def,
1429
+ checks: [
1430
+ ...this._def.checks,
1431
+ {
1432
+ kind: e,
1433
+ value: t,
1434
+ inclusive: s,
1435
+ message: h.toString(a)
1436
+ }
1437
+ ]
1438
+ });
1439
+ }
1440
+ _addCheck(e) {
1441
+ return new M({
1442
+ ...this._def,
1443
+ checks: [...this._def.checks, e]
1444
+ });
1445
+ }
1446
+ int(e) {
1447
+ return this._addCheck({
1448
+ kind: "int",
1449
+ message: h.toString(e)
1450
+ });
1451
+ }
1452
+ positive(e) {
1453
+ return this._addCheck({
1454
+ kind: "min",
1455
+ value: 0,
1456
+ inclusive: !1,
1457
+ message: h.toString(e)
1458
+ });
1459
+ }
1460
+ negative(e) {
1461
+ return this._addCheck({
1462
+ kind: "max",
1463
+ value: 0,
1464
+ inclusive: !1,
1465
+ message: h.toString(e)
1466
+ });
1467
+ }
1468
+ nonpositive(e) {
1469
+ return this._addCheck({
1470
+ kind: "max",
1471
+ value: 0,
1472
+ inclusive: !0,
1473
+ message: h.toString(e)
1474
+ });
1475
+ }
1476
+ nonnegative(e) {
1477
+ return this._addCheck({
1478
+ kind: "min",
1479
+ value: 0,
1480
+ inclusive: !0,
1481
+ message: h.toString(e)
1482
+ });
1483
+ }
1484
+ multipleOf(e, t) {
1485
+ return this._addCheck({
1486
+ kind: "multipleOf",
1487
+ value: e,
1488
+ message: h.toString(t)
1489
+ });
1490
+ }
1491
+ finite(e) {
1492
+ return this._addCheck({
1493
+ kind: "finite",
1494
+ message: h.toString(e)
1495
+ });
1496
+ }
1497
+ safe(e) {
1498
+ return this._addCheck({
1499
+ kind: "min",
1500
+ inclusive: !0,
1501
+ value: Number.MIN_SAFE_INTEGER,
1502
+ message: h.toString(e)
1503
+ })._addCheck({
1504
+ kind: "max",
1505
+ inclusive: !0,
1506
+ value: Number.MAX_SAFE_INTEGER,
1507
+ message: h.toString(e)
1508
+ });
1509
+ }
1510
+ get minValue() {
1511
+ let e = null;
1512
+ for (const t of this._def.checks)
1513
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1514
+ return e;
1515
+ }
1516
+ get maxValue() {
1517
+ let e = null;
1518
+ for (const t of this._def.checks)
1519
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1520
+ return e;
1521
+ }
1522
+ get isInt() {
1523
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && _.isInteger(e.value));
1524
+ }
1525
+ get isFinite() {
1526
+ let e = null, t = null;
1527
+ for (const s of this._def.checks) {
1528
+ if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
1529
+ return !0;
1530
+ s.kind === "min" ? (t === null || s.value > t) && (t = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
1531
+ }
1532
+ return Number.isFinite(t) && Number.isFinite(e);
1533
+ }
1534
+ }
1535
+ M.create = (r) => new M({
1536
+ checks: [],
1537
+ typeName: p.ZodNumber,
1538
+ coerce: r?.coerce || !1,
1539
+ ...g(r)
1540
+ });
1541
+ class F extends v {
1542
+ constructor() {
1543
+ super(...arguments), this.min = this.gte, this.max = this.lte;
1544
+ }
1545
+ _parse(e) {
1546
+ if (this._def.coerce)
1547
+ try {
1548
+ e.data = BigInt(e.data);
1549
+ } catch {
1550
+ return this._getInvalidInput(e);
1551
+ }
1552
+ if (this._getType(e) !== l.bigint)
1553
+ return this._getInvalidInput(e);
1554
+ let s;
1555
+ const a = new b();
1556
+ for (const n of this._def.checks)
1557
+ n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (s = this._getOrReturnCtx(e, s), c(s, {
1558
+ code: d.too_small,
1559
+ type: "bigint",
1560
+ minimum: n.value,
1561
+ inclusive: n.inclusive,
1562
+ message: n.message
1563
+ }), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (s = this._getOrReturnCtx(e, s), c(s, {
1564
+ code: d.too_big,
1565
+ type: "bigint",
1566
+ maximum: n.value,
1567
+ inclusive: n.inclusive,
1568
+ message: n.message
1569
+ }), a.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), c(s, {
1570
+ code: d.not_multiple_of,
1571
+ multipleOf: n.value,
1572
+ message: n.message
1573
+ }), a.dirty()) : _.assertNever(n);
1574
+ return { status: a.value, value: e.data };
1575
+ }
1576
+ _getInvalidInput(e) {
1577
+ const t = this._getOrReturnCtx(e);
1578
+ return c(t, {
1579
+ code: d.invalid_type,
1580
+ expected: l.bigint,
1581
+ received: t.parsedType
1582
+ }), m;
1583
+ }
1584
+ gte(e, t) {
1585
+ return this.setLimit("min", e, !0, h.toString(t));
1586
+ }
1587
+ gt(e, t) {
1588
+ return this.setLimit("min", e, !1, h.toString(t));
1589
+ }
1590
+ lte(e, t) {
1591
+ return this.setLimit("max", e, !0, h.toString(t));
1592
+ }
1593
+ lt(e, t) {
1594
+ return this.setLimit("max", e, !1, h.toString(t));
1595
+ }
1596
+ setLimit(e, t, s, a) {
1597
+ return new F({
1598
+ ...this._def,
1599
+ checks: [
1600
+ ...this._def.checks,
1601
+ {
1602
+ kind: e,
1603
+ value: t,
1604
+ inclusive: s,
1605
+ message: h.toString(a)
1606
+ }
1607
+ ]
1608
+ });
1609
+ }
1610
+ _addCheck(e) {
1611
+ return new F({
1612
+ ...this._def,
1613
+ checks: [...this._def.checks, e]
1614
+ });
1615
+ }
1616
+ positive(e) {
1617
+ return this._addCheck({
1618
+ kind: "min",
1619
+ value: BigInt(0),
1620
+ inclusive: !1,
1621
+ message: h.toString(e)
1622
+ });
1623
+ }
1624
+ negative(e) {
1625
+ return this._addCheck({
1626
+ kind: "max",
1627
+ value: BigInt(0),
1628
+ inclusive: !1,
1629
+ message: h.toString(e)
1630
+ });
1631
+ }
1632
+ nonpositive(e) {
1633
+ return this._addCheck({
1634
+ kind: "max",
1635
+ value: BigInt(0),
1636
+ inclusive: !0,
1637
+ message: h.toString(e)
1638
+ });
1639
+ }
1640
+ nonnegative(e) {
1641
+ return this._addCheck({
1642
+ kind: "min",
1643
+ value: BigInt(0),
1644
+ inclusive: !0,
1645
+ message: h.toString(e)
1646
+ });
1647
+ }
1648
+ multipleOf(e, t) {
1649
+ return this._addCheck({
1650
+ kind: "multipleOf",
1651
+ value: e,
1652
+ message: h.toString(t)
1653
+ });
1654
+ }
1655
+ get minValue() {
1656
+ let e = null;
1657
+ for (const t of this._def.checks)
1658
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1659
+ return e;
1660
+ }
1661
+ get maxValue() {
1662
+ let e = null;
1663
+ for (const t of this._def.checks)
1664
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1665
+ return e;
1666
+ }
1667
+ }
1668
+ F.create = (r) => new F({
1669
+ checks: [],
1670
+ typeName: p.ZodBigInt,
1671
+ coerce: r?.coerce ?? !1,
1672
+ ...g(r)
1673
+ });
1674
+ class K extends v {
1675
+ _parse(e) {
1676
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== l.boolean) {
1677
+ const s = this._getOrReturnCtx(e);
1678
+ return c(s, {
1679
+ code: d.invalid_type,
1680
+ expected: l.boolean,
1681
+ received: s.parsedType
1682
+ }), m;
1683
+ }
1684
+ return w(e.data);
1685
+ }
1686
+ }
1687
+ K.create = (r) => new K({
1688
+ typeName: p.ZodBoolean,
1689
+ coerce: r?.coerce || !1,
1690
+ ...g(r)
1691
+ });
1692
+ class W extends v {
1693
+ _parse(e) {
1694
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== l.date) {
1695
+ const n = this._getOrReturnCtx(e);
1696
+ return c(n, {
1697
+ code: d.invalid_type,
1698
+ expected: l.date,
1699
+ received: n.parsedType
1700
+ }), m;
1701
+ }
1702
+ if (Number.isNaN(e.data.getTime())) {
1703
+ const n = this._getOrReturnCtx(e);
1704
+ return c(n, {
1705
+ code: d.invalid_date
1706
+ }), m;
1707
+ }
1708
+ const s = new b();
1709
+ let a;
1710
+ for (const n of this._def.checks)
1711
+ n.kind === "min" ? e.data.getTime() < n.value && (a = this._getOrReturnCtx(e, a), c(a, {
1712
+ code: d.too_small,
1713
+ message: n.message,
1714
+ inclusive: !0,
1715
+ exact: !1,
1716
+ minimum: n.value,
1717
+ type: "date"
1718
+ }), s.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (a = this._getOrReturnCtx(e, a), c(a, {
1719
+ code: d.too_big,
1720
+ message: n.message,
1721
+ inclusive: !0,
1722
+ exact: !1,
1723
+ maximum: n.value,
1724
+ type: "date"
1725
+ }), s.dirty()) : _.assertNever(n);
335
1726
  return {
336
- artwork: i,
337
- score: (d > 1.5 ? -1e3 : 0) + -h * 50 + -c * 0.1
1727
+ status: s.value,
1728
+ value: new Date(e.data.getTime())
1729
+ };
1730
+ }
1731
+ _addCheck(e) {
1732
+ return new W({
1733
+ ...this._def,
1734
+ checks: [...this._def.checks, e]
1735
+ });
1736
+ }
1737
+ min(e, t) {
1738
+ return this._addCheck({
1739
+ kind: "min",
1740
+ value: e.getTime(),
1741
+ message: h.toString(t)
1742
+ });
1743
+ }
1744
+ max(e, t) {
1745
+ return this._addCheck({
1746
+ kind: "max",
1747
+ value: e.getTime(),
1748
+ message: h.toString(t)
1749
+ });
1750
+ }
1751
+ get minDate() {
1752
+ let e = null;
1753
+ for (const t of this._def.checks)
1754
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1755
+ return e != null ? new Date(e) : null;
1756
+ }
1757
+ get maxDate() {
1758
+ let e = null;
1759
+ for (const t of this._def.checks)
1760
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1761
+ return e != null ? new Date(e) : null;
1762
+ }
1763
+ }
1764
+ W.create = (r) => new W({
1765
+ checks: [],
1766
+ coerce: r?.coerce || !1,
1767
+ typeName: p.ZodDate,
1768
+ ...g(r)
1769
+ });
1770
+ class ce extends v {
1771
+ _parse(e) {
1772
+ if (this._getType(e) !== l.symbol) {
1773
+ const s = this._getOrReturnCtx(e);
1774
+ return c(s, {
1775
+ code: d.invalid_type,
1776
+ expected: l.symbol,
1777
+ received: s.parsedType
1778
+ }), m;
1779
+ }
1780
+ return w(e.data);
1781
+ }
1782
+ }
1783
+ ce.create = (r) => new ce({
1784
+ typeName: p.ZodSymbol,
1785
+ ...g(r)
1786
+ });
1787
+ class ue extends v {
1788
+ _parse(e) {
1789
+ if (this._getType(e) !== l.undefined) {
1790
+ const s = this._getOrReturnCtx(e);
1791
+ return c(s, {
1792
+ code: d.invalid_type,
1793
+ expected: l.undefined,
1794
+ received: s.parsedType
1795
+ }), m;
1796
+ }
1797
+ return w(e.data);
1798
+ }
1799
+ }
1800
+ ue.create = (r) => new ue({
1801
+ typeName: p.ZodUndefined,
1802
+ ...g(r)
1803
+ });
1804
+ class le extends v {
1805
+ _parse(e) {
1806
+ if (this._getType(e) !== l.null) {
1807
+ const s = this._getOrReturnCtx(e);
1808
+ return c(s, {
1809
+ code: d.invalid_type,
1810
+ expected: l.null,
1811
+ received: s.parsedType
1812
+ }), m;
1813
+ }
1814
+ return w(e.data);
1815
+ }
1816
+ }
1817
+ le.create = (r) => new le({
1818
+ typeName: p.ZodNull,
1819
+ ...g(r)
1820
+ });
1821
+ class he extends v {
1822
+ constructor() {
1823
+ super(...arguments), this._any = !0;
1824
+ }
1825
+ _parse(e) {
1826
+ return w(e.data);
1827
+ }
1828
+ }
1829
+ he.create = (r) => new he({
1830
+ typeName: p.ZodAny,
1831
+ ...g(r)
1832
+ });
1833
+ class fe extends v {
1834
+ constructor() {
1835
+ super(...arguments), this._unknown = !0;
1836
+ }
1837
+ _parse(e) {
1838
+ return w(e.data);
1839
+ }
1840
+ }
1841
+ fe.create = (r) => new fe({
1842
+ typeName: p.ZodUnknown,
1843
+ ...g(r)
1844
+ });
1845
+ class O extends v {
1846
+ _parse(e) {
1847
+ const t = this._getOrReturnCtx(e);
1848
+ return c(t, {
1849
+ code: d.invalid_type,
1850
+ expected: l.never,
1851
+ received: t.parsedType
1852
+ }), m;
1853
+ }
1854
+ }
1855
+ O.create = (r) => new O({
1856
+ typeName: p.ZodNever,
1857
+ ...g(r)
1858
+ });
1859
+ class me extends v {
1860
+ _parse(e) {
1861
+ if (this._getType(e) !== l.undefined) {
1862
+ const s = this._getOrReturnCtx(e);
1863
+ return c(s, {
1864
+ code: d.invalid_type,
1865
+ expected: l.void,
1866
+ received: s.parsedType
1867
+ }), m;
1868
+ }
1869
+ return w(e.data);
1870
+ }
1871
+ }
1872
+ me.create = (r) => new me({
1873
+ typeName: p.ZodVoid,
1874
+ ...g(r)
1875
+ });
1876
+ class A extends v {
1877
+ _parse(e) {
1878
+ const { ctx: t, status: s } = this._processInputParams(e), a = this._def;
1879
+ if (t.parsedType !== l.array)
1880
+ return c(t, {
1881
+ code: d.invalid_type,
1882
+ expected: l.array,
1883
+ received: t.parsedType
1884
+ }), m;
1885
+ if (a.exactLength !== null) {
1886
+ const i = t.data.length > a.exactLength.value, o = t.data.length < a.exactLength.value;
1887
+ (i || o) && (c(t, {
1888
+ code: i ? d.too_big : d.too_small,
1889
+ minimum: o ? a.exactLength.value : void 0,
1890
+ maximum: i ? a.exactLength.value : void 0,
1891
+ type: "array",
1892
+ inclusive: !0,
1893
+ exact: !0,
1894
+ message: a.exactLength.message
1895
+ }), s.dirty());
1896
+ }
1897
+ if (a.minLength !== null && t.data.length < a.minLength.value && (c(t, {
1898
+ code: d.too_small,
1899
+ minimum: a.minLength.value,
1900
+ type: "array",
1901
+ inclusive: !0,
1902
+ exact: !1,
1903
+ message: a.minLength.message
1904
+ }), s.dirty()), a.maxLength !== null && t.data.length > a.maxLength.value && (c(t, {
1905
+ code: d.too_big,
1906
+ maximum: a.maxLength.value,
1907
+ type: "array",
1908
+ inclusive: !0,
1909
+ exact: !1,
1910
+ message: a.maxLength.message
1911
+ }), s.dirty()), t.common.async)
1912
+ return Promise.all([...t.data].map((i, o) => a.type._parseAsync(new N(t, i, t.path, o)))).then((i) => b.mergeArray(s, i));
1913
+ const n = [...t.data].map((i, o) => a.type._parseSync(new N(t, i, t.path, o)));
1914
+ return b.mergeArray(s, n);
1915
+ }
1916
+ get element() {
1917
+ return this._def.type;
1918
+ }
1919
+ min(e, t) {
1920
+ return new A({
1921
+ ...this._def,
1922
+ minLength: { value: e, message: h.toString(t) }
1923
+ });
1924
+ }
1925
+ max(e, t) {
1926
+ return new A({
1927
+ ...this._def,
1928
+ maxLength: { value: e, message: h.toString(t) }
1929
+ });
1930
+ }
1931
+ length(e, t) {
1932
+ return new A({
1933
+ ...this._def,
1934
+ exactLength: { value: e, message: h.toString(t) }
1935
+ });
1936
+ }
1937
+ nonempty(e) {
1938
+ return this.min(1, e);
1939
+ }
1940
+ }
1941
+ A.create = (r, e) => new A({
1942
+ type: r,
1943
+ minLength: null,
1944
+ maxLength: null,
1945
+ exactLength: null,
1946
+ typeName: p.ZodArray,
1947
+ ...g(e)
1948
+ });
1949
+ function j(r) {
1950
+ if (r instanceof k) {
1951
+ const e = {};
1952
+ for (const t in r.shape) {
1953
+ const s = r.shape[t];
1954
+ e[t] = I.create(j(s));
1955
+ }
1956
+ return new k({
1957
+ ...r._def,
1958
+ shape: () => e
1959
+ });
1960
+ } else return r instanceof A ? new A({
1961
+ ...r._def,
1962
+ type: j(r.element)
1963
+ }) : r instanceof I ? I.create(j(r.unwrap())) : r instanceof L ? L.create(j(r.unwrap())) : r instanceof E ? E.create(r.items.map((e) => j(e))) : r;
1964
+ }
1965
+ class k extends v {
1966
+ constructor() {
1967
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1968
+ }
1969
+ _getCached() {
1970
+ if (this._cached !== null)
1971
+ return this._cached;
1972
+ const e = this._def.shape(), t = _.objectKeys(e);
1973
+ return this._cached = { shape: e, keys: t }, this._cached;
1974
+ }
1975
+ _parse(e) {
1976
+ if (this._getType(e) !== l.object) {
1977
+ const f = this._getOrReturnCtx(e);
1978
+ return c(f, {
1979
+ code: d.invalid_type,
1980
+ expected: l.object,
1981
+ received: f.parsedType
1982
+ }), m;
1983
+ }
1984
+ const { status: s, ctx: a } = this._processInputParams(e), { shape: n, keys: i } = this._getCached(), o = [];
1985
+ if (!(this._def.catchall instanceof O && this._def.unknownKeys === "strip"))
1986
+ for (const f in a.data)
1987
+ i.includes(f) || o.push(f);
1988
+ const u = [];
1989
+ for (const f of i) {
1990
+ const y = n[f], Z = a.data[f];
1991
+ u.push({
1992
+ key: { status: "valid", value: f },
1993
+ value: y._parse(new N(a, Z, a.path, f)),
1994
+ alwaysSet: f in a.data
1995
+ });
1996
+ }
1997
+ if (this._def.catchall instanceof O) {
1998
+ const f = this._def.unknownKeys;
1999
+ if (f === "passthrough")
2000
+ for (const y of o)
2001
+ u.push({
2002
+ key: { status: "valid", value: y },
2003
+ value: { status: "valid", value: a.data[y] }
2004
+ });
2005
+ else if (f === "strict")
2006
+ o.length > 0 && (c(a, {
2007
+ code: d.unrecognized_keys,
2008
+ keys: o
2009
+ }), s.dirty());
2010
+ else if (f !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
2011
+ } else {
2012
+ const f = this._def.catchall;
2013
+ for (const y of o) {
2014
+ const Z = a.data[y];
2015
+ u.push({
2016
+ key: { status: "valid", value: y },
2017
+ value: f._parse(
2018
+ new N(a, Z, a.path, y)
2019
+ //, ctx.child(key), value, getParsedType(value)
2020
+ ),
2021
+ alwaysSet: y in a.data
2022
+ });
2023
+ }
2024
+ }
2025
+ return a.common.async ? Promise.resolve().then(async () => {
2026
+ const f = [];
2027
+ for (const y of u) {
2028
+ const Z = await y.key, Te = await y.value;
2029
+ f.push({
2030
+ key: Z,
2031
+ value: Te,
2032
+ alwaysSet: y.alwaysSet
2033
+ });
2034
+ }
2035
+ return f;
2036
+ }).then((f) => b.mergeObjectSync(s, f)) : b.mergeObjectSync(s, u);
2037
+ }
2038
+ get shape() {
2039
+ return this._def.shape();
2040
+ }
2041
+ strict(e) {
2042
+ return h.errToObj, new k({
2043
+ ...this._def,
2044
+ unknownKeys: "strict",
2045
+ ...e !== void 0 ? {
2046
+ errorMap: (t, s) => {
2047
+ const a = this._def.errorMap?.(t, s).message ?? s.defaultError;
2048
+ return t.code === "unrecognized_keys" ? {
2049
+ message: h.errToObj(e).message ?? a
2050
+ } : {
2051
+ message: a
2052
+ };
2053
+ }
2054
+ } : {}
2055
+ });
2056
+ }
2057
+ strip() {
2058
+ return new k({
2059
+ ...this._def,
2060
+ unknownKeys: "strip"
2061
+ });
2062
+ }
2063
+ passthrough() {
2064
+ return new k({
2065
+ ...this._def,
2066
+ unknownKeys: "passthrough"
2067
+ });
2068
+ }
2069
+ // const AugmentFactory =
2070
+ // <Def extends ZodObjectDef>(def: Def) =>
2071
+ // <Augmentation extends ZodRawShape>(
2072
+ // augmentation: Augmentation
2073
+ // ): ZodObject<
2074
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
2075
+ // Def["unknownKeys"],
2076
+ // Def["catchall"]
2077
+ // > => {
2078
+ // return new ZodObject({
2079
+ // ...def,
2080
+ // shape: () => ({
2081
+ // ...def.shape(),
2082
+ // ...augmentation,
2083
+ // }),
2084
+ // }) as any;
2085
+ // };
2086
+ extend(e) {
2087
+ return new k({
2088
+ ...this._def,
2089
+ shape: () => ({
2090
+ ...this._def.shape(),
2091
+ ...e
2092
+ })
2093
+ });
2094
+ }
2095
+ /**
2096
+ * Prior to zod@1.0.12 there was a bug in the
2097
+ * inferred type of merged objects. Please
2098
+ * upgrade if you are experiencing issues.
2099
+ */
2100
+ merge(e) {
2101
+ return new k({
2102
+ unknownKeys: e._def.unknownKeys,
2103
+ catchall: e._def.catchall,
2104
+ shape: () => ({
2105
+ ...this._def.shape(),
2106
+ ...e._def.shape()
2107
+ }),
2108
+ typeName: p.ZodObject
2109
+ });
2110
+ }
2111
+ // merge<
2112
+ // Incoming extends AnyZodObject,
2113
+ // Augmentation extends Incoming["shape"],
2114
+ // NewOutput extends {
2115
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2116
+ // ? Augmentation[k]["_output"]
2117
+ // : k extends keyof Output
2118
+ // ? Output[k]
2119
+ // : never;
2120
+ // },
2121
+ // NewInput extends {
2122
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2123
+ // ? Augmentation[k]["_input"]
2124
+ // : k extends keyof Input
2125
+ // ? Input[k]
2126
+ // : never;
2127
+ // }
2128
+ // >(
2129
+ // merging: Incoming
2130
+ // ): ZodObject<
2131
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2132
+ // Incoming["_def"]["unknownKeys"],
2133
+ // Incoming["_def"]["catchall"],
2134
+ // NewOutput,
2135
+ // NewInput
2136
+ // > {
2137
+ // const merged: any = new ZodObject({
2138
+ // unknownKeys: merging._def.unknownKeys,
2139
+ // catchall: merging._def.catchall,
2140
+ // shape: () =>
2141
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2142
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2143
+ // }) as any;
2144
+ // return merged;
2145
+ // }
2146
+ setKey(e, t) {
2147
+ return this.augment({ [e]: t });
2148
+ }
2149
+ // merge<Incoming extends AnyZodObject>(
2150
+ // merging: Incoming
2151
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2152
+ // ZodObject<
2153
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2154
+ // Incoming["_def"]["unknownKeys"],
2155
+ // Incoming["_def"]["catchall"]
2156
+ // > {
2157
+ // // const mergedShape = objectUtil.mergeShapes(
2158
+ // // this._def.shape(),
2159
+ // // merging._def.shape()
2160
+ // // );
2161
+ // const merged: any = new ZodObject({
2162
+ // unknownKeys: merging._def.unknownKeys,
2163
+ // catchall: merging._def.catchall,
2164
+ // shape: () =>
2165
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2166
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2167
+ // }) as any;
2168
+ // return merged;
2169
+ // }
2170
+ catchall(e) {
2171
+ return new k({
2172
+ ...this._def,
2173
+ catchall: e
2174
+ });
2175
+ }
2176
+ pick(e) {
2177
+ const t = {};
2178
+ for (const s of _.objectKeys(e))
2179
+ e[s] && this.shape[s] && (t[s] = this.shape[s]);
2180
+ return new k({
2181
+ ...this._def,
2182
+ shape: () => t
2183
+ });
2184
+ }
2185
+ omit(e) {
2186
+ const t = {};
2187
+ for (const s of _.objectKeys(this.shape))
2188
+ e[s] || (t[s] = this.shape[s]);
2189
+ return new k({
2190
+ ...this._def,
2191
+ shape: () => t
2192
+ });
2193
+ }
2194
+ /**
2195
+ * @deprecated
2196
+ */
2197
+ deepPartial() {
2198
+ return j(this);
2199
+ }
2200
+ partial(e) {
2201
+ const t = {};
2202
+ for (const s of _.objectKeys(this.shape)) {
2203
+ const a = this.shape[s];
2204
+ e && !e[s] ? t[s] = a : t[s] = a.optional();
2205
+ }
2206
+ return new k({
2207
+ ...this._def,
2208
+ shape: () => t
2209
+ });
2210
+ }
2211
+ required(e) {
2212
+ const t = {};
2213
+ for (const s of _.objectKeys(this.shape))
2214
+ if (e && !e[s])
2215
+ t[s] = this.shape[s];
2216
+ else {
2217
+ let n = this.shape[s];
2218
+ for (; n instanceof I; )
2219
+ n = n._def.innerType;
2220
+ t[s] = n;
2221
+ }
2222
+ return new k({
2223
+ ...this._def,
2224
+ shape: () => t
2225
+ });
2226
+ }
2227
+ keyof() {
2228
+ return be(_.objectKeys(this.shape));
2229
+ }
2230
+ }
2231
+ k.create = (r, e) => new k({
2232
+ shape: () => r,
2233
+ unknownKeys: "strip",
2234
+ catchall: O.create(),
2235
+ typeName: p.ZodObject,
2236
+ ...g(e)
2237
+ });
2238
+ k.strictCreate = (r, e) => new k({
2239
+ shape: () => r,
2240
+ unknownKeys: "strict",
2241
+ catchall: O.create(),
2242
+ typeName: p.ZodObject,
2243
+ ...g(e)
2244
+ });
2245
+ k.lazycreate = (r, e) => new k({
2246
+ shape: r,
2247
+ unknownKeys: "strip",
2248
+ catchall: O.create(),
2249
+ typeName: p.ZodObject,
2250
+ ...g(e)
2251
+ });
2252
+ class q extends v {
2253
+ _parse(e) {
2254
+ const { ctx: t } = this._processInputParams(e), s = this._def.options;
2255
+ function a(n) {
2256
+ for (const o of n)
2257
+ if (o.result.status === "valid")
2258
+ return o.result;
2259
+ for (const o of n)
2260
+ if (o.result.status === "dirty")
2261
+ return t.common.issues.push(...o.ctx.common.issues), o.result;
2262
+ const i = n.map((o) => new T(o.ctx.common.issues));
2263
+ return c(t, {
2264
+ code: d.invalid_union,
2265
+ unionErrors: i
2266
+ }), m;
2267
+ }
2268
+ if (t.common.async)
2269
+ return Promise.all(s.map(async (n) => {
2270
+ const i = {
2271
+ ...t,
2272
+ common: {
2273
+ ...t.common,
2274
+ issues: []
2275
+ },
2276
+ parent: null
2277
+ };
2278
+ return {
2279
+ result: await n._parseAsync({
2280
+ data: t.data,
2281
+ path: t.path,
2282
+ parent: i
2283
+ }),
2284
+ ctx: i
2285
+ };
2286
+ })).then(a);
2287
+ {
2288
+ let n;
2289
+ const i = [];
2290
+ for (const u of s) {
2291
+ const f = {
2292
+ ...t,
2293
+ common: {
2294
+ ...t.common,
2295
+ issues: []
2296
+ },
2297
+ parent: null
2298
+ }, y = u._parseSync({
2299
+ data: t.data,
2300
+ path: t.path,
2301
+ parent: f
2302
+ });
2303
+ if (y.status === "valid")
2304
+ return y;
2305
+ y.status === "dirty" && !n && (n = { result: y, ctx: f }), f.common.issues.length && i.push(f.common.issues);
2306
+ }
2307
+ if (n)
2308
+ return t.common.issues.push(...n.ctx.common.issues), n.result;
2309
+ const o = i.map((u) => new T(u));
2310
+ return c(t, {
2311
+ code: d.invalid_union,
2312
+ unionErrors: o
2313
+ }), m;
2314
+ }
2315
+ }
2316
+ get options() {
2317
+ return this._def.options;
2318
+ }
2319
+ }
2320
+ q.create = (r, e) => new q({
2321
+ options: r,
2322
+ typeName: p.ZodUnion,
2323
+ ...g(e)
2324
+ });
2325
+ function ee(r, e) {
2326
+ const t = S(r), s = S(e);
2327
+ if (r === e)
2328
+ return { valid: !0, data: r };
2329
+ if (t === l.object && s === l.object) {
2330
+ const a = _.objectKeys(e), n = _.objectKeys(r).filter((o) => a.indexOf(o) !== -1), i = { ...r, ...e };
2331
+ for (const o of n) {
2332
+ const u = ee(r[o], e[o]);
2333
+ if (!u.valid)
2334
+ return { valid: !1 };
2335
+ i[o] = u.data;
2336
+ }
2337
+ return { valid: !0, data: i };
2338
+ } else if (t === l.array && s === l.array) {
2339
+ if (r.length !== e.length)
2340
+ return { valid: !1 };
2341
+ const a = [];
2342
+ for (let n = 0; n < r.length; n++) {
2343
+ const i = r[n], o = e[n], u = ee(i, o);
2344
+ if (!u.valid)
2345
+ return { valid: !1 };
2346
+ a.push(u.data);
2347
+ }
2348
+ return { valid: !0, data: a };
2349
+ } else return t === l.date && s === l.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
2350
+ }
2351
+ class Q extends v {
2352
+ _parse(e) {
2353
+ const { status: t, ctx: s } = this._processInputParams(e), a = (n, i) => {
2354
+ if (ie(n) || ie(i))
2355
+ return m;
2356
+ const o = ee(n.value, i.value);
2357
+ return o.valid ? ((oe(n) || oe(i)) && t.dirty(), { status: t.value, value: o.data }) : (c(s, {
2358
+ code: d.invalid_intersection_types
2359
+ }), m);
338
2360
  };
339
- }).sort((i, o) => o.score - i.score)[0]?.artwork;
2361
+ return s.common.async ? Promise.all([
2362
+ this._def.left._parseAsync({
2363
+ data: s.data,
2364
+ path: s.path,
2365
+ parent: s
2366
+ }),
2367
+ this._def.right._parseAsync({
2368
+ data: s.data,
2369
+ path: s.path,
2370
+ parent: s
2371
+ })
2372
+ ]).then(([n, i]) => a(n, i)) : a(this._def.left._parseSync({
2373
+ data: s.data,
2374
+ path: s.path,
2375
+ parent: s
2376
+ }), this._def.right._parseSync({
2377
+ data: s.data,
2378
+ path: s.path,
2379
+ parent: s
2380
+ }));
2381
+ }
2382
+ }
2383
+ Q.create = (r, e, t) => new Q({
2384
+ left: r,
2385
+ right: e,
2386
+ typeName: p.ZodIntersection,
2387
+ ...g(t)
2388
+ });
2389
+ class E extends v {
2390
+ _parse(e) {
2391
+ const { status: t, ctx: s } = this._processInputParams(e);
2392
+ if (s.parsedType !== l.array)
2393
+ return c(s, {
2394
+ code: d.invalid_type,
2395
+ expected: l.array,
2396
+ received: s.parsedType
2397
+ }), m;
2398
+ if (s.data.length < this._def.items.length)
2399
+ return c(s, {
2400
+ code: d.too_small,
2401
+ minimum: this._def.items.length,
2402
+ inclusive: !0,
2403
+ exact: !1,
2404
+ type: "array"
2405
+ }), m;
2406
+ !this._def.rest && s.data.length > this._def.items.length && (c(s, {
2407
+ code: d.too_big,
2408
+ maximum: this._def.items.length,
2409
+ inclusive: !0,
2410
+ exact: !1,
2411
+ type: "array"
2412
+ }), t.dirty());
2413
+ const n = [...s.data].map((i, o) => {
2414
+ const u = this._def.items[o] || this._def.rest;
2415
+ return u ? u._parse(new N(s, i, s.path, o)) : null;
2416
+ }).filter((i) => !!i);
2417
+ return s.common.async ? Promise.all(n).then((i) => b.mergeArray(t, i)) : b.mergeArray(t, n);
2418
+ }
2419
+ get items() {
2420
+ return this._def.items;
2421
+ }
2422
+ rest(e) {
2423
+ return new E({
2424
+ ...this._def,
2425
+ rest: e
2426
+ });
2427
+ }
2428
+ }
2429
+ E.create = (r, e) => {
2430
+ if (!Array.isArray(r))
2431
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2432
+ return new E({
2433
+ items: r,
2434
+ typeName: p.ZodTuple,
2435
+ rest: null,
2436
+ ...g(e)
2437
+ });
2438
+ };
2439
+ class pe extends v {
2440
+ get keySchema() {
2441
+ return this._def.keyType;
2442
+ }
2443
+ get valueSchema() {
2444
+ return this._def.valueType;
2445
+ }
2446
+ _parse(e) {
2447
+ const { status: t, ctx: s } = this._processInputParams(e);
2448
+ if (s.parsedType !== l.map)
2449
+ return c(s, {
2450
+ code: d.invalid_type,
2451
+ expected: l.map,
2452
+ received: s.parsedType
2453
+ }), m;
2454
+ const a = this._def.keyType, n = this._def.valueType, i = [...s.data.entries()].map(([o, u], f) => ({
2455
+ key: a._parse(new N(s, o, s.path, [f, "key"])),
2456
+ value: n._parse(new N(s, u, s.path, [f, "value"]))
2457
+ }));
2458
+ if (s.common.async) {
2459
+ const o = /* @__PURE__ */ new Map();
2460
+ return Promise.resolve().then(async () => {
2461
+ for (const u of i) {
2462
+ const f = await u.key, y = await u.value;
2463
+ if (f.status === "aborted" || y.status === "aborted")
2464
+ return m;
2465
+ (f.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(f.value, y.value);
2466
+ }
2467
+ return { status: t.value, value: o };
2468
+ });
2469
+ } else {
2470
+ const o = /* @__PURE__ */ new Map();
2471
+ for (const u of i) {
2472
+ const f = u.key, y = u.value;
2473
+ if (f.status === "aborted" || y.status === "aborted")
2474
+ return m;
2475
+ (f.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(f.value, y.value);
2476
+ }
2477
+ return { status: t.value, value: o };
2478
+ }
2479
+ }
2480
+ }
2481
+ pe.create = (r, e, t) => new pe({
2482
+ valueType: e,
2483
+ keyType: r,
2484
+ typeName: p.ZodMap,
2485
+ ...g(t)
2486
+ });
2487
+ class B extends v {
2488
+ _parse(e) {
2489
+ const { status: t, ctx: s } = this._processInputParams(e);
2490
+ if (s.parsedType !== l.set)
2491
+ return c(s, {
2492
+ code: d.invalid_type,
2493
+ expected: l.set,
2494
+ received: s.parsedType
2495
+ }), m;
2496
+ const a = this._def;
2497
+ a.minSize !== null && s.data.size < a.minSize.value && (c(s, {
2498
+ code: d.too_small,
2499
+ minimum: a.minSize.value,
2500
+ type: "set",
2501
+ inclusive: !0,
2502
+ exact: !1,
2503
+ message: a.minSize.message
2504
+ }), t.dirty()), a.maxSize !== null && s.data.size > a.maxSize.value && (c(s, {
2505
+ code: d.too_big,
2506
+ maximum: a.maxSize.value,
2507
+ type: "set",
2508
+ inclusive: !0,
2509
+ exact: !1,
2510
+ message: a.maxSize.message
2511
+ }), t.dirty());
2512
+ const n = this._def.valueType;
2513
+ function i(u) {
2514
+ const f = /* @__PURE__ */ new Set();
2515
+ for (const y of u) {
2516
+ if (y.status === "aborted")
2517
+ return m;
2518
+ y.status === "dirty" && t.dirty(), f.add(y.value);
2519
+ }
2520
+ return { status: t.value, value: f };
2521
+ }
2522
+ const o = [...s.data.values()].map((u, f) => n._parse(new N(s, u, s.path, f)));
2523
+ return s.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
2524
+ }
2525
+ min(e, t) {
2526
+ return new B({
2527
+ ...this._def,
2528
+ minSize: { value: e, message: h.toString(t) }
2529
+ });
2530
+ }
2531
+ max(e, t) {
2532
+ return new B({
2533
+ ...this._def,
2534
+ maxSize: { value: e, message: h.toString(t) }
2535
+ });
2536
+ }
2537
+ size(e, t) {
2538
+ return this.min(e, t).max(e, t);
2539
+ }
2540
+ nonempty(e) {
2541
+ return this.min(1, e);
2542
+ }
2543
+ }
2544
+ B.create = (r, e) => new B({
2545
+ valueType: r,
2546
+ minSize: null,
2547
+ maxSize: null,
2548
+ typeName: p.ZodSet,
2549
+ ...g(e)
2550
+ });
2551
+ class ge extends v {
2552
+ get schema() {
2553
+ return this._def.getter();
2554
+ }
2555
+ _parse(e) {
2556
+ const { ctx: t } = this._processInputParams(e);
2557
+ return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2558
+ }
2559
+ }
2560
+ ge.create = (r, e) => new ge({
2561
+ getter: r,
2562
+ typeName: p.ZodLazy,
2563
+ ...g(e)
2564
+ });
2565
+ class ye extends v {
2566
+ _parse(e) {
2567
+ if (e.data !== this._def.value) {
2568
+ const t = this._getOrReturnCtx(e);
2569
+ return c(t, {
2570
+ received: t.data,
2571
+ code: d.invalid_literal,
2572
+ expected: this._def.value
2573
+ }), m;
2574
+ }
2575
+ return { status: "valid", value: e.data };
2576
+ }
2577
+ get value() {
2578
+ return this._def.value;
2579
+ }
2580
+ }
2581
+ ye.create = (r, e) => new ye({
2582
+ value: r,
2583
+ typeName: p.ZodLiteral,
2584
+ ...g(e)
2585
+ });
2586
+ function be(r, e) {
2587
+ return new P({
2588
+ values: r,
2589
+ typeName: p.ZodEnum,
2590
+ ...g(e)
2591
+ });
2592
+ }
2593
+ class P extends v {
2594
+ _parse(e) {
2595
+ if (typeof e.data != "string") {
2596
+ const t = this._getOrReturnCtx(e), s = this._def.values;
2597
+ return c(t, {
2598
+ expected: _.joinValues(s),
2599
+ received: t.parsedType,
2600
+ code: d.invalid_type
2601
+ }), m;
2602
+ }
2603
+ if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
2604
+ const t = this._getOrReturnCtx(e), s = this._def.values;
2605
+ return c(t, {
2606
+ received: t.data,
2607
+ code: d.invalid_enum_value,
2608
+ options: s
2609
+ }), m;
2610
+ }
2611
+ return w(e.data);
2612
+ }
2613
+ get options() {
2614
+ return this._def.values;
2615
+ }
2616
+ get enum() {
2617
+ const e = {};
2618
+ for (const t of this._def.values)
2619
+ e[t] = t;
2620
+ return e;
2621
+ }
2622
+ get Values() {
2623
+ const e = {};
2624
+ for (const t of this._def.values)
2625
+ e[t] = t;
2626
+ return e;
2627
+ }
2628
+ get Enum() {
2629
+ const e = {};
2630
+ for (const t of this._def.values)
2631
+ e[t] = t;
2632
+ return e;
2633
+ }
2634
+ extract(e, t = this._def) {
2635
+ return P.create(e, {
2636
+ ...this._def,
2637
+ ...t
2638
+ });
2639
+ }
2640
+ exclude(e, t = this._def) {
2641
+ return P.create(this.options.filter((s) => !e.includes(s)), {
2642
+ ...this._def,
2643
+ ...t
2644
+ });
2645
+ }
2646
+ }
2647
+ P.create = be;
2648
+ class ve extends v {
2649
+ _parse(e) {
2650
+ const t = _.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2651
+ if (s.parsedType !== l.string && s.parsedType !== l.number) {
2652
+ const a = _.objectValues(t);
2653
+ return c(s, {
2654
+ expected: _.joinValues(a),
2655
+ received: s.parsedType,
2656
+ code: d.invalid_type
2657
+ }), m;
2658
+ }
2659
+ if (this._cache || (this._cache = new Set(_.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
2660
+ const a = _.objectValues(t);
2661
+ return c(s, {
2662
+ received: s.data,
2663
+ code: d.invalid_enum_value,
2664
+ options: a
2665
+ }), m;
2666
+ }
2667
+ return w(e.data);
2668
+ }
2669
+ get enum() {
2670
+ return this._def.values;
2671
+ }
2672
+ }
2673
+ ve.create = (r, e) => new ve({
2674
+ values: r,
2675
+ typeName: p.ZodNativeEnum,
2676
+ ...g(e)
2677
+ });
2678
+ class Y extends v {
2679
+ unwrap() {
2680
+ return this._def.type;
2681
+ }
2682
+ _parse(e) {
2683
+ const { ctx: t } = this._processInputParams(e);
2684
+ if (t.parsedType !== l.promise && t.common.async === !1)
2685
+ return c(t, {
2686
+ code: d.invalid_type,
2687
+ expected: l.promise,
2688
+ received: t.parsedType
2689
+ }), m;
2690
+ const s = t.parsedType === l.promise ? t.data : Promise.resolve(t.data);
2691
+ return w(s.then((a) => this._def.type.parseAsync(a, {
2692
+ path: t.path,
2693
+ errorMap: t.common.contextualErrorMap
2694
+ })));
2695
+ }
2696
+ }
2697
+ Y.create = (r, e) => new Y({
2698
+ type: r,
2699
+ typeName: p.ZodPromise,
2700
+ ...g(e)
2701
+ });
2702
+ class V extends v {
2703
+ innerType() {
2704
+ return this._def.schema;
2705
+ }
2706
+ sourceType() {
2707
+ return this._def.schema._def.typeName === p.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2708
+ }
2709
+ _parse(e) {
2710
+ const { status: t, ctx: s } = this._processInputParams(e), a = this._def.effect || null, n = {
2711
+ addIssue: (i) => {
2712
+ c(s, i), i.fatal ? t.abort() : t.dirty();
2713
+ },
2714
+ get path() {
2715
+ return s.path;
2716
+ }
2717
+ };
2718
+ if (n.addIssue = n.addIssue.bind(n), a.type === "preprocess") {
2719
+ const i = a.transform(s.data, n);
2720
+ if (s.common.async)
2721
+ return Promise.resolve(i).then(async (o) => {
2722
+ if (t.value === "aborted")
2723
+ return m;
2724
+ const u = await this._def.schema._parseAsync({
2725
+ data: o,
2726
+ path: s.path,
2727
+ parent: s
2728
+ });
2729
+ return u.status === "aborted" ? m : u.status === "dirty" || t.value === "dirty" ? D(u.value) : u;
2730
+ });
2731
+ {
2732
+ if (t.value === "aborted")
2733
+ return m;
2734
+ const o = this._def.schema._parseSync({
2735
+ data: i,
2736
+ path: s.path,
2737
+ parent: s
2738
+ });
2739
+ return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ? D(o.value) : o;
2740
+ }
2741
+ }
2742
+ if (a.type === "refinement") {
2743
+ const i = (o) => {
2744
+ const u = a.refinement(o, n);
2745
+ if (s.common.async)
2746
+ return Promise.resolve(u);
2747
+ if (u instanceof Promise)
2748
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2749
+ return o;
2750
+ };
2751
+ if (s.common.async === !1) {
2752
+ const o = this._def.schema._parseSync({
2753
+ data: s.data,
2754
+ path: s.path,
2755
+ parent: s
2756
+ });
2757
+ return o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2758
+ } else
2759
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2760
+ }
2761
+ if (a.type === "transform")
2762
+ if (s.common.async === !1) {
2763
+ const i = this._def.schema._parseSync({
2764
+ data: s.data,
2765
+ path: s.path,
2766
+ parent: s
2767
+ });
2768
+ if (!$(i))
2769
+ return m;
2770
+ const o = a.transform(i.value, n);
2771
+ if (o instanceof Promise)
2772
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2773
+ return { status: t.value, value: o };
2774
+ } else
2775
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => $(i) ? Promise.resolve(a.transform(i.value, n)).then((o) => ({
2776
+ status: t.value,
2777
+ value: o
2778
+ })) : m);
2779
+ _.assertNever(a);
2780
+ }
2781
+ }
2782
+ V.create = (r, e, t) => new V({
2783
+ schema: r,
2784
+ typeName: p.ZodEffects,
2785
+ effect: e,
2786
+ ...g(t)
2787
+ });
2788
+ V.createWithPreprocess = (r, e, t) => new V({
2789
+ schema: e,
2790
+ effect: { type: "preprocess", transform: r },
2791
+ typeName: p.ZodEffects,
2792
+ ...g(t)
2793
+ });
2794
+ class I extends v {
2795
+ _parse(e) {
2796
+ return this._getType(e) === l.undefined ? w(void 0) : this._def.innerType._parse(e);
2797
+ }
2798
+ unwrap() {
2799
+ return this._def.innerType;
2800
+ }
2801
+ }
2802
+ I.create = (r, e) => new I({
2803
+ innerType: r,
2804
+ typeName: p.ZodOptional,
2805
+ ...g(e)
2806
+ });
2807
+ class L extends v {
2808
+ _parse(e) {
2809
+ return this._getType(e) === l.null ? w(null) : this._def.innerType._parse(e);
2810
+ }
2811
+ unwrap() {
2812
+ return this._def.innerType;
2813
+ }
2814
+ }
2815
+ L.create = (r, e) => new L({
2816
+ innerType: r,
2817
+ typeName: p.ZodNullable,
2818
+ ...g(e)
2819
+ });
2820
+ class te extends v {
2821
+ _parse(e) {
2822
+ const { ctx: t } = this._processInputParams(e);
2823
+ let s = t.data;
2824
+ return t.parsedType === l.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
2825
+ data: s,
2826
+ path: t.path,
2827
+ parent: t
2828
+ });
2829
+ }
2830
+ removeDefault() {
2831
+ return this._def.innerType;
2832
+ }
2833
+ }
2834
+ te.create = (r, e) => new te({
2835
+ innerType: r,
2836
+ typeName: p.ZodDefault,
2837
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2838
+ ...g(e)
2839
+ });
2840
+ class se extends v {
2841
+ _parse(e) {
2842
+ const { ctx: t } = this._processInputParams(e), s = {
2843
+ ...t,
2844
+ common: {
2845
+ ...t.common,
2846
+ issues: []
2847
+ }
2848
+ }, a = this._def.innerType._parse({
2849
+ data: s.data,
2850
+ path: s.path,
2851
+ parent: {
2852
+ ...s
2853
+ }
2854
+ });
2855
+ return H(a) ? a.then((n) => ({
2856
+ status: "valid",
2857
+ value: n.status === "valid" ? n.value : this._def.catchValue({
2858
+ get error() {
2859
+ return new T(s.common.issues);
2860
+ },
2861
+ input: s.data
2862
+ })
2863
+ })) : {
2864
+ status: "valid",
2865
+ value: a.status === "valid" ? a.value : this._def.catchValue({
2866
+ get error() {
2867
+ return new T(s.common.issues);
2868
+ },
2869
+ input: s.data
2870
+ })
2871
+ };
2872
+ }
2873
+ removeCatch() {
2874
+ return this._def.innerType;
2875
+ }
2876
+ }
2877
+ se.create = (r, e) => new se({
2878
+ innerType: r,
2879
+ typeName: p.ZodCatch,
2880
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2881
+ ...g(e)
2882
+ });
2883
+ class _e extends v {
2884
+ _parse(e) {
2885
+ if (this._getType(e) !== l.nan) {
2886
+ const s = this._getOrReturnCtx(e);
2887
+ return c(s, {
2888
+ code: d.invalid_type,
2889
+ expected: l.nan,
2890
+ received: s.parsedType
2891
+ }), m;
2892
+ }
2893
+ return { status: "valid", value: e.data };
2894
+ }
2895
+ }
2896
+ _e.create = (r) => new _e({
2897
+ typeName: p.ZodNaN,
2898
+ ...g(r)
2899
+ });
2900
+ class mt extends v {
2901
+ _parse(e) {
2902
+ const { ctx: t } = this._processInputParams(e), s = t.data;
2903
+ return this._def.type._parse({
2904
+ data: s,
2905
+ path: t.path,
2906
+ parent: t
2907
+ });
2908
+ }
2909
+ unwrap() {
2910
+ return this._def.type;
2911
+ }
2912
+ }
2913
+ class ae extends v {
2914
+ _parse(e) {
2915
+ const { status: t, ctx: s } = this._processInputParams(e);
2916
+ if (s.common.async)
2917
+ return (async () => {
2918
+ const n = await this._def.in._parseAsync({
2919
+ data: s.data,
2920
+ path: s.path,
2921
+ parent: s
2922
+ });
2923
+ return n.status === "aborted" ? m : n.status === "dirty" ? (t.dirty(), D(n.value)) : this._def.out._parseAsync({
2924
+ data: n.value,
2925
+ path: s.path,
2926
+ parent: s
2927
+ });
2928
+ })();
2929
+ {
2930
+ const a = this._def.in._parseSync({
2931
+ data: s.data,
2932
+ path: s.path,
2933
+ parent: s
2934
+ });
2935
+ return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(), {
2936
+ status: "dirty",
2937
+ value: a.value
2938
+ }) : this._def.out._parseSync({
2939
+ data: a.value,
2940
+ path: s.path,
2941
+ parent: s
2942
+ });
2943
+ }
2944
+ }
2945
+ static create(e, t) {
2946
+ return new ae({
2947
+ in: e,
2948
+ out: t,
2949
+ typeName: p.ZodPipeline
2950
+ });
2951
+ }
2952
+ }
2953
+ class re extends v {
2954
+ _parse(e) {
2955
+ const t = this._def.innerType._parse(e), s = (a) => ($(a) && (a.value = Object.freeze(a.value)), a);
2956
+ return H(t) ? t.then((a) => s(a)) : s(t);
2957
+ }
2958
+ unwrap() {
2959
+ return this._def.innerType;
2960
+ }
340
2961
  }
2962
+ re.create = (r, e) => new re({
2963
+ innerType: r,
2964
+ typeName: p.ZodReadonly,
2965
+ ...g(e)
2966
+ });
2967
+ var p;
2968
+ (function(r) {
2969
+ r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
2970
+ })(p || (p = {}));
2971
+ const x = C.create, U = M.create, we = K.create;
2972
+ O.create;
2973
+ const z = A.create, R = k.create;
2974
+ q.create;
2975
+ Q.create;
2976
+ E.create;
2977
+ const pt = P.create;
2978
+ Y.create;
2979
+ I.create;
2980
+ L.create;
2981
+ const J = R({
2982
+ provider: x(),
2983
+ id: x(),
2984
+ url: x().optional()
2985
+ }), gt = R({
2986
+ url: x(),
2987
+ width: U().optional(),
2988
+ height: U().optional(),
2989
+ purpose: pt(["avatar", "cover", "background", "thumbnail"]).optional(),
2990
+ source: J.optional()
2991
+ }), Ae = R({
2992
+ items: z(gt)
2993
+ }), yt = R({
2994
+ name: x(),
2995
+ roles: z(x()),
2996
+ source: J.optional()
2997
+ }), vt = R({
2998
+ title: x(),
2999
+ artists: z(yt),
3000
+ durationMs: U().optional(),
3001
+ source: J
3002
+ }).passthrough(), _t = R({
3003
+ id: x(),
3004
+ track: vt,
3005
+ note: x().optional(),
3006
+ addedAtIso: x()
3007
+ }), St = R({
3008
+ id: x(),
3009
+ name: x(),
3010
+ description: x().optional(),
3011
+ artwork: Ae.optional(),
3012
+ tags: z(x()).optional(),
3013
+ createdAtIso: x(),
3014
+ lastModifiedIso: x(),
3015
+ origin: J.optional(),
3016
+ isReadOnly: we(),
3017
+ parentId: x().optional(),
3018
+ items: z(_t)
3019
+ }), xt = R({
3020
+ id: x(),
3021
+ name: x(),
3022
+ createdAtIso: x(),
3023
+ lastModifiedIso: x(),
3024
+ isReadOnly: we(),
3025
+ artwork: Ae.optional(),
3026
+ itemCount: U(),
3027
+ totalDurationMs: U()
3028
+ }), Ct = z(xt);
341
3029
  export {
342
- b as FavoritesAPI,
343
- w as HttpAPI,
344
- M as MissingCapabilityError,
345
- F as NuclearAPI,
346
- P as NuclearPluginAPI,
347
- S as YtdlpAPI,
348
- R as pickArtwork,
349
- C as useSetting
3030
+ Ne as FavoritesAPI,
3031
+ Ee as HttpAPI,
3032
+ $e as LoggerAPI,
3033
+ wt as MissingCapabilityError,
3034
+ Fe as NuclearAPI,
3035
+ bt as NuclearPluginAPI,
3036
+ De as YtdlpAPI,
3037
+ Tt as pickArtwork,
3038
+ xt as playlistIndexEntrySchema,
3039
+ Ct as playlistIndexSchema,
3040
+ St as playlistSchema,
3041
+ At as useSetting
350
3042
  };