@nuclearplayer/plugin-sdk 2.1.1 → 2.3.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.
- package/dist/index.d.ts +583 -1
- package/dist/index.js +288 -204
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -86,7 +86,7 @@ const Re = (r) => {
|
|
|
86
86
|
}
|
|
87
87
|
return Array.isArray(r) ? Object.fromEntries(r) : r;
|
|
88
88
|
};
|
|
89
|
-
function
|
|
89
|
+
function Ee(r) {
|
|
90
90
|
return async (e, t) => {
|
|
91
91
|
const s = String(e instanceof Request ? e.url : e), a = t?.headers ? Re(t.headers) : void 0, n = typeof t?.body == "string" ? t.body : void 0, i = await r.fetch(s, {
|
|
92
92
|
method: t?.method,
|
|
@@ -99,7 +99,7 @@ function Ze(r) {
|
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
const
|
|
102
|
+
const Ze = {
|
|
103
103
|
fetch: async () => ({
|
|
104
104
|
status: 501,
|
|
105
105
|
headers: {},
|
|
@@ -109,17 +109,17 @@ const Ee = {
|
|
|
109
109
|
class je {
|
|
110
110
|
fetch;
|
|
111
111
|
constructor(e) {
|
|
112
|
-
this.fetch =
|
|
112
|
+
this.fetch = Ee(e ?? Ze);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const Pe = {
|
|
116
116
|
log: () => {
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
|
-
class
|
|
119
|
+
class $e {
|
|
120
120
|
host;
|
|
121
121
|
constructor(e) {
|
|
122
|
-
this.host = e ??
|
|
122
|
+
this.host = e ?? Pe;
|
|
123
123
|
}
|
|
124
124
|
trace(e) {
|
|
125
125
|
this.host.log("trace", e);
|
|
@@ -140,7 +140,7 @@ class Me {
|
|
|
140
140
|
this.host.log(e, t);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
class
|
|
143
|
+
class Me {
|
|
144
144
|
#t;
|
|
145
145
|
constructor(e) {
|
|
146
146
|
this.#t = e;
|
|
@@ -181,6 +181,81 @@ class Pe {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
class Ve {
|
|
184
|
+
#t;
|
|
185
|
+
constructor(e) {
|
|
186
|
+
this.#t = e;
|
|
187
|
+
}
|
|
188
|
+
#e(e) {
|
|
189
|
+
const t = this.#t;
|
|
190
|
+
if (!t)
|
|
191
|
+
throw new Error("Playback host not available");
|
|
192
|
+
return e(t);
|
|
193
|
+
}
|
|
194
|
+
getState() {
|
|
195
|
+
return this.#e((e) => e.getState());
|
|
196
|
+
}
|
|
197
|
+
play() {
|
|
198
|
+
return this.#e((e) => e.play());
|
|
199
|
+
}
|
|
200
|
+
pause() {
|
|
201
|
+
return this.#e((e) => e.pause());
|
|
202
|
+
}
|
|
203
|
+
stop() {
|
|
204
|
+
return this.#e((e) => e.stop());
|
|
205
|
+
}
|
|
206
|
+
toggle() {
|
|
207
|
+
return this.#e((e) => e.toggle());
|
|
208
|
+
}
|
|
209
|
+
seekTo(e) {
|
|
210
|
+
return this.#e((t) => t.seekTo(e));
|
|
211
|
+
}
|
|
212
|
+
subscribe(e) {
|
|
213
|
+
return this.#e((t) => t.subscribe(e));
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
class Le {
|
|
217
|
+
#t;
|
|
218
|
+
constructor(e) {
|
|
219
|
+
this.#t = e;
|
|
220
|
+
}
|
|
221
|
+
#e(e) {
|
|
222
|
+
const t = this.#t;
|
|
223
|
+
if (!t)
|
|
224
|
+
throw new Error("Playlists host not available");
|
|
225
|
+
return e(t);
|
|
226
|
+
}
|
|
227
|
+
getIndex() {
|
|
228
|
+
return this.#e((e) => e.getIndex());
|
|
229
|
+
}
|
|
230
|
+
getPlaylist(e) {
|
|
231
|
+
return this.#e((t) => t.getPlaylist(e));
|
|
232
|
+
}
|
|
233
|
+
createPlaylist(e) {
|
|
234
|
+
return this.#e((t) => t.createPlaylist(e));
|
|
235
|
+
}
|
|
236
|
+
deletePlaylist(e) {
|
|
237
|
+
return this.#e((t) => t.deletePlaylist(e));
|
|
238
|
+
}
|
|
239
|
+
addTracks(e, t) {
|
|
240
|
+
return this.#e((s) => s.addTracks(e, t));
|
|
241
|
+
}
|
|
242
|
+
removeTracks(e, t) {
|
|
243
|
+
return this.#e((s) => s.removeTracks(e, t));
|
|
244
|
+
}
|
|
245
|
+
reorderTracks(e, t, s) {
|
|
246
|
+
return this.#e((a) => a.reorderTracks(e, t, s));
|
|
247
|
+
}
|
|
248
|
+
importPlaylist(e) {
|
|
249
|
+
return this.#e((t) => t.importPlaylist(e));
|
|
250
|
+
}
|
|
251
|
+
saveQueueAsPlaylist(e) {
|
|
252
|
+
return this.#e((t) => t.saveQueueAsPlaylist(e));
|
|
253
|
+
}
|
|
254
|
+
subscribe(e) {
|
|
255
|
+
return this.#e((t) => t.subscribe(e));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
class ze {
|
|
184
259
|
#t;
|
|
185
260
|
constructor(e) {
|
|
186
261
|
this.#t = e;
|
|
@@ -204,7 +279,7 @@ class Ve {
|
|
|
204
279
|
return this.#e((s) => s.get(e, t));
|
|
205
280
|
}
|
|
206
281
|
}
|
|
207
|
-
class
|
|
282
|
+
class De {
|
|
208
283
|
#t;
|
|
209
284
|
constructor(e) {
|
|
210
285
|
this.#t = e;
|
|
@@ -270,7 +345,7 @@ class Le {
|
|
|
270
345
|
return this.#e((t) => t.subscribeToCurrentItem(e));
|
|
271
346
|
}
|
|
272
347
|
}
|
|
273
|
-
class
|
|
348
|
+
class Fe {
|
|
274
349
|
#t;
|
|
275
350
|
constructor(e) {
|
|
276
351
|
this.#t = e;
|
|
@@ -294,7 +369,7 @@ class ze {
|
|
|
294
369
|
return this.#e((s) => s.subscribe(e, t));
|
|
295
370
|
}
|
|
296
371
|
}
|
|
297
|
-
class
|
|
372
|
+
class Be {
|
|
298
373
|
#t;
|
|
299
374
|
constructor(e) {
|
|
300
375
|
this.#t = e;
|
|
@@ -312,7 +387,7 @@ class De {
|
|
|
312
387
|
return this.#e((t) => t.resolveStreamForCandidate(e));
|
|
313
388
|
}
|
|
314
389
|
}
|
|
315
|
-
class
|
|
390
|
+
class He {
|
|
316
391
|
host;
|
|
317
392
|
constructor(e) {
|
|
318
393
|
this.host = e;
|
|
@@ -331,7 +406,7 @@ class Fe {
|
|
|
331
406
|
return this.host.getStream(e);
|
|
332
407
|
}
|
|
333
408
|
}
|
|
334
|
-
class
|
|
409
|
+
class Ue {
|
|
335
410
|
Settings;
|
|
336
411
|
Providers;
|
|
337
412
|
Queue;
|
|
@@ -342,20 +417,22 @@ class Be {
|
|
|
342
417
|
Favorites;
|
|
343
418
|
Logger;
|
|
344
419
|
Dashboard;
|
|
420
|
+
Playback;
|
|
421
|
+
Playlists;
|
|
345
422
|
constructor(e) {
|
|
346
|
-
this.Settings = new
|
|
423
|
+
this.Settings = new Fe(e?.settingsHost), this.Providers = new ze(e?.providersHost), this.Queue = new De(e?.queueHost), this.Streaming = new Be(e?.streamingHost), this.Metadata = new Me(e?.metadataHost), this.Http = new je(e?.httpHost), this.Ytdlp = new He(e?.ytdlpHost), this.Favorites = new Oe(e?.favoritesHost), this.Logger = new $e(e?.loggerHost), this.Dashboard = new Ne(e?.dashboardHost), this.Playback = new Ve(e?.playbackHost), this.Playlists = new Le(e?.playlistsHost);
|
|
347
424
|
}
|
|
348
425
|
}
|
|
349
|
-
class
|
|
426
|
+
class St extends Ue {
|
|
350
427
|
}
|
|
351
|
-
class
|
|
428
|
+
class Ct extends Error {
|
|
352
429
|
constructor(e, t) {
|
|
353
430
|
super(
|
|
354
431
|
`Missing capability: Provider "${t}" declared capability "${e}" but does not implement it`
|
|
355
432
|
), this.name = "MissingCapabilityError";
|
|
356
433
|
}
|
|
357
434
|
}
|
|
358
|
-
const
|
|
435
|
+
const It = (r, e) => {
|
|
359
436
|
const [t, s] = Se(void 0);
|
|
360
437
|
Ce(() => {
|
|
361
438
|
if (!r)
|
|
@@ -378,7 +455,7 @@ const Tt = (r, e) => {
|
|
|
378
455
|
);
|
|
379
456
|
return [t, a];
|
|
380
457
|
};
|
|
381
|
-
function
|
|
458
|
+
function Nt(r, e, t) {
|
|
382
459
|
if (!r?.items?.length)
|
|
383
460
|
return;
|
|
384
461
|
const s = r.items.filter((o) => !(o.purpose && o.purpose !== e || !o.url));
|
|
@@ -398,10 +475,10 @@ function St(r, e, t) {
|
|
|
398
475
|
}
|
|
399
476
|
})(e);
|
|
400
477
|
return s.map((o) => {
|
|
401
|
-
const u = Math.min(o.width || 0, o.height || 0), f = Math.abs(a(o) - i), y = Math.abs(u - t),
|
|
478
|
+
const u = Math.min(o.width || 0, o.height || 0), f = Math.abs(a(o) - i), y = Math.abs(u - t), E = u < t ? t / u : 1;
|
|
402
479
|
return {
|
|
403
480
|
artwork: o,
|
|
404
|
-
score: (
|
|
481
|
+
score: (E > 1.5 ? -1e3 : 0) + -f * 50 + -y * 0.1
|
|
405
482
|
};
|
|
406
483
|
}).sort((o, u) => u.score - o.score)[0]?.artwork;
|
|
407
484
|
}
|
|
@@ -471,7 +548,7 @@ const l = _.arrayToEnum([
|
|
|
471
548
|
"never",
|
|
472
549
|
"map",
|
|
473
550
|
"set"
|
|
474
|
-
]),
|
|
551
|
+
]), C = (r) => {
|
|
475
552
|
switch (typeof r) {
|
|
476
553
|
case "undefined":
|
|
477
554
|
return l.undefined;
|
|
@@ -630,11 +707,11 @@ const X = (r, e) => {
|
|
|
630
707
|
}
|
|
631
708
|
return { message: t };
|
|
632
709
|
};
|
|
633
|
-
let
|
|
634
|
-
function
|
|
635
|
-
return
|
|
710
|
+
let We = X;
|
|
711
|
+
function qe() {
|
|
712
|
+
return We;
|
|
636
713
|
}
|
|
637
|
-
const
|
|
714
|
+
const Qe = (r) => {
|
|
638
715
|
const { data: e, path: t, errorMaps: s, issueData: a } = r, n = [...t, ...a.path || []], i = {
|
|
639
716
|
...a,
|
|
640
717
|
path: n
|
|
@@ -656,7 +733,7 @@ const We = (r) => {
|
|
|
656
733
|
};
|
|
657
734
|
};
|
|
658
735
|
function c(r, e) {
|
|
659
|
-
const t =
|
|
736
|
+
const t = qe(), s = Qe({
|
|
660
737
|
issueData: e,
|
|
661
738
|
data: r.data,
|
|
662
739
|
path: r.path,
|
|
@@ -716,12 +793,12 @@ class b {
|
|
|
716
793
|
}
|
|
717
794
|
const m = Object.freeze({
|
|
718
795
|
status: "aborted"
|
|
719
|
-
}),
|
|
796
|
+
}), F = (r) => ({ status: "dirty", value: r }), w = (r) => ({ status: "valid", value: r }), ie = (r) => r.status === "aborted", oe = (r) => r.status === "dirty", P = (r) => r.status === "valid", U = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
720
797
|
var h;
|
|
721
798
|
(function(r) {
|
|
722
799
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
723
800
|
})(h || (h = {}));
|
|
724
|
-
class
|
|
801
|
+
class O {
|
|
725
802
|
constructor(e, t, s, a) {
|
|
726
803
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = a;
|
|
727
804
|
}
|
|
@@ -730,7 +807,7 @@ class N {
|
|
|
730
807
|
}
|
|
731
808
|
}
|
|
732
809
|
const de = (r, e) => {
|
|
733
|
-
if (
|
|
810
|
+
if (P(e))
|
|
734
811
|
return { success: !0, data: e.value };
|
|
735
812
|
if (!r.common.issues.length)
|
|
736
813
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -760,13 +837,13 @@ class v {
|
|
|
760
837
|
return this._def.description;
|
|
761
838
|
}
|
|
762
839
|
_getType(e) {
|
|
763
|
-
return
|
|
840
|
+
return C(e.data);
|
|
764
841
|
}
|
|
765
842
|
_getOrReturnCtx(e, t) {
|
|
766
843
|
return t || {
|
|
767
844
|
common: e.parent.common,
|
|
768
845
|
data: e.data,
|
|
769
|
-
parsedType:
|
|
846
|
+
parsedType: C(e.data),
|
|
770
847
|
schemaErrorMap: this._def.errorMap,
|
|
771
848
|
path: e.path,
|
|
772
849
|
parent: e.parent
|
|
@@ -778,7 +855,7 @@ class v {
|
|
|
778
855
|
ctx: {
|
|
779
856
|
common: e.parent.common,
|
|
780
857
|
data: e.data,
|
|
781
|
-
parsedType:
|
|
858
|
+
parsedType: C(e.data),
|
|
782
859
|
schemaErrorMap: this._def.errorMap,
|
|
783
860
|
path: e.path,
|
|
784
861
|
parent: e.parent
|
|
@@ -787,7 +864,7 @@ class v {
|
|
|
787
864
|
}
|
|
788
865
|
_parseSync(e) {
|
|
789
866
|
const t = this._parse(e);
|
|
790
|
-
if (
|
|
867
|
+
if (U(t))
|
|
791
868
|
throw new Error("Synchronous parse encountered promise.");
|
|
792
869
|
return t;
|
|
793
870
|
}
|
|
@@ -812,7 +889,7 @@ class v {
|
|
|
812
889
|
schemaErrorMap: this._def.errorMap,
|
|
813
890
|
parent: null,
|
|
814
891
|
data: e,
|
|
815
|
-
parsedType:
|
|
892
|
+
parsedType: C(e)
|
|
816
893
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
817
894
|
return de(s, a);
|
|
818
895
|
}
|
|
@@ -826,12 +903,12 @@ class v {
|
|
|
826
903
|
schemaErrorMap: this._def.errorMap,
|
|
827
904
|
parent: null,
|
|
828
905
|
data: e,
|
|
829
|
-
parsedType:
|
|
906
|
+
parsedType: C(e)
|
|
830
907
|
};
|
|
831
908
|
if (!this["~standard"].async)
|
|
832
909
|
try {
|
|
833
910
|
const s = this._parseSync({ data: e, path: [], parent: t });
|
|
834
|
-
return
|
|
911
|
+
return P(s) ? {
|
|
835
912
|
value: s.value
|
|
836
913
|
} : {
|
|
837
914
|
issues: t.common.issues
|
|
@@ -842,7 +919,7 @@ class v {
|
|
|
842
919
|
async: !0
|
|
843
920
|
};
|
|
844
921
|
}
|
|
845
|
-
return this._parseAsync({ data: e, path: [], parent: t }).then((s) =>
|
|
922
|
+
return this._parseAsync({ data: e, path: [], parent: t }).then((s) => P(s) ? {
|
|
846
923
|
value: s.value
|
|
847
924
|
} : {
|
|
848
925
|
issues: t.common.issues
|
|
@@ -865,8 +942,8 @@ class v {
|
|
|
865
942
|
schemaErrorMap: this._def.errorMap,
|
|
866
943
|
parent: null,
|
|
867
944
|
data: e,
|
|
868
|
-
parsedType:
|
|
869
|
-
}, a = this._parse({ data: e, path: s.path, parent: s }), n = await (
|
|
945
|
+
parsedType: C(e)
|
|
946
|
+
}, a = this._parse({ data: e, path: s.path, parent: s }), n = await (U(a) ? a : Promise.resolve(a));
|
|
870
947
|
return de(s, n);
|
|
871
948
|
}
|
|
872
949
|
refine(e, t) {
|
|
@@ -900,7 +977,7 @@ class v {
|
|
|
900
977
|
};
|
|
901
978
|
}
|
|
902
979
|
optional() {
|
|
903
|
-
return
|
|
980
|
+
return N.create(this, this._def);
|
|
904
981
|
}
|
|
905
982
|
nullable() {
|
|
906
983
|
return L.create(this, this._def);
|
|
@@ -938,7 +1015,7 @@ class v {
|
|
|
938
1015
|
});
|
|
939
1016
|
}
|
|
940
1017
|
brand() {
|
|
941
|
-
return new
|
|
1018
|
+
return new yt({
|
|
942
1019
|
typeName: p.ZodBranded,
|
|
943
1020
|
type: this,
|
|
944
1021
|
...g(this._def)
|
|
@@ -973,28 +1050,28 @@ class v {
|
|
|
973
1050
|
return this.safeParse(null).success;
|
|
974
1051
|
}
|
|
975
1052
|
}
|
|
976
|
-
const
|
|
1053
|
+
const Ye = /^c[^\s-]{8,}$/i, Je = /^[0-9a-z]+$/, Ge = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Xe = /^[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, Ke = /^[a-z0-9_-]{21}$/i, et = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, tt = /^[-+]?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)?)??$/, st = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, rt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
977
1054
|
let G;
|
|
978
|
-
const
|
|
979
|
-
function
|
|
1055
|
+
const at = /^(?:(?: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])$/, nt = /^(?:(?: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])$/, it = /^(([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]))$/, ot = /^(([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])$/, dt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ct = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, ke = "((\\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])))", ut = new RegExp(`^${ke}$`);
|
|
1056
|
+
function xe(r) {
|
|
980
1057
|
let e = "[0-5]\\d";
|
|
981
1058
|
r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
982
1059
|
const t = r.precision ? "+" : "?";
|
|
983
1060
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
984
1061
|
}
|
|
985
|
-
function
|
|
986
|
-
return new RegExp(`^${
|
|
1062
|
+
function lt(r) {
|
|
1063
|
+
return new RegExp(`^${xe(r)}$`);
|
|
987
1064
|
}
|
|
988
|
-
function
|
|
989
|
-
let e = `${
|
|
1065
|
+
function ht(r) {
|
|
1066
|
+
let e = `${ke}T${xe(r)}`;
|
|
990
1067
|
const t = [];
|
|
991
1068
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
992
1069
|
}
|
|
993
|
-
function
|
|
994
|
-
return !!((e === "v4" || !e) &&
|
|
1070
|
+
function ft(r, e) {
|
|
1071
|
+
return !!((e === "v4" || !e) && at.test(r) || (e === "v6" || !e) && it.test(r));
|
|
995
1072
|
}
|
|
996
|
-
function
|
|
997
|
-
if (!
|
|
1073
|
+
function mt(r, e) {
|
|
1074
|
+
if (!et.test(r))
|
|
998
1075
|
return !1;
|
|
999
1076
|
try {
|
|
1000
1077
|
const [t] = r.split(".");
|
|
@@ -1006,10 +1083,10 @@ function ht(r, e) {
|
|
|
1006
1083
|
return !1;
|
|
1007
1084
|
}
|
|
1008
1085
|
}
|
|
1009
|
-
function
|
|
1010
|
-
return !!((e === "v4" || !e) &&
|
|
1086
|
+
function pt(r, e) {
|
|
1087
|
+
return !!((e === "v4" || !e) && nt.test(r) || (e === "v6" || !e) && ot.test(r));
|
|
1011
1088
|
}
|
|
1012
|
-
class
|
|
1089
|
+
class I extends v {
|
|
1013
1090
|
_parse(e) {
|
|
1014
1091
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== l.string) {
|
|
1015
1092
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1058,43 +1135,43 @@ class C extends v {
|
|
|
1058
1135
|
message: n.message
|
|
1059
1136
|
}), s.dirty());
|
|
1060
1137
|
} else if (n.kind === "email")
|
|
1061
|
-
|
|
1138
|
+
st.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1062
1139
|
validation: "email",
|
|
1063
1140
|
code: d.invalid_string,
|
|
1064
1141
|
message: n.message
|
|
1065
1142
|
}), s.dirty());
|
|
1066
1143
|
else if (n.kind === "emoji")
|
|
1067
|
-
G || (G = new RegExp(
|
|
1144
|
+
G || (G = new RegExp(rt, "u")), G.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1068
1145
|
validation: "emoji",
|
|
1069
1146
|
code: d.invalid_string,
|
|
1070
1147
|
message: n.message
|
|
1071
1148
|
}), s.dirty());
|
|
1072
1149
|
else if (n.kind === "uuid")
|
|
1073
|
-
|
|
1150
|
+
Xe.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1074
1151
|
validation: "uuid",
|
|
1075
1152
|
code: d.invalid_string,
|
|
1076
1153
|
message: n.message
|
|
1077
1154
|
}), s.dirty());
|
|
1078
1155
|
else if (n.kind === "nanoid")
|
|
1079
|
-
|
|
1156
|
+
Ke.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1080
1157
|
validation: "nanoid",
|
|
1081
1158
|
code: d.invalid_string,
|
|
1082
1159
|
message: n.message
|
|
1083
1160
|
}), s.dirty());
|
|
1084
1161
|
else if (n.kind === "cuid")
|
|
1085
|
-
|
|
1162
|
+
Ye.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1086
1163
|
validation: "cuid",
|
|
1087
1164
|
code: d.invalid_string,
|
|
1088
1165
|
message: n.message
|
|
1089
1166
|
}), s.dirty());
|
|
1090
1167
|
else if (n.kind === "cuid2")
|
|
1091
|
-
|
|
1168
|
+
Je.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1092
1169
|
validation: "cuid2",
|
|
1093
1170
|
code: d.invalid_string,
|
|
1094
1171
|
message: n.message
|
|
1095
1172
|
}), s.dirty());
|
|
1096
1173
|
else if (n.kind === "ulid")
|
|
1097
|
-
|
|
1174
|
+
Ge.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1098
1175
|
validation: "ulid",
|
|
1099
1176
|
code: d.invalid_string,
|
|
1100
1177
|
message: n.message
|
|
@@ -1125,39 +1202,39 @@ class C extends v {
|
|
|
1125
1202
|
code: d.invalid_string,
|
|
1126
1203
|
validation: { endsWith: n.value },
|
|
1127
1204
|
message: n.message
|
|
1128
|
-
}), s.dirty()) : n.kind === "datetime" ?
|
|
1205
|
+
}), s.dirty()) : n.kind === "datetime" ? ht(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1129
1206
|
code: d.invalid_string,
|
|
1130
1207
|
validation: "datetime",
|
|
1131
1208
|
message: n.message
|
|
1132
|
-
}), s.dirty()) : n.kind === "date" ?
|
|
1209
|
+
}), s.dirty()) : n.kind === "date" ? ut.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1133
1210
|
code: d.invalid_string,
|
|
1134
1211
|
validation: "date",
|
|
1135
1212
|
message: n.message
|
|
1136
|
-
}), s.dirty()) : n.kind === "time" ?
|
|
1213
|
+
}), s.dirty()) : n.kind === "time" ? lt(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1137
1214
|
code: d.invalid_string,
|
|
1138
1215
|
validation: "time",
|
|
1139
1216
|
message: n.message
|
|
1140
|
-
}), s.dirty()) : n.kind === "duration" ?
|
|
1217
|
+
}), s.dirty()) : n.kind === "duration" ? tt.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1141
1218
|
validation: "duration",
|
|
1142
1219
|
code: d.invalid_string,
|
|
1143
1220
|
message: n.message
|
|
1144
|
-
}), s.dirty()) : n.kind === "ip" ?
|
|
1221
|
+
}), s.dirty()) : n.kind === "ip" ? ft(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1145
1222
|
validation: "ip",
|
|
1146
1223
|
code: d.invalid_string,
|
|
1147
1224
|
message: n.message
|
|
1148
|
-
}), s.dirty()) : n.kind === "jwt" ?
|
|
1225
|
+
}), s.dirty()) : n.kind === "jwt" ? mt(e.data, n.alg) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1149
1226
|
validation: "jwt",
|
|
1150
1227
|
code: d.invalid_string,
|
|
1151
1228
|
message: n.message
|
|
1152
|
-
}), s.dirty()) : n.kind === "cidr" ?
|
|
1229
|
+
}), s.dirty()) : n.kind === "cidr" ? pt(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1153
1230
|
validation: "cidr",
|
|
1154
1231
|
code: d.invalid_string,
|
|
1155
1232
|
message: n.message
|
|
1156
|
-
}), s.dirty()) : n.kind === "base64" ?
|
|
1233
|
+
}), s.dirty()) : n.kind === "base64" ? dt.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1157
1234
|
validation: "base64",
|
|
1158
1235
|
code: d.invalid_string,
|
|
1159
1236
|
message: n.message
|
|
1160
|
-
}), s.dirty()) : n.kind === "base64url" ?
|
|
1237
|
+
}), s.dirty()) : n.kind === "base64url" ? ct.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
|
|
1161
1238
|
validation: "base64url",
|
|
1162
1239
|
code: d.invalid_string,
|
|
1163
1240
|
message: n.message
|
|
@@ -1172,7 +1249,7 @@ class C extends v {
|
|
|
1172
1249
|
});
|
|
1173
1250
|
}
|
|
1174
1251
|
_addCheck(e) {
|
|
1175
|
-
return new
|
|
1252
|
+
return new I({
|
|
1176
1253
|
...this._def,
|
|
1177
1254
|
checks: [...this._def.checks, e]
|
|
1178
1255
|
});
|
|
@@ -1308,19 +1385,19 @@ class C extends v {
|
|
|
1308
1385
|
return this.min(1, h.errToObj(e));
|
|
1309
1386
|
}
|
|
1310
1387
|
trim() {
|
|
1311
|
-
return new
|
|
1388
|
+
return new I({
|
|
1312
1389
|
...this._def,
|
|
1313
1390
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1314
1391
|
});
|
|
1315
1392
|
}
|
|
1316
1393
|
toLowerCase() {
|
|
1317
|
-
return new
|
|
1394
|
+
return new I({
|
|
1318
1395
|
...this._def,
|
|
1319
1396
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1320
1397
|
});
|
|
1321
1398
|
}
|
|
1322
1399
|
toUpperCase() {
|
|
1323
|
-
return new
|
|
1400
|
+
return new I({
|
|
1324
1401
|
...this._def,
|
|
1325
1402
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1326
1403
|
});
|
|
@@ -1386,17 +1463,17 @@ class C extends v {
|
|
|
1386
1463
|
return e;
|
|
1387
1464
|
}
|
|
1388
1465
|
}
|
|
1389
|
-
|
|
1466
|
+
I.create = (r) => new I({
|
|
1390
1467
|
checks: [],
|
|
1391
1468
|
typeName: p.ZodString,
|
|
1392
1469
|
coerce: r?.coerce ?? !1,
|
|
1393
1470
|
...g(r)
|
|
1394
1471
|
});
|
|
1395
|
-
function
|
|
1472
|
+
function gt(r, e) {
|
|
1396
1473
|
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(".", ""));
|
|
1397
1474
|
return n % i / 10 ** a;
|
|
1398
1475
|
}
|
|
1399
|
-
class
|
|
1476
|
+
class $ extends v {
|
|
1400
1477
|
constructor() {
|
|
1401
1478
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1402
1479
|
}
|
|
@@ -1431,7 +1508,7 @@ class M extends v {
|
|
|
1431
1508
|
inclusive: n.inclusive,
|
|
1432
1509
|
exact: !1,
|
|
1433
1510
|
message: n.message
|
|
1434
|
-
}), a.dirty()) : n.kind === "multipleOf" ?
|
|
1511
|
+
}), a.dirty()) : n.kind === "multipleOf" ? gt(e.data, n.value) !== 0 && (s = this._getOrReturnCtx(e, s), c(s, {
|
|
1435
1512
|
code: d.not_multiple_of,
|
|
1436
1513
|
multipleOf: n.value,
|
|
1437
1514
|
message: n.message
|
|
@@ -1454,7 +1531,7 @@ class M extends v {
|
|
|
1454
1531
|
return this.setLimit("max", e, !1, h.toString(t));
|
|
1455
1532
|
}
|
|
1456
1533
|
setLimit(e, t, s, a) {
|
|
1457
|
-
return new
|
|
1534
|
+
return new $({
|
|
1458
1535
|
...this._def,
|
|
1459
1536
|
checks: [
|
|
1460
1537
|
...this._def.checks,
|
|
@@ -1468,7 +1545,7 @@ class M extends v {
|
|
|
1468
1545
|
});
|
|
1469
1546
|
}
|
|
1470
1547
|
_addCheck(e) {
|
|
1471
|
-
return new
|
|
1548
|
+
return new $({
|
|
1472
1549
|
...this._def,
|
|
1473
1550
|
checks: [...this._def.checks, e]
|
|
1474
1551
|
});
|
|
@@ -1562,13 +1639,13 @@ class M extends v {
|
|
|
1562
1639
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1563
1640
|
}
|
|
1564
1641
|
}
|
|
1565
|
-
|
|
1642
|
+
$.create = (r) => new $({
|
|
1566
1643
|
checks: [],
|
|
1567
1644
|
typeName: p.ZodNumber,
|
|
1568
1645
|
coerce: r?.coerce || !1,
|
|
1569
1646
|
...g(r)
|
|
1570
1647
|
});
|
|
1571
|
-
class
|
|
1648
|
+
class B extends v {
|
|
1572
1649
|
constructor() {
|
|
1573
1650
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1574
1651
|
}
|
|
@@ -1624,7 +1701,7 @@ class F extends v {
|
|
|
1624
1701
|
return this.setLimit("max", e, !1, h.toString(t));
|
|
1625
1702
|
}
|
|
1626
1703
|
setLimit(e, t, s, a) {
|
|
1627
|
-
return new
|
|
1704
|
+
return new B({
|
|
1628
1705
|
...this._def,
|
|
1629
1706
|
checks: [
|
|
1630
1707
|
...this._def.checks,
|
|
@@ -1638,7 +1715,7 @@ class F extends v {
|
|
|
1638
1715
|
});
|
|
1639
1716
|
}
|
|
1640
1717
|
_addCheck(e) {
|
|
1641
|
-
return new
|
|
1718
|
+
return new B({
|
|
1642
1719
|
...this._def,
|
|
1643
1720
|
checks: [...this._def.checks, e]
|
|
1644
1721
|
});
|
|
@@ -1695,7 +1772,7 @@ class F extends v {
|
|
|
1695
1772
|
return e;
|
|
1696
1773
|
}
|
|
1697
1774
|
}
|
|
1698
|
-
|
|
1775
|
+
B.create = (r) => new B({
|
|
1699
1776
|
checks: [],
|
|
1700
1777
|
typeName: p.ZodBigInt,
|
|
1701
1778
|
coerce: r?.coerce ?? !1,
|
|
@@ -1872,7 +1949,7 @@ fe.create = (r) => new fe({
|
|
|
1872
1949
|
typeName: p.ZodUnknown,
|
|
1873
1950
|
...g(r)
|
|
1874
1951
|
});
|
|
1875
|
-
class
|
|
1952
|
+
class R extends v {
|
|
1876
1953
|
_parse(e) {
|
|
1877
1954
|
const t = this._getOrReturnCtx(e);
|
|
1878
1955
|
return c(t, {
|
|
@@ -1882,7 +1959,7 @@ class O extends v {
|
|
|
1882
1959
|
}), m;
|
|
1883
1960
|
}
|
|
1884
1961
|
}
|
|
1885
|
-
|
|
1962
|
+
R.create = (r) => new R({
|
|
1886
1963
|
typeName: p.ZodNever,
|
|
1887
1964
|
...g(r)
|
|
1888
1965
|
});
|
|
@@ -1939,8 +2016,8 @@ class A extends v {
|
|
|
1939
2016
|
exact: !1,
|
|
1940
2017
|
message: a.maxLength.message
|
|
1941
2018
|
}), s.dirty()), t.common.async)
|
|
1942
|
-
return Promise.all([...t.data].map((i, o) => a.type._parseAsync(new
|
|
1943
|
-
const n = [...t.data].map((i, o) => a.type._parseSync(new
|
|
2019
|
+
return Promise.all([...t.data].map((i, o) => a.type._parseAsync(new O(t, i, t.path, o)))).then((i) => b.mergeArray(s, i));
|
|
2020
|
+
const n = [...t.data].map((i, o) => a.type._parseSync(new O(t, i, t.path, o)));
|
|
1944
2021
|
return b.mergeArray(s, n);
|
|
1945
2022
|
}
|
|
1946
2023
|
get element() {
|
|
@@ -1977,22 +2054,22 @@ A.create = (r, e) => new A({
|
|
|
1977
2054
|
...g(e)
|
|
1978
2055
|
});
|
|
1979
2056
|
function j(r) {
|
|
1980
|
-
if (r instanceof
|
|
2057
|
+
if (r instanceof x) {
|
|
1981
2058
|
const e = {};
|
|
1982
2059
|
for (const t in r.shape) {
|
|
1983
2060
|
const s = r.shape[t];
|
|
1984
|
-
e[t] =
|
|
2061
|
+
e[t] = N.create(j(s));
|
|
1985
2062
|
}
|
|
1986
|
-
return new
|
|
2063
|
+
return new x({
|
|
1987
2064
|
...r._def,
|
|
1988
2065
|
shape: () => e
|
|
1989
2066
|
});
|
|
1990
2067
|
} else return r instanceof A ? new A({
|
|
1991
2068
|
...r._def,
|
|
1992
2069
|
type: j(r.element)
|
|
1993
|
-
}) : r instanceof
|
|
2070
|
+
}) : r instanceof N ? N.create(j(r.unwrap())) : r instanceof L ? L.create(j(r.unwrap())) : r instanceof Z ? Z.create(r.items.map((e) => j(e))) : r;
|
|
1994
2071
|
}
|
|
1995
|
-
class
|
|
2072
|
+
class x extends v {
|
|
1996
2073
|
constructor() {
|
|
1997
2074
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1998
2075
|
}
|
|
@@ -2012,19 +2089,19 @@ class k extends v {
|
|
|
2012
2089
|
}), m;
|
|
2013
2090
|
}
|
|
2014
2091
|
const { status: s, ctx: a } = this._processInputParams(e), { shape: n, keys: i } = this._getCached(), o = [];
|
|
2015
|
-
if (!(this._def.catchall instanceof
|
|
2092
|
+
if (!(this._def.catchall instanceof R && this._def.unknownKeys === "strip"))
|
|
2016
2093
|
for (const f in a.data)
|
|
2017
2094
|
i.includes(f) || o.push(f);
|
|
2018
2095
|
const u = [];
|
|
2019
2096
|
for (const f of i) {
|
|
2020
|
-
const y = n[f],
|
|
2097
|
+
const y = n[f], E = a.data[f];
|
|
2021
2098
|
u.push({
|
|
2022
2099
|
key: { status: "valid", value: f },
|
|
2023
|
-
value: y._parse(new
|
|
2100
|
+
value: y._parse(new O(a, E, a.path, f)),
|
|
2024
2101
|
alwaysSet: f in a.data
|
|
2025
2102
|
});
|
|
2026
2103
|
}
|
|
2027
|
-
if (this._def.catchall instanceof
|
|
2104
|
+
if (this._def.catchall instanceof R) {
|
|
2028
2105
|
const f = this._def.unknownKeys;
|
|
2029
2106
|
if (f === "passthrough")
|
|
2030
2107
|
for (const y of o)
|
|
@@ -2041,11 +2118,11 @@ class k extends v {
|
|
|
2041
2118
|
} else {
|
|
2042
2119
|
const f = this._def.catchall;
|
|
2043
2120
|
for (const y of o) {
|
|
2044
|
-
const
|
|
2121
|
+
const E = a.data[y];
|
|
2045
2122
|
u.push({
|
|
2046
2123
|
key: { status: "valid", value: y },
|
|
2047
2124
|
value: f._parse(
|
|
2048
|
-
new
|
|
2125
|
+
new O(a, E, a.path, y)
|
|
2049
2126
|
//, ctx.child(key), value, getParsedType(value)
|
|
2050
2127
|
),
|
|
2051
2128
|
alwaysSet: y in a.data
|
|
@@ -2055,9 +2132,9 @@ class k extends v {
|
|
|
2055
2132
|
return a.common.async ? Promise.resolve().then(async () => {
|
|
2056
2133
|
const f = [];
|
|
2057
2134
|
for (const y of u) {
|
|
2058
|
-
const
|
|
2135
|
+
const E = await y.key, Te = await y.value;
|
|
2059
2136
|
f.push({
|
|
2060
|
-
key:
|
|
2137
|
+
key: E,
|
|
2061
2138
|
value: Te,
|
|
2062
2139
|
alwaysSet: y.alwaysSet
|
|
2063
2140
|
});
|
|
@@ -2069,7 +2146,7 @@ class k extends v {
|
|
|
2069
2146
|
return this._def.shape();
|
|
2070
2147
|
}
|
|
2071
2148
|
strict(e) {
|
|
2072
|
-
return h.errToObj, new
|
|
2149
|
+
return h.errToObj, new x({
|
|
2073
2150
|
...this._def,
|
|
2074
2151
|
unknownKeys: "strict",
|
|
2075
2152
|
...e !== void 0 ? {
|
|
@@ -2085,13 +2162,13 @@ class k extends v {
|
|
|
2085
2162
|
});
|
|
2086
2163
|
}
|
|
2087
2164
|
strip() {
|
|
2088
|
-
return new
|
|
2165
|
+
return new x({
|
|
2089
2166
|
...this._def,
|
|
2090
2167
|
unknownKeys: "strip"
|
|
2091
2168
|
});
|
|
2092
2169
|
}
|
|
2093
2170
|
passthrough() {
|
|
2094
|
-
return new
|
|
2171
|
+
return new x({
|
|
2095
2172
|
...this._def,
|
|
2096
2173
|
unknownKeys: "passthrough"
|
|
2097
2174
|
});
|
|
@@ -2114,7 +2191,7 @@ class k extends v {
|
|
|
2114
2191
|
// }) as any;
|
|
2115
2192
|
// };
|
|
2116
2193
|
extend(e) {
|
|
2117
|
-
return new
|
|
2194
|
+
return new x({
|
|
2118
2195
|
...this._def,
|
|
2119
2196
|
shape: () => ({
|
|
2120
2197
|
...this._def.shape(),
|
|
@@ -2128,7 +2205,7 @@ class k extends v {
|
|
|
2128
2205
|
* upgrade if you are experiencing issues.
|
|
2129
2206
|
*/
|
|
2130
2207
|
merge(e) {
|
|
2131
|
-
return new
|
|
2208
|
+
return new x({
|
|
2132
2209
|
unknownKeys: e._def.unknownKeys,
|
|
2133
2210
|
catchall: e._def.catchall,
|
|
2134
2211
|
shape: () => ({
|
|
@@ -2198,7 +2275,7 @@ class k extends v {
|
|
|
2198
2275
|
// return merged;
|
|
2199
2276
|
// }
|
|
2200
2277
|
catchall(e) {
|
|
2201
|
-
return new
|
|
2278
|
+
return new x({
|
|
2202
2279
|
...this._def,
|
|
2203
2280
|
catchall: e
|
|
2204
2281
|
});
|
|
@@ -2207,7 +2284,7 @@ class k extends v {
|
|
|
2207
2284
|
const t = {};
|
|
2208
2285
|
for (const s of _.objectKeys(e))
|
|
2209
2286
|
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
2210
|
-
return new
|
|
2287
|
+
return new x({
|
|
2211
2288
|
...this._def,
|
|
2212
2289
|
shape: () => t
|
|
2213
2290
|
});
|
|
@@ -2216,7 +2293,7 @@ class k extends v {
|
|
|
2216
2293
|
const t = {};
|
|
2217
2294
|
for (const s of _.objectKeys(this.shape))
|
|
2218
2295
|
e[s] || (t[s] = this.shape[s]);
|
|
2219
|
-
return new
|
|
2296
|
+
return new x({
|
|
2220
2297
|
...this._def,
|
|
2221
2298
|
shape: () => t
|
|
2222
2299
|
});
|
|
@@ -2233,7 +2310,7 @@ class k extends v {
|
|
|
2233
2310
|
const a = this.shape[s];
|
|
2234
2311
|
e && !e[s] ? t[s] = a : t[s] = a.optional();
|
|
2235
2312
|
}
|
|
2236
|
-
return new
|
|
2313
|
+
return new x({
|
|
2237
2314
|
...this._def,
|
|
2238
2315
|
shape: () => t
|
|
2239
2316
|
});
|
|
@@ -2245,11 +2322,11 @@ class k extends v {
|
|
|
2245
2322
|
t[s] = this.shape[s];
|
|
2246
2323
|
else {
|
|
2247
2324
|
let n = this.shape[s];
|
|
2248
|
-
for (; n instanceof
|
|
2325
|
+
for (; n instanceof N; )
|
|
2249
2326
|
n = n._def.innerType;
|
|
2250
2327
|
t[s] = n;
|
|
2251
2328
|
}
|
|
2252
|
-
return new
|
|
2329
|
+
return new x({
|
|
2253
2330
|
...this._def,
|
|
2254
2331
|
shape: () => t
|
|
2255
2332
|
});
|
|
@@ -2258,24 +2335,24 @@ class k extends v {
|
|
|
2258
2335
|
return be(_.objectKeys(this.shape));
|
|
2259
2336
|
}
|
|
2260
2337
|
}
|
|
2261
|
-
|
|
2338
|
+
x.create = (r, e) => new x({
|
|
2262
2339
|
shape: () => r,
|
|
2263
2340
|
unknownKeys: "strip",
|
|
2264
|
-
catchall:
|
|
2341
|
+
catchall: R.create(),
|
|
2265
2342
|
typeName: p.ZodObject,
|
|
2266
2343
|
...g(e)
|
|
2267
2344
|
});
|
|
2268
|
-
|
|
2345
|
+
x.strictCreate = (r, e) => new x({
|
|
2269
2346
|
shape: () => r,
|
|
2270
2347
|
unknownKeys: "strict",
|
|
2271
|
-
catchall:
|
|
2348
|
+
catchall: R.create(),
|
|
2272
2349
|
typeName: p.ZodObject,
|
|
2273
2350
|
...g(e)
|
|
2274
2351
|
});
|
|
2275
|
-
|
|
2352
|
+
x.lazycreate = (r, e) => new x({
|
|
2276
2353
|
shape: r,
|
|
2277
2354
|
unknownKeys: "strip",
|
|
2278
|
-
catchall:
|
|
2355
|
+
catchall: R.create(),
|
|
2279
2356
|
typeName: p.ZodObject,
|
|
2280
2357
|
...g(e)
|
|
2281
2358
|
});
|
|
@@ -2353,7 +2430,7 @@ q.create = (r, e) => new q({
|
|
|
2353
2430
|
...g(e)
|
|
2354
2431
|
});
|
|
2355
2432
|
function ee(r, e) {
|
|
2356
|
-
const t =
|
|
2433
|
+
const t = C(r), s = C(e);
|
|
2357
2434
|
if (r === e)
|
|
2358
2435
|
return { valid: !0, data: r };
|
|
2359
2436
|
if (t === l.object && s === l.object) {
|
|
@@ -2416,7 +2493,7 @@ Q.create = (r, e, t) => new Q({
|
|
|
2416
2493
|
typeName: p.ZodIntersection,
|
|
2417
2494
|
...g(t)
|
|
2418
2495
|
});
|
|
2419
|
-
class
|
|
2496
|
+
class Z extends v {
|
|
2420
2497
|
_parse(e) {
|
|
2421
2498
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2422
2499
|
if (s.parsedType !== l.array)
|
|
@@ -2442,7 +2519,7 @@ class E extends v {
|
|
|
2442
2519
|
}), t.dirty());
|
|
2443
2520
|
const n = [...s.data].map((i, o) => {
|
|
2444
2521
|
const u = this._def.items[o] || this._def.rest;
|
|
2445
|
-
return u ? u._parse(new
|
|
2522
|
+
return u ? u._parse(new O(s, i, s.path, o)) : null;
|
|
2446
2523
|
}).filter((i) => !!i);
|
|
2447
2524
|
return s.common.async ? Promise.all(n).then((i) => b.mergeArray(t, i)) : b.mergeArray(t, n);
|
|
2448
2525
|
}
|
|
@@ -2450,16 +2527,16 @@ class E extends v {
|
|
|
2450
2527
|
return this._def.items;
|
|
2451
2528
|
}
|
|
2452
2529
|
rest(e) {
|
|
2453
|
-
return new
|
|
2530
|
+
return new Z({
|
|
2454
2531
|
...this._def,
|
|
2455
2532
|
rest: e
|
|
2456
2533
|
});
|
|
2457
2534
|
}
|
|
2458
2535
|
}
|
|
2459
|
-
|
|
2536
|
+
Z.create = (r, e) => {
|
|
2460
2537
|
if (!Array.isArray(r))
|
|
2461
2538
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2462
|
-
return new
|
|
2539
|
+
return new Z({
|
|
2463
2540
|
items: r,
|
|
2464
2541
|
typeName: p.ZodTuple,
|
|
2465
2542
|
rest: null,
|
|
@@ -2482,8 +2559,8 @@ class pe extends v {
|
|
|
2482
2559
|
received: s.parsedType
|
|
2483
2560
|
}), m;
|
|
2484
2561
|
const a = this._def.keyType, n = this._def.valueType, i = [...s.data.entries()].map(([o, u], f) => ({
|
|
2485
|
-
key: a._parse(new
|
|
2486
|
-
value: n._parse(new
|
|
2562
|
+
key: a._parse(new O(s, o, s.path, [f, "key"])),
|
|
2563
|
+
value: n._parse(new O(s, u, s.path, [f, "value"]))
|
|
2487
2564
|
}));
|
|
2488
2565
|
if (s.common.async) {
|
|
2489
2566
|
const o = /* @__PURE__ */ new Map();
|
|
@@ -2514,7 +2591,7 @@ pe.create = (r, e, t) => new pe({
|
|
|
2514
2591
|
typeName: p.ZodMap,
|
|
2515
2592
|
...g(t)
|
|
2516
2593
|
});
|
|
2517
|
-
class
|
|
2594
|
+
class H extends v {
|
|
2518
2595
|
_parse(e) {
|
|
2519
2596
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2520
2597
|
if (s.parsedType !== l.set)
|
|
@@ -2549,17 +2626,17 @@ class B extends v {
|
|
|
2549
2626
|
}
|
|
2550
2627
|
return { status: t.value, value: f };
|
|
2551
2628
|
}
|
|
2552
|
-
const o = [...s.data.values()].map((u, f) => n._parse(new
|
|
2629
|
+
const o = [...s.data.values()].map((u, f) => n._parse(new O(s, u, s.path, f)));
|
|
2553
2630
|
return s.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2554
2631
|
}
|
|
2555
2632
|
min(e, t) {
|
|
2556
|
-
return new
|
|
2633
|
+
return new H({
|
|
2557
2634
|
...this._def,
|
|
2558
2635
|
minSize: { value: e, message: h.toString(t) }
|
|
2559
2636
|
});
|
|
2560
2637
|
}
|
|
2561
2638
|
max(e, t) {
|
|
2562
|
-
return new
|
|
2639
|
+
return new H({
|
|
2563
2640
|
...this._def,
|
|
2564
2641
|
maxSize: { value: e, message: h.toString(t) }
|
|
2565
2642
|
});
|
|
@@ -2571,7 +2648,7 @@ class B extends v {
|
|
|
2571
2648
|
return this.min(1, e);
|
|
2572
2649
|
}
|
|
2573
2650
|
}
|
|
2574
|
-
|
|
2651
|
+
H.create = (r, e) => new H({
|
|
2575
2652
|
valueType: r,
|
|
2576
2653
|
minSize: null,
|
|
2577
2654
|
maxSize: null,
|
|
@@ -2614,13 +2691,13 @@ ye.create = (r, e) => new ye({
|
|
|
2614
2691
|
...g(e)
|
|
2615
2692
|
});
|
|
2616
2693
|
function be(r, e) {
|
|
2617
|
-
return new
|
|
2694
|
+
return new M({
|
|
2618
2695
|
values: r,
|
|
2619
2696
|
typeName: p.ZodEnum,
|
|
2620
2697
|
...g(e)
|
|
2621
2698
|
});
|
|
2622
2699
|
}
|
|
2623
|
-
class
|
|
2700
|
+
class M extends v {
|
|
2624
2701
|
_parse(e) {
|
|
2625
2702
|
if (typeof e.data != "string") {
|
|
2626
2703
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
@@ -2662,19 +2739,19 @@ class P extends v {
|
|
|
2662
2739
|
return e;
|
|
2663
2740
|
}
|
|
2664
2741
|
extract(e, t = this._def) {
|
|
2665
|
-
return
|
|
2742
|
+
return M.create(e, {
|
|
2666
2743
|
...this._def,
|
|
2667
2744
|
...t
|
|
2668
2745
|
});
|
|
2669
2746
|
}
|
|
2670
2747
|
exclude(e, t = this._def) {
|
|
2671
|
-
return
|
|
2748
|
+
return M.create(this.options.filter((s) => !e.includes(s)), {
|
|
2672
2749
|
...this._def,
|
|
2673
2750
|
...t
|
|
2674
2751
|
});
|
|
2675
2752
|
}
|
|
2676
2753
|
}
|
|
2677
|
-
|
|
2754
|
+
M.create = be;
|
|
2678
2755
|
class ve extends v {
|
|
2679
2756
|
_parse(e) {
|
|
2680
2757
|
const t = _.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
@@ -2756,7 +2833,7 @@ class V extends v {
|
|
|
2756
2833
|
path: s.path,
|
|
2757
2834
|
parent: s
|
|
2758
2835
|
});
|
|
2759
|
-
return u.status === "aborted" ? m : u.status === "dirty" || t.value === "dirty" ?
|
|
2836
|
+
return u.status === "aborted" ? m : u.status === "dirty" || t.value === "dirty" ? F(u.value) : u;
|
|
2760
2837
|
});
|
|
2761
2838
|
{
|
|
2762
2839
|
if (t.value === "aborted")
|
|
@@ -2766,7 +2843,7 @@ class V extends v {
|
|
|
2766
2843
|
path: s.path,
|
|
2767
2844
|
parent: s
|
|
2768
2845
|
});
|
|
2769
|
-
return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ?
|
|
2846
|
+
return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ? F(o.value) : o;
|
|
2770
2847
|
}
|
|
2771
2848
|
}
|
|
2772
2849
|
if (a.type === "refinement") {
|
|
@@ -2795,14 +2872,14 @@ class V extends v {
|
|
|
2795
2872
|
path: s.path,
|
|
2796
2873
|
parent: s
|
|
2797
2874
|
});
|
|
2798
|
-
if (
|
|
2875
|
+
if (!P(i))
|
|
2799
2876
|
return m;
|
|
2800
2877
|
const o = a.transform(i.value, n);
|
|
2801
2878
|
if (o instanceof Promise)
|
|
2802
2879
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2803
2880
|
return { status: t.value, value: o };
|
|
2804
2881
|
} else
|
|
2805
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) =>
|
|
2882
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => P(i) ? Promise.resolve(a.transform(i.value, n)).then((o) => ({
|
|
2806
2883
|
status: t.value,
|
|
2807
2884
|
value: o
|
|
2808
2885
|
})) : m);
|
|
@@ -2821,7 +2898,7 @@ V.createWithPreprocess = (r, e, t) => new V({
|
|
|
2821
2898
|
typeName: p.ZodEffects,
|
|
2822
2899
|
...g(t)
|
|
2823
2900
|
});
|
|
2824
|
-
class
|
|
2901
|
+
class N extends v {
|
|
2825
2902
|
_parse(e) {
|
|
2826
2903
|
return this._getType(e) === l.undefined ? w(void 0) : this._def.innerType._parse(e);
|
|
2827
2904
|
}
|
|
@@ -2829,7 +2906,7 @@ class I extends v {
|
|
|
2829
2906
|
return this._def.innerType;
|
|
2830
2907
|
}
|
|
2831
2908
|
}
|
|
2832
|
-
|
|
2909
|
+
N.create = (r, e) => new N({
|
|
2833
2910
|
innerType: r,
|
|
2834
2911
|
typeName: p.ZodOptional,
|
|
2835
2912
|
...g(e)
|
|
@@ -2882,7 +2959,7 @@ class se extends v {
|
|
|
2882
2959
|
...s
|
|
2883
2960
|
}
|
|
2884
2961
|
});
|
|
2885
|
-
return
|
|
2962
|
+
return U(a) ? a.then((n) => ({
|
|
2886
2963
|
status: "valid",
|
|
2887
2964
|
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
2888
2965
|
get error() {
|
|
@@ -2927,7 +3004,7 @@ _e.create = (r) => new _e({
|
|
|
2927
3004
|
typeName: p.ZodNaN,
|
|
2928
3005
|
...g(r)
|
|
2929
3006
|
});
|
|
2930
|
-
class
|
|
3007
|
+
class yt extends v {
|
|
2931
3008
|
_parse(e) {
|
|
2932
3009
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
2933
3010
|
return this._def.type._parse({
|
|
@@ -2950,7 +3027,7 @@ class ae extends v {
|
|
|
2950
3027
|
path: s.path,
|
|
2951
3028
|
parent: s
|
|
2952
3029
|
});
|
|
2953
|
-
return n.status === "aborted" ? m : n.status === "dirty" ? (t.dirty(),
|
|
3030
|
+
return n.status === "aborted" ? m : n.status === "dirty" ? (t.dirty(), F(n.value)) : this._def.out._parseAsync({
|
|
2954
3031
|
data: n.value,
|
|
2955
3032
|
path: s.path,
|
|
2956
3033
|
parent: s
|
|
@@ -2982,8 +3059,8 @@ class ae extends v {
|
|
|
2982
3059
|
}
|
|
2983
3060
|
class re extends v {
|
|
2984
3061
|
_parse(e) {
|
|
2985
|
-
const t = this._def.innerType._parse(e), s = (a) => (
|
|
2986
|
-
return
|
|
3062
|
+
const t = this._def.innerType._parse(e), s = (a) => (P(a) && (a.value = Object.freeze(a.value)), a);
|
|
3063
|
+
return U(t) ? t.then((a) => s(a)) : s(t);
|
|
2987
3064
|
}
|
|
2988
3065
|
unwrap() {
|
|
2989
3066
|
return this._def.innerType;
|
|
@@ -2998,76 +3075,83 @@ var p;
|
|
|
2998
3075
|
(function(r) {
|
|
2999
3076
|
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";
|
|
3000
3077
|
})(p || (p = {}));
|
|
3001
|
-
const
|
|
3002
|
-
|
|
3003
|
-
const
|
|
3078
|
+
const k = I.create, z = $.create, we = K.create;
|
|
3079
|
+
R.create;
|
|
3080
|
+
const D = A.create, S = x.create;
|
|
3004
3081
|
q.create;
|
|
3005
3082
|
Q.create;
|
|
3006
|
-
|
|
3007
|
-
const
|
|
3083
|
+
Z.create;
|
|
3084
|
+
const vt = M.create;
|
|
3008
3085
|
Y.create;
|
|
3009
|
-
|
|
3086
|
+
N.create;
|
|
3010
3087
|
L.create;
|
|
3011
|
-
const J =
|
|
3012
|
-
provider:
|
|
3013
|
-
id:
|
|
3014
|
-
url:
|
|
3015
|
-
}),
|
|
3016
|
-
url:
|
|
3017
|
-
width:
|
|
3018
|
-
height:
|
|
3019
|
-
purpose:
|
|
3088
|
+
const J = S({
|
|
3089
|
+
provider: k(),
|
|
3090
|
+
id: k(),
|
|
3091
|
+
url: k().optional()
|
|
3092
|
+
}), _t = S({
|
|
3093
|
+
url: k(),
|
|
3094
|
+
width: z().optional(),
|
|
3095
|
+
height: z().optional(),
|
|
3096
|
+
purpose: vt(["avatar", "cover", "background", "thumbnail"]).optional(),
|
|
3020
3097
|
source: J.optional()
|
|
3021
|
-
}), Ae =
|
|
3022
|
-
items:
|
|
3023
|
-
}),
|
|
3024
|
-
name:
|
|
3025
|
-
roles:
|
|
3098
|
+
}), Ae = S({
|
|
3099
|
+
items: D(_t)
|
|
3100
|
+
}), kt = S({
|
|
3101
|
+
name: k(),
|
|
3102
|
+
roles: D(k()),
|
|
3026
3103
|
source: J.optional()
|
|
3027
|
-
}),
|
|
3028
|
-
title:
|
|
3029
|
-
artists:
|
|
3030
|
-
durationMs:
|
|
3104
|
+
}), xt = S({
|
|
3105
|
+
title: k(),
|
|
3106
|
+
artists: D(kt),
|
|
3107
|
+
durationMs: z().optional(),
|
|
3031
3108
|
source: J
|
|
3032
|
-
}).passthrough(),
|
|
3033
|
-
id:
|
|
3034
|
-
track:
|
|
3035
|
-
note:
|
|
3036
|
-
addedAtIso:
|
|
3037
|
-
}),
|
|
3038
|
-
id:
|
|
3039
|
-
name:
|
|
3040
|
-
description:
|
|
3109
|
+
}).passthrough(), bt = S({
|
|
3110
|
+
id: k(),
|
|
3111
|
+
track: xt,
|
|
3112
|
+
note: k().optional(),
|
|
3113
|
+
addedAtIso: k()
|
|
3114
|
+
}), Ot = 1, wt = S({
|
|
3115
|
+
id: k(),
|
|
3116
|
+
name: k(),
|
|
3117
|
+
description: k().optional(),
|
|
3041
3118
|
artwork: Ae.optional(),
|
|
3042
|
-
tags:
|
|
3043
|
-
createdAtIso:
|
|
3044
|
-
lastModifiedIso:
|
|
3119
|
+
tags: D(k()).optional(),
|
|
3120
|
+
createdAtIso: k(),
|
|
3121
|
+
lastModifiedIso: k(),
|
|
3045
3122
|
origin: J.optional(),
|
|
3046
3123
|
isReadOnly: we(),
|
|
3047
|
-
parentId:
|
|
3048
|
-
items:
|
|
3049
|
-
}),
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3124
|
+
parentId: k().optional(),
|
|
3125
|
+
items: D(bt)
|
|
3126
|
+
}), Rt = S({
|
|
3127
|
+
version: z(),
|
|
3128
|
+
playlist: wt
|
|
3129
|
+
}), At = S({
|
|
3130
|
+
id: k(),
|
|
3131
|
+
name: k(),
|
|
3132
|
+
createdAtIso: k(),
|
|
3133
|
+
lastModifiedIso: k(),
|
|
3054
3134
|
isReadOnly: we(),
|
|
3055
3135
|
artwork: Ae.optional(),
|
|
3056
|
-
itemCount:
|
|
3057
|
-
totalDurationMs:
|
|
3058
|
-
}),
|
|
3136
|
+
itemCount: z(),
|
|
3137
|
+
totalDurationMs: z()
|
|
3138
|
+
}), Et = D(At);
|
|
3059
3139
|
export {
|
|
3060
3140
|
Ne as DashboardAPI,
|
|
3061
3141
|
Oe as FavoritesAPI,
|
|
3062
3142
|
je as HttpAPI,
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3143
|
+
$e as LoggerAPI,
|
|
3144
|
+
Ct as MissingCapabilityError,
|
|
3145
|
+
Ue as NuclearAPI,
|
|
3146
|
+
St as NuclearPluginAPI,
|
|
3147
|
+
Ot as PLAYLIST_EXPORT_VERSION,
|
|
3148
|
+
Ve as PlaybackAPI,
|
|
3149
|
+
Le as PlaylistsAPI,
|
|
3150
|
+
He as YtdlpAPI,
|
|
3151
|
+
Nt as pickArtwork,
|
|
3152
|
+
Rt as playlistExportSchema,
|
|
3153
|
+
At as playlistIndexEntrySchema,
|
|
3154
|
+
Et as playlistIndexSchema,
|
|
3155
|
+
wt as playlistSchema,
|
|
3156
|
+
It as useSetting
|
|
3073
3157
|
};
|