@animaapp/anima-sdk 0.2.3 → 0.2.5
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/.turbo/turbo-build.log +14 -12
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +437 -431
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/anima.ts +7 -0
- package/src/settings.ts +2 -0
- package/src/types.ts +36 -34
package/dist/index.js
CHANGED
|
@@ -14,8 +14,8 @@ var Rt = (n, e, t) => e in n ? fn(n, e, { enumerable: !0, configurable: !0, writ
|
|
|
14
14
|
return n;
|
|
15
15
|
}, y = (n, e) => hn(n, pn(e));
|
|
16
16
|
var Mt = (n, e, t) => e.has(n) || Zt("Cannot " + t);
|
|
17
|
-
var
|
|
18
|
-
var
|
|
17
|
+
var K = (n, e, t) => (Mt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), ot = (n, e, t) => e.has(n) ? Zt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), ct = (n, e, t, s) => (Mt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
|
|
18
|
+
var F = (n, e, t) => new Promise((s, r) => {
|
|
19
19
|
var a = (c) => {
|
|
20
20
|
try {
|
|
21
21
|
o(t.next(c));
|
|
@@ -31,7 +31,7 @@ var P = (n, e, t) => new Promise((s, r) => {
|
|
|
31
31
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
32
32
|
o((t = t.apply(n, e)).next());
|
|
33
33
|
});
|
|
34
|
-
class
|
|
34
|
+
class Oe extends Error {
|
|
35
35
|
constructor({ name: e, reason: t, status: s }) {
|
|
36
36
|
super(), this.name = `[Codegen Error] ${e}`, this.message = t, this.status = s;
|
|
37
37
|
}
|
|
@@ -72,10 +72,10 @@ var x;
|
|
|
72
72
|
}
|
|
73
73
|
n.joinValues = s, n.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
|
|
74
74
|
})(x || (x = {}));
|
|
75
|
-
var
|
|
75
|
+
var ht;
|
|
76
76
|
(function(n) {
|
|
77
77
|
n.mergeShapes = (e, t) => u(u({}, e), t);
|
|
78
|
-
})(
|
|
78
|
+
})(ht || (ht = {}));
|
|
79
79
|
const p = x.arrayToEnum([
|
|
80
80
|
"string",
|
|
81
81
|
"nan",
|
|
@@ -97,7 +97,7 @@ const p = x.arrayToEnum([
|
|
|
97
97
|
"never",
|
|
98
98
|
"map",
|
|
99
99
|
"set"
|
|
100
|
-
]),
|
|
100
|
+
]), ie = (n) => {
|
|
101
101
|
switch (typeof n) {
|
|
102
102
|
case "undefined":
|
|
103
103
|
return p.undefined;
|
|
@@ -196,7 +196,7 @@ class U extends Error {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
U.create = (n) => new U(n);
|
|
199
|
-
const
|
|
199
|
+
const Te = (n, e) => {
|
|
200
200
|
let t;
|
|
201
201
|
switch (n.code) {
|
|
202
202
|
case l.invalid_type:
|
|
@@ -252,14 +252,14 @@ const ke = (n, e) => {
|
|
|
252
252
|
}
|
|
253
253
|
return { message: t };
|
|
254
254
|
};
|
|
255
|
-
let qt =
|
|
255
|
+
let qt = Te;
|
|
256
256
|
function vn(n) {
|
|
257
257
|
qt = n;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function Qe() {
|
|
260
260
|
return qt;
|
|
261
261
|
}
|
|
262
|
-
const
|
|
262
|
+
const et = (n) => {
|
|
263
263
|
const { data: e, path: t, errorMaps: s, issueData: r } = n, a = [...t, ...r.path || []], i = y(u({}, r), {
|
|
264
264
|
path: a
|
|
265
265
|
});
|
|
@@ -278,7 +278,7 @@ const Qe = (n) => {
|
|
|
278
278
|
});
|
|
279
279
|
}, _n = [];
|
|
280
280
|
function h(n, e) {
|
|
281
|
-
const t =
|
|
281
|
+
const t = Qe(), s = et({
|
|
282
282
|
issueData: e,
|
|
283
283
|
data: n.data,
|
|
284
284
|
path: n.path,
|
|
@@ -289,7 +289,7 @@ function h(n, e) {
|
|
|
289
289
|
// then schema-bound map if available
|
|
290
290
|
t,
|
|
291
291
|
// then global override map
|
|
292
|
-
t ===
|
|
292
|
+
t === Te ? void 0 : Te
|
|
293
293
|
// then global default map
|
|
294
294
|
].filter((r) => !!r)
|
|
295
295
|
});
|
|
@@ -315,7 +315,7 @@ class R {
|
|
|
315
315
|
return { status: e.value, value: s };
|
|
316
316
|
}
|
|
317
317
|
static mergeObjectAsync(e, t) {
|
|
318
|
-
return
|
|
318
|
+
return F(this, null, function* () {
|
|
319
319
|
const s = [];
|
|
320
320
|
for (const r of t) {
|
|
321
321
|
const a = yield r.key, i = yield r.value;
|
|
@@ -340,8 +340,8 @@ class R {
|
|
|
340
340
|
}
|
|
341
341
|
const v = Object.freeze({
|
|
342
342
|
status: "aborted"
|
|
343
|
-
}),
|
|
344
|
-
function
|
|
343
|
+
}), xe = (n) => ({ status: "dirty", value: n }), $ = (n) => ({ status: "valid", value: n }), pt = (n) => n.status === "aborted", mt = (n) => n.status === "dirty", ge = (n) => n.status === "valid", Me = (n) => typeof Promise != "undefined" && n instanceof Promise;
|
|
344
|
+
function tt(n, e, t, s) {
|
|
345
345
|
if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
346
346
|
return e.get(n);
|
|
347
347
|
}
|
|
@@ -353,8 +353,8 @@ var m;
|
|
|
353
353
|
(function(n) {
|
|
354
354
|
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
355
355
|
})(m || (m = {}));
|
|
356
|
-
var
|
|
357
|
-
class
|
|
356
|
+
var Ie, Ne;
|
|
357
|
+
class te {
|
|
358
358
|
constructor(e, t, s, r) {
|
|
359
359
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = r;
|
|
360
360
|
}
|
|
@@ -394,13 +394,13 @@ class w {
|
|
|
394
394
|
return this._def.description;
|
|
395
395
|
}
|
|
396
396
|
_getType(e) {
|
|
397
|
-
return
|
|
397
|
+
return ie(e.data);
|
|
398
398
|
}
|
|
399
399
|
_getOrReturnCtx(e, t) {
|
|
400
400
|
return t || {
|
|
401
401
|
common: e.parent.common,
|
|
402
402
|
data: e.data,
|
|
403
|
-
parsedType:
|
|
403
|
+
parsedType: ie(e.data),
|
|
404
404
|
schemaErrorMap: this._def.errorMap,
|
|
405
405
|
path: e.path,
|
|
406
406
|
parent: e.parent
|
|
@@ -412,7 +412,7 @@ class w {
|
|
|
412
412
|
ctx: {
|
|
413
413
|
common: e.parent.common,
|
|
414
414
|
data: e.data,
|
|
415
|
-
parsedType:
|
|
415
|
+
parsedType: ie(e.data),
|
|
416
416
|
schemaErrorMap: this._def.errorMap,
|
|
417
417
|
path: e.path,
|
|
418
418
|
parent: e.parent
|
|
@@ -421,7 +421,7 @@ class w {
|
|
|
421
421
|
}
|
|
422
422
|
_parseSync(e) {
|
|
423
423
|
const t = this._parse(e);
|
|
424
|
-
if (
|
|
424
|
+
if (Me(t))
|
|
425
425
|
throw new Error("Synchronous parse encountered promise.");
|
|
426
426
|
return t;
|
|
427
427
|
}
|
|
@@ -447,7 +447,7 @@ class w {
|
|
|
447
447
|
schemaErrorMap: this._def.errorMap,
|
|
448
448
|
parent: null,
|
|
449
449
|
data: e,
|
|
450
|
-
parsedType:
|
|
450
|
+
parsedType: ie(e)
|
|
451
451
|
}, a = this._parseSync({ data: e, path: r.path, parent: r });
|
|
452
452
|
return $t(r, a);
|
|
453
453
|
}
|
|
@@ -462,7 +462,7 @@ class w {
|
|
|
462
462
|
schemaErrorMap: this._def.errorMap,
|
|
463
463
|
parent: null,
|
|
464
464
|
data: e,
|
|
465
|
-
parsedType:
|
|
465
|
+
parsedType: ie(e)
|
|
466
466
|
};
|
|
467
467
|
if (!this["~standard"].async)
|
|
468
468
|
try {
|
|
@@ -485,7 +485,7 @@ class w {
|
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
parseAsync(e, t) {
|
|
488
|
-
return
|
|
488
|
+
return F(this, null, function* () {
|
|
489
489
|
const s = yield this.safeParseAsync(e, t);
|
|
490
490
|
if (s.success)
|
|
491
491
|
return s.data;
|
|
@@ -493,7 +493,7 @@ class w {
|
|
|
493
493
|
});
|
|
494
494
|
}
|
|
495
495
|
safeParseAsync(e, t) {
|
|
496
|
-
return
|
|
496
|
+
return F(this, null, function* () {
|
|
497
497
|
const s = {
|
|
498
498
|
common: {
|
|
499
499
|
issues: [],
|
|
@@ -504,8 +504,8 @@ class w {
|
|
|
504
504
|
schemaErrorMap: this._def.errorMap,
|
|
505
505
|
parent: null,
|
|
506
506
|
data: e,
|
|
507
|
-
parsedType:
|
|
508
|
-
}, r = this._parse({ data: e, path: s.path, parent: s }), a = yield
|
|
507
|
+
parsedType: ie(e)
|
|
508
|
+
}, r = this._parse({ data: e, path: s.path, parent: s }), a = yield Me(r) ? r : Promise.resolve(r);
|
|
509
509
|
return $t(s, a);
|
|
510
510
|
});
|
|
511
511
|
}
|
|
@@ -539,7 +539,7 @@ class w {
|
|
|
539
539
|
};
|
|
540
540
|
}
|
|
541
541
|
optional() {
|
|
542
|
-
return
|
|
542
|
+
return ee.create(this, this._def);
|
|
543
543
|
}
|
|
544
544
|
nullable() {
|
|
545
545
|
return he.create(this, this._def);
|
|
@@ -551,13 +551,13 @@ class w {
|
|
|
551
551
|
return J.create(this);
|
|
552
552
|
}
|
|
553
553
|
promise() {
|
|
554
|
-
return
|
|
554
|
+
return Ee.create(this, this._def);
|
|
555
555
|
}
|
|
556
556
|
or(e) {
|
|
557
|
-
return
|
|
557
|
+
return Le.create([this, e], this._def);
|
|
558
558
|
}
|
|
559
559
|
and(e) {
|
|
560
|
-
return
|
|
560
|
+
return De.create(this, e, this._def);
|
|
561
561
|
}
|
|
562
562
|
transform(e) {
|
|
563
563
|
return new G(y(u({}, b(this._def)), {
|
|
@@ -568,21 +568,21 @@ class w {
|
|
|
568
568
|
}
|
|
569
569
|
default(e) {
|
|
570
570
|
const t = typeof e == "function" ? e : () => e;
|
|
571
|
-
return new
|
|
571
|
+
return new Be(y(u({}, b(this._def)), {
|
|
572
572
|
innerType: this,
|
|
573
573
|
defaultValue: t,
|
|
574
574
|
typeName: g.ZodDefault
|
|
575
575
|
}));
|
|
576
576
|
}
|
|
577
577
|
brand() {
|
|
578
|
-
return new
|
|
578
|
+
return new Et(u({
|
|
579
579
|
typeName: g.ZodBranded,
|
|
580
580
|
type: this
|
|
581
581
|
}, b(this._def)));
|
|
582
582
|
}
|
|
583
583
|
catch(e) {
|
|
584
584
|
const t = typeof e == "function" ? e : () => e;
|
|
585
|
-
return new
|
|
585
|
+
return new qe(y(u({}, b(this._def)), {
|
|
586
586
|
innerType: this,
|
|
587
587
|
catchValue: t,
|
|
588
588
|
typeName: g.ZodCatch
|
|
@@ -595,10 +595,10 @@ class w {
|
|
|
595
595
|
}));
|
|
596
596
|
}
|
|
597
597
|
pipe(e) {
|
|
598
|
-
return
|
|
598
|
+
return Ge.create(this, e);
|
|
599
599
|
}
|
|
600
600
|
readonly() {
|
|
601
|
-
return
|
|
601
|
+
return He.create(this);
|
|
602
602
|
}
|
|
603
603
|
isOptional() {
|
|
604
604
|
return this.safeParse(void 0).success;
|
|
@@ -607,8 +607,8 @@ class w {
|
|
|
607
607
|
return this.safeParse(null).success;
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
const bn = /^c[^\s-]{8,}$/i, wn = /^[0-9a-z]+$/, xn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, kn = /^[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, Tn = /^[a-z0-9_-]{21}$/i, Sn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,
|
|
611
|
-
let
|
|
610
|
+
const bn = /^c[^\s-]{8,}$/i, wn = /^[0-9a-z]+$/, xn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, kn = /^[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, Tn = /^[a-z0-9_-]{21}$/i, Sn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, En = /^[-+]?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)?)??$/, An = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, On = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
611
|
+
let ut;
|
|
612
612
|
const Cn = /^(?:(?: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])$/, In = /^(?:(?: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])$/, Nn = /^(([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]))$/, jn = /^(([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])$/, Rn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Zn = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Jt = "((\\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])))", Mn = new RegExp(`^${Jt}$`);
|
|
613
613
|
function Gt(n) {
|
|
614
614
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
@@ -687,13 +687,13 @@ class H extends w {
|
|
|
687
687
|
message: a.message
|
|
688
688
|
}), s.dirty());
|
|
689
689
|
} else if (a.kind === "email")
|
|
690
|
-
|
|
690
|
+
An.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
691
691
|
validation: "email",
|
|
692
692
|
code: l.invalid_string,
|
|
693
693
|
message: a.message
|
|
694
694
|
}), s.dirty());
|
|
695
695
|
else if (a.kind === "emoji")
|
|
696
|
-
|
|
696
|
+
ut || (ut = new RegExp(On, "u")), ut.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
697
697
|
validation: "emoji",
|
|
698
698
|
code: l.invalid_string,
|
|
699
699
|
message: a.message
|
|
@@ -766,7 +766,7 @@ class H extends w {
|
|
|
766
766
|
code: l.invalid_string,
|
|
767
767
|
validation: "time",
|
|
768
768
|
message: a.message
|
|
769
|
-
}), s.dirty()) : a.kind === "duration" ?
|
|
769
|
+
}), s.dirty()) : a.kind === "duration" ? En.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
770
770
|
validation: "duration",
|
|
771
771
|
code: l.invalid_string,
|
|
772
772
|
message: a.message
|
|
@@ -1315,7 +1315,7 @@ le.create = (n) => {
|
|
|
1315
1315
|
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1
|
|
1316
1316
|
}, b(n)));
|
|
1317
1317
|
};
|
|
1318
|
-
class
|
|
1318
|
+
class $e extends w {
|
|
1319
1319
|
_parse(e) {
|
|
1320
1320
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
|
|
1321
1321
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1328,7 +1328,7 @@ class Me extends w {
|
|
|
1328
1328
|
return $(e.data);
|
|
1329
1329
|
}
|
|
1330
1330
|
}
|
|
1331
|
-
|
|
1331
|
+
$e.create = (n) => new $e(u({
|
|
1332
1332
|
typeName: g.ZodBoolean,
|
|
1333
1333
|
coerce: (n == null ? void 0 : n.coerce) || !1
|
|
1334
1334
|
}, b(n)));
|
|
@@ -1408,7 +1408,7 @@ ve.create = (n) => new ve(u({
|
|
|
1408
1408
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1409
1409
|
typeName: g.ZodDate
|
|
1410
1410
|
}, b(n)));
|
|
1411
|
-
class
|
|
1411
|
+
class nt extends w {
|
|
1412
1412
|
_parse(e) {
|
|
1413
1413
|
if (this._getType(e) !== p.symbol) {
|
|
1414
1414
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1421,10 +1421,10 @@ class tt extends w {
|
|
|
1421
1421
|
return $(e.data);
|
|
1422
1422
|
}
|
|
1423
1423
|
}
|
|
1424
|
-
|
|
1424
|
+
nt.create = (n) => new nt(u({
|
|
1425
1425
|
typeName: g.ZodSymbol
|
|
1426
1426
|
}, b(n)));
|
|
1427
|
-
class
|
|
1427
|
+
class Pe extends w {
|
|
1428
1428
|
_parse(e) {
|
|
1429
1429
|
if (this._getType(e) !== p.undefined) {
|
|
1430
1430
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1437,10 +1437,10 @@ class $e extends w {
|
|
|
1437
1437
|
return $(e.data);
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
|
-
|
|
1440
|
+
Pe.create = (n) => new Pe(u({
|
|
1441
1441
|
typeName: g.ZodUndefined
|
|
1442
1442
|
}, b(n)));
|
|
1443
|
-
class
|
|
1443
|
+
class Fe extends w {
|
|
1444
1444
|
_parse(e) {
|
|
1445
1445
|
if (this._getType(e) !== p.null) {
|
|
1446
1446
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1453,10 +1453,10 @@ class Pe extends w {
|
|
|
1453
1453
|
return $(e.data);
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
|
-
|
|
1456
|
+
Fe.create = (n) => new Fe(u({
|
|
1457
1457
|
typeName: g.ZodNull
|
|
1458
1458
|
}, b(n)));
|
|
1459
|
-
class
|
|
1459
|
+
class Se extends w {
|
|
1460
1460
|
constructor() {
|
|
1461
1461
|
super(...arguments), this._any = !0;
|
|
1462
1462
|
}
|
|
@@ -1464,7 +1464,7 @@ class Te extends w {
|
|
|
1464
1464
|
return $(e.data);
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
|
-
|
|
1467
|
+
Se.create = (n) => new Se(u({
|
|
1468
1468
|
typeName: g.ZodAny
|
|
1469
1469
|
}, b(n)));
|
|
1470
1470
|
class ye extends w {
|
|
@@ -1478,7 +1478,7 @@ class ye extends w {
|
|
|
1478
1478
|
ye.create = (n) => new ye(u({
|
|
1479
1479
|
typeName: g.ZodUnknown
|
|
1480
1480
|
}, b(n)));
|
|
1481
|
-
class
|
|
1481
|
+
class oe extends w {
|
|
1482
1482
|
_parse(e) {
|
|
1483
1483
|
const t = this._getOrReturnCtx(e);
|
|
1484
1484
|
return h(t, {
|
|
@@ -1488,10 +1488,10 @@ class ce extends w {
|
|
|
1488
1488
|
}), v;
|
|
1489
1489
|
}
|
|
1490
1490
|
}
|
|
1491
|
-
|
|
1491
|
+
oe.create = (n) => new oe(u({
|
|
1492
1492
|
typeName: g.ZodNever
|
|
1493
1493
|
}, b(n)));
|
|
1494
|
-
class
|
|
1494
|
+
class st extends w {
|
|
1495
1495
|
_parse(e) {
|
|
1496
1496
|
if (this._getType(e) !== p.undefined) {
|
|
1497
1497
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1504,7 +1504,7 @@ class nt extends w {
|
|
|
1504
1504
|
return $(e.data);
|
|
1505
1505
|
}
|
|
1506
1506
|
}
|
|
1507
|
-
|
|
1507
|
+
st.create = (n) => new st(u({
|
|
1508
1508
|
typeName: g.ZodVoid
|
|
1509
1509
|
}, b(n)));
|
|
1510
1510
|
class J extends w {
|
|
@@ -1543,8 +1543,8 @@ class J extends w {
|
|
|
1543
1543
|
exact: !1,
|
|
1544
1544
|
message: r.maxLength.message
|
|
1545
1545
|
}), s.dirty()), t.common.async)
|
|
1546
|
-
return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new
|
|
1547
|
-
const a = [...t.data].map((i, o) => r.type._parseSync(new
|
|
1546
|
+
return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new te(t, i, t.path, o)))).then((i) => R.mergeArray(s, i));
|
|
1547
|
+
const a = [...t.data].map((i, o) => r.type._parseSync(new te(t, i, t.path, o)));
|
|
1548
1548
|
return R.mergeArray(s, a);
|
|
1549
1549
|
}
|
|
1550
1550
|
get element() {
|
|
@@ -1576,19 +1576,19 @@ J.create = (n, e) => new J(u({
|
|
|
1576
1576
|
exactLength: null,
|
|
1577
1577
|
typeName: g.ZodArray
|
|
1578
1578
|
}, b(e)));
|
|
1579
|
-
function
|
|
1579
|
+
function we(n) {
|
|
1580
1580
|
if (n instanceof S) {
|
|
1581
1581
|
const e = {};
|
|
1582
1582
|
for (const t in n.shape) {
|
|
1583
1583
|
const s = n.shape[t];
|
|
1584
|
-
e[t] =
|
|
1584
|
+
e[t] = ee.create(we(s));
|
|
1585
1585
|
}
|
|
1586
1586
|
return new S(y(u({}, n._def), {
|
|
1587
1587
|
shape: () => e
|
|
1588
1588
|
}));
|
|
1589
1589
|
} else return n instanceof J ? new J(y(u({}, n._def), {
|
|
1590
|
-
type:
|
|
1591
|
-
})) : n instanceof
|
|
1590
|
+
type: we(n.element)
|
|
1591
|
+
})) : n instanceof ee ? ee.create(we(n.unwrap())) : n instanceof he ? he.create(we(n.unwrap())) : n instanceof ne ? ne.create(n.items.map((e) => we(e))) : n;
|
|
1592
1592
|
}
|
|
1593
1593
|
class S extends w {
|
|
1594
1594
|
constructor() {
|
|
@@ -1610,7 +1610,7 @@ class S extends w {
|
|
|
1610
1610
|
}), v;
|
|
1611
1611
|
}
|
|
1612
1612
|
const { status: s, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1613
|
-
if (!(this._def.catchall instanceof
|
|
1613
|
+
if (!(this._def.catchall instanceof oe && this._def.unknownKeys === "strip"))
|
|
1614
1614
|
for (const d in r.data)
|
|
1615
1615
|
i.includes(d) || o.push(d);
|
|
1616
1616
|
const c = [];
|
|
@@ -1618,11 +1618,11 @@ class S extends w {
|
|
|
1618
1618
|
const f = a[d], _ = r.data[d];
|
|
1619
1619
|
c.push({
|
|
1620
1620
|
key: { status: "valid", value: d },
|
|
1621
|
-
value: f._parse(new
|
|
1621
|
+
value: f._parse(new te(r, _, r.path, d)),
|
|
1622
1622
|
alwaysSet: d in r.data
|
|
1623
1623
|
});
|
|
1624
1624
|
}
|
|
1625
|
-
if (this._def.catchall instanceof
|
|
1625
|
+
if (this._def.catchall instanceof oe) {
|
|
1626
1626
|
const d = this._def.unknownKeys;
|
|
1627
1627
|
if (d === "passthrough")
|
|
1628
1628
|
for (const f of o)
|
|
@@ -1643,20 +1643,20 @@ class S extends w {
|
|
|
1643
1643
|
c.push({
|
|
1644
1644
|
key: { status: "valid", value: f },
|
|
1645
1645
|
value: d._parse(
|
|
1646
|
-
new
|
|
1646
|
+
new te(r, _, r.path, f)
|
|
1647
1647
|
//, ctx.child(key), value, getParsedType(value)
|
|
1648
1648
|
),
|
|
1649
1649
|
alwaysSet: f in r.data
|
|
1650
1650
|
});
|
|
1651
1651
|
}
|
|
1652
1652
|
}
|
|
1653
|
-
return r.common.async ? Promise.resolve().then(() =>
|
|
1653
|
+
return r.common.async ? Promise.resolve().then(() => F(this, null, function* () {
|
|
1654
1654
|
const d = [];
|
|
1655
1655
|
for (const f of c) {
|
|
1656
|
-
const _ = yield f.key,
|
|
1656
|
+
const _ = yield f.key, N = yield f.value;
|
|
1657
1657
|
d.push({
|
|
1658
1658
|
key: _,
|
|
1659
|
-
value:
|
|
1659
|
+
value: N,
|
|
1660
1660
|
alwaysSet: f.alwaysSet
|
|
1661
1661
|
});
|
|
1662
1662
|
}
|
|
@@ -1810,7 +1810,7 @@ class S extends w {
|
|
|
1810
1810
|
* @deprecated
|
|
1811
1811
|
*/
|
|
1812
1812
|
deepPartial() {
|
|
1813
|
-
return
|
|
1813
|
+
return we(this);
|
|
1814
1814
|
}
|
|
1815
1815
|
partial(e) {
|
|
1816
1816
|
const t = {};
|
|
@@ -1828,7 +1828,7 @@ class S extends w {
|
|
|
1828
1828
|
t[s] = this.shape[s];
|
|
1829
1829
|
else {
|
|
1830
1830
|
let a = this.shape[s];
|
|
1831
|
-
for (; a instanceof
|
|
1831
|
+
for (; a instanceof ee; )
|
|
1832
1832
|
a = a._def.innerType;
|
|
1833
1833
|
t[s] = a;
|
|
1834
1834
|
}
|
|
@@ -1843,22 +1843,22 @@ class S extends w {
|
|
|
1843
1843
|
S.create = (n, e) => new S(u({
|
|
1844
1844
|
shape: () => n,
|
|
1845
1845
|
unknownKeys: "strip",
|
|
1846
|
-
catchall:
|
|
1846
|
+
catchall: oe.create(),
|
|
1847
1847
|
typeName: g.ZodObject
|
|
1848
1848
|
}, b(e)));
|
|
1849
1849
|
S.strictCreate = (n, e) => new S(u({
|
|
1850
1850
|
shape: () => n,
|
|
1851
1851
|
unknownKeys: "strict",
|
|
1852
|
-
catchall:
|
|
1852
|
+
catchall: oe.create(),
|
|
1853
1853
|
typeName: g.ZodObject
|
|
1854
1854
|
}, b(e)));
|
|
1855
1855
|
S.lazycreate = (n, e) => new S(u({
|
|
1856
1856
|
shape: n,
|
|
1857
1857
|
unknownKeys: "strip",
|
|
1858
|
-
catchall:
|
|
1858
|
+
catchall: oe.create(),
|
|
1859
1859
|
typeName: g.ZodObject
|
|
1860
1860
|
}, b(e)));
|
|
1861
|
-
class
|
|
1861
|
+
class Le extends w {
|
|
1862
1862
|
_parse(e) {
|
|
1863
1863
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
1864
1864
|
function r(a) {
|
|
@@ -1875,7 +1875,7 @@ class Fe extends w {
|
|
|
1875
1875
|
}), v;
|
|
1876
1876
|
}
|
|
1877
1877
|
if (t.common.async)
|
|
1878
|
-
return Promise.all(s.map((a) =>
|
|
1878
|
+
return Promise.all(s.map((a) => F(this, null, function* () {
|
|
1879
1879
|
const i = y(u({}, t), {
|
|
1880
1880
|
common: y(u({}, t.common), {
|
|
1881
1881
|
issues: []
|
|
@@ -1922,12 +1922,12 @@ class Fe extends w {
|
|
|
1922
1922
|
return this._def.options;
|
|
1923
1923
|
}
|
|
1924
1924
|
}
|
|
1925
|
-
|
|
1925
|
+
Le.create = (n, e) => new Le(u({
|
|
1926
1926
|
options: n,
|
|
1927
1927
|
typeName: g.ZodUnion
|
|
1928
1928
|
}, b(e)));
|
|
1929
|
-
const
|
|
1930
|
-
class
|
|
1929
|
+
const ae = (n) => n instanceof Ue ? ae(n.schema) : n instanceof G ? ae(n.innerType()) : n instanceof ze ? [n.value] : n instanceof fe ? n.options : n instanceof We ? x.objectValues(n.enum) : n instanceof Be ? ae(n._def.innerType) : n instanceof Pe ? [void 0] : n instanceof Fe ? [null] : n instanceof ee ? [void 0, ...ae(n.unwrap())] : n instanceof he ? [null, ...ae(n.unwrap())] : n instanceof Et || n instanceof He ? ae(n.unwrap()) : n instanceof qe ? ae(n._def.innerType) : [];
|
|
1930
|
+
class it extends w {
|
|
1931
1931
|
_parse(e) {
|
|
1932
1932
|
const { ctx: t } = this._processInputParams(e);
|
|
1933
1933
|
if (t.parsedType !== p.object)
|
|
@@ -1971,7 +1971,7 @@ class at extends w {
|
|
|
1971
1971
|
static create(e, t, s) {
|
|
1972
1972
|
const r = /* @__PURE__ */ new Map();
|
|
1973
1973
|
for (const a of t) {
|
|
1974
|
-
const i =
|
|
1974
|
+
const i = ae(a.shape[e]);
|
|
1975
1975
|
if (!i.length)
|
|
1976
1976
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1977
1977
|
for (const o of i) {
|
|
@@ -1980,7 +1980,7 @@ class at extends w {
|
|
|
1980
1980
|
r.set(o, a);
|
|
1981
1981
|
}
|
|
1982
1982
|
}
|
|
1983
|
-
return new
|
|
1983
|
+
return new it(u({
|
|
1984
1984
|
typeName: g.ZodDiscriminatedUnion,
|
|
1985
1985
|
discriminator: e,
|
|
1986
1986
|
options: t,
|
|
@@ -1988,14 +1988,14 @@ class at extends w {
|
|
|
1988
1988
|
}, b(s)));
|
|
1989
1989
|
}
|
|
1990
1990
|
}
|
|
1991
|
-
function
|
|
1992
|
-
const t =
|
|
1991
|
+
function yt(n, e) {
|
|
1992
|
+
const t = ie(n), s = ie(e);
|
|
1993
1993
|
if (n === e)
|
|
1994
1994
|
return { valid: !0, data: n };
|
|
1995
1995
|
if (t === p.object && s === p.object) {
|
|
1996
1996
|
const r = x.objectKeys(e), a = x.objectKeys(n).filter((o) => r.indexOf(o) !== -1), i = u(u({}, n), e);
|
|
1997
1997
|
for (const o of a) {
|
|
1998
|
-
const c =
|
|
1998
|
+
const c = yt(n[o], e[o]);
|
|
1999
1999
|
if (!c.valid)
|
|
2000
2000
|
return { valid: !1 };
|
|
2001
2001
|
i[o] = c.data;
|
|
@@ -2006,7 +2006,7 @@ function mt(n, e) {
|
|
|
2006
2006
|
return { valid: !1 };
|
|
2007
2007
|
const r = [];
|
|
2008
2008
|
for (let a = 0; a < n.length; a++) {
|
|
2009
|
-
const i = n[a], o = e[a], c =
|
|
2009
|
+
const i = n[a], o = e[a], c = yt(i, o);
|
|
2010
2010
|
if (!c.valid)
|
|
2011
2011
|
return { valid: !1 };
|
|
2012
2012
|
r.push(c.data);
|
|
@@ -2014,13 +2014,13 @@ function mt(n, e) {
|
|
|
2014
2014
|
return { valid: !0, data: r };
|
|
2015
2015
|
} else return t === p.date && s === p.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
|
|
2016
2016
|
}
|
|
2017
|
-
class
|
|
2017
|
+
class De extends w {
|
|
2018
2018
|
_parse(e) {
|
|
2019
2019
|
const { status: t, ctx: s } = this._processInputParams(e), r = (a, i) => {
|
|
2020
|
-
if (
|
|
2020
|
+
if (pt(a) || pt(i))
|
|
2021
2021
|
return v;
|
|
2022
|
-
const o =
|
|
2023
|
-
return o.valid ? ((
|
|
2022
|
+
const o = yt(a.value, i.value);
|
|
2023
|
+
return o.valid ? ((mt(a) || mt(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
|
|
2024
2024
|
code: l.invalid_intersection_types
|
|
2025
2025
|
}), v);
|
|
2026
2026
|
};
|
|
@@ -2046,12 +2046,12 @@ class Le extends w {
|
|
|
2046
2046
|
}));
|
|
2047
2047
|
}
|
|
2048
2048
|
}
|
|
2049
|
-
|
|
2049
|
+
De.create = (n, e, t) => new De(u({
|
|
2050
2050
|
left: n,
|
|
2051
2051
|
right: e,
|
|
2052
2052
|
typeName: g.ZodIntersection
|
|
2053
2053
|
}, b(t)));
|
|
2054
|
-
class
|
|
2054
|
+
class ne extends w {
|
|
2055
2055
|
_parse(e) {
|
|
2056
2056
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2057
2057
|
if (s.parsedType !== p.array)
|
|
@@ -2077,7 +2077,7 @@ class se extends w {
|
|
|
2077
2077
|
}), t.dirty());
|
|
2078
2078
|
const a = [...s.data].map((i, o) => {
|
|
2079
2079
|
const c = this._def.items[o] || this._def.rest;
|
|
2080
|
-
return c ? c._parse(new
|
|
2080
|
+
return c ? c._parse(new te(s, i, s.path, o)) : null;
|
|
2081
2081
|
}).filter((i) => !!i);
|
|
2082
2082
|
return s.common.async ? Promise.all(a).then((i) => R.mergeArray(t, i)) : R.mergeArray(t, a);
|
|
2083
2083
|
}
|
|
@@ -2085,21 +2085,21 @@ class se extends w {
|
|
|
2085
2085
|
return this._def.items;
|
|
2086
2086
|
}
|
|
2087
2087
|
rest(e) {
|
|
2088
|
-
return new
|
|
2088
|
+
return new ne(y(u({}, this._def), {
|
|
2089
2089
|
rest: e
|
|
2090
2090
|
}));
|
|
2091
2091
|
}
|
|
2092
2092
|
}
|
|
2093
|
-
|
|
2093
|
+
ne.create = (n, e) => {
|
|
2094
2094
|
if (!Array.isArray(n))
|
|
2095
2095
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2096
|
-
return new
|
|
2096
|
+
return new ne(u({
|
|
2097
2097
|
items: n,
|
|
2098
2098
|
typeName: g.ZodTuple,
|
|
2099
2099
|
rest: null
|
|
2100
2100
|
}, b(e)));
|
|
2101
2101
|
};
|
|
2102
|
-
class
|
|
2102
|
+
class Ve extends w {
|
|
2103
2103
|
get keySchema() {
|
|
2104
2104
|
return this._def.keyType;
|
|
2105
2105
|
}
|
|
@@ -2117,8 +2117,8 @@ class De extends w {
|
|
|
2117
2117
|
const r = [], a = this._def.keyType, i = this._def.valueType;
|
|
2118
2118
|
for (const o in s.data)
|
|
2119
2119
|
r.push({
|
|
2120
|
-
key: a._parse(new
|
|
2121
|
-
value: i._parse(new
|
|
2120
|
+
key: a._parse(new te(s, o, s.path, o)),
|
|
2121
|
+
value: i._parse(new te(s, s.data[o], s.path, o)),
|
|
2122
2122
|
alwaysSet: o in s.data
|
|
2123
2123
|
});
|
|
2124
2124
|
return s.common.async ? R.mergeObjectAsync(t, r) : R.mergeObjectSync(t, r);
|
|
@@ -2127,18 +2127,18 @@ class De extends w {
|
|
|
2127
2127
|
return this._def.valueType;
|
|
2128
2128
|
}
|
|
2129
2129
|
static create(e, t, s) {
|
|
2130
|
-
return t instanceof w ? new
|
|
2130
|
+
return t instanceof w ? new Ve(u({
|
|
2131
2131
|
keyType: e,
|
|
2132
2132
|
valueType: t,
|
|
2133
2133
|
typeName: g.ZodRecord
|
|
2134
|
-
}, b(s))) : new
|
|
2134
|
+
}, b(s))) : new Ve(u({
|
|
2135
2135
|
keyType: H.create(),
|
|
2136
2136
|
valueType: e,
|
|
2137
2137
|
typeName: g.ZodRecord
|
|
2138
2138
|
}, b(t)));
|
|
2139
2139
|
}
|
|
2140
2140
|
}
|
|
2141
|
-
class
|
|
2141
|
+
class rt extends w {
|
|
2142
2142
|
get keySchema() {
|
|
2143
2143
|
return this._def.keyType;
|
|
2144
2144
|
}
|
|
@@ -2154,12 +2154,12 @@ class st extends w {
|
|
|
2154
2154
|
received: s.parsedType
|
|
2155
2155
|
}), v;
|
|
2156
2156
|
const r = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], d) => ({
|
|
2157
|
-
key: r._parse(new
|
|
2158
|
-
value: a._parse(new
|
|
2157
|
+
key: r._parse(new te(s, o, s.path, [d, "key"])),
|
|
2158
|
+
value: a._parse(new te(s, c, s.path, [d, "value"]))
|
|
2159
2159
|
}));
|
|
2160
2160
|
if (s.common.async) {
|
|
2161
2161
|
const o = /* @__PURE__ */ new Map();
|
|
2162
|
-
return Promise.resolve().then(() =>
|
|
2162
|
+
return Promise.resolve().then(() => F(this, null, function* () {
|
|
2163
2163
|
for (const c of i) {
|
|
2164
2164
|
const d = yield c.key, f = yield c.value;
|
|
2165
2165
|
if (d.status === "aborted" || f.status === "aborted")
|
|
@@ -2180,7 +2180,7 @@ class st extends w {
|
|
|
2180
2180
|
}
|
|
2181
2181
|
}
|
|
2182
2182
|
}
|
|
2183
|
-
|
|
2183
|
+
rt.create = (n, e, t) => new rt(u({
|
|
2184
2184
|
valueType: e,
|
|
2185
2185
|
keyType: n,
|
|
2186
2186
|
typeName: g.ZodMap
|
|
@@ -2220,7 +2220,7 @@ class _e extends w {
|
|
|
2220
2220
|
}
|
|
2221
2221
|
return { status: t.value, value: d };
|
|
2222
2222
|
}
|
|
2223
|
-
const o = [...s.data.values()].map((c, d) => a._parse(new
|
|
2223
|
+
const o = [...s.data.values()].map((c, d) => a._parse(new te(s, c, s.path, d)));
|
|
2224
2224
|
return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
2225
2225
|
}
|
|
2226
2226
|
min(e, t) {
|
|
@@ -2246,7 +2246,7 @@ _e.create = (n, e) => new _e(u({
|
|
|
2246
2246
|
maxSize: null,
|
|
2247
2247
|
typeName: g.ZodSet
|
|
2248
2248
|
}, b(e)));
|
|
2249
|
-
class
|
|
2249
|
+
class ke extends w {
|
|
2250
2250
|
constructor() {
|
|
2251
2251
|
super(...arguments), this.validate = this.implement;
|
|
2252
2252
|
}
|
|
@@ -2259,14 +2259,14 @@ class xe extends w {
|
|
|
2259
2259
|
received: t.parsedType
|
|
2260
2260
|
}), v;
|
|
2261
2261
|
function s(o, c) {
|
|
2262
|
-
return
|
|
2262
|
+
return et({
|
|
2263
2263
|
data: o,
|
|
2264
2264
|
path: t.path,
|
|
2265
2265
|
errorMaps: [
|
|
2266
2266
|
t.common.contextualErrorMap,
|
|
2267
2267
|
t.schemaErrorMap,
|
|
2268
|
-
|
|
2269
|
-
|
|
2268
|
+
Qe(),
|
|
2269
|
+
Te
|
|
2270
2270
|
].filter((d) => !!d),
|
|
2271
2271
|
issueData: {
|
|
2272
2272
|
code: l.invalid_arguments,
|
|
@@ -2275,14 +2275,14 @@ class xe extends w {
|
|
|
2275
2275
|
});
|
|
2276
2276
|
}
|
|
2277
2277
|
function r(o, c) {
|
|
2278
|
-
return
|
|
2278
|
+
return et({
|
|
2279
2279
|
data: o,
|
|
2280
2280
|
path: t.path,
|
|
2281
2281
|
errorMaps: [
|
|
2282
2282
|
t.common.contextualErrorMap,
|
|
2283
2283
|
t.schemaErrorMap,
|
|
2284
|
-
|
|
2285
|
-
|
|
2284
|
+
Qe(),
|
|
2285
|
+
Te
|
|
2286
2286
|
].filter((d) => !!d),
|
|
2287
2287
|
issueData: {
|
|
2288
2288
|
code: l.invalid_return_type,
|
|
@@ -2291,15 +2291,15 @@ class xe extends w {
|
|
|
2291
2291
|
});
|
|
2292
2292
|
}
|
|
2293
2293
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2294
|
-
if (this._def.returns instanceof
|
|
2294
|
+
if (this._def.returns instanceof Ee) {
|
|
2295
2295
|
const o = this;
|
|
2296
2296
|
return $(function(...c) {
|
|
2297
|
-
return
|
|
2298
|
-
const d = new U([]), f = yield o._def.args.parseAsync(c, a).catch((
|
|
2299
|
-
throw d.addIssue(s(c,
|
|
2297
|
+
return F(this, null, function* () {
|
|
2298
|
+
const d = new U([]), f = yield o._def.args.parseAsync(c, a).catch((A) => {
|
|
2299
|
+
throw d.addIssue(s(c, A)), d;
|
|
2300
2300
|
}), _ = yield Reflect.apply(i, this, f);
|
|
2301
|
-
return yield o._def.returns._def.type.parseAsync(_, a).catch((
|
|
2302
|
-
throw d.addIssue(r(_,
|
|
2301
|
+
return yield o._def.returns._def.type.parseAsync(_, a).catch((A) => {
|
|
2302
|
+
throw d.addIssue(r(_, A)), d;
|
|
2303
2303
|
});
|
|
2304
2304
|
});
|
|
2305
2305
|
});
|
|
@@ -2323,12 +2323,12 @@ class xe extends w {
|
|
|
2323
2323
|
return this._def.returns;
|
|
2324
2324
|
}
|
|
2325
2325
|
args(...e) {
|
|
2326
|
-
return new
|
|
2327
|
-
args:
|
|
2326
|
+
return new ke(y(u({}, this._def), {
|
|
2327
|
+
args: ne.create(e).rest(ye.create())
|
|
2328
2328
|
}));
|
|
2329
2329
|
}
|
|
2330
2330
|
returns(e) {
|
|
2331
|
-
return new
|
|
2331
|
+
return new ke(y(u({}, this._def), {
|
|
2332
2332
|
returns: e
|
|
2333
2333
|
}));
|
|
2334
2334
|
}
|
|
@@ -2339,14 +2339,14 @@ class xe extends w {
|
|
|
2339
2339
|
return this.parse(e);
|
|
2340
2340
|
}
|
|
2341
2341
|
static create(e, t, s) {
|
|
2342
|
-
return new
|
|
2343
|
-
args: e ||
|
|
2342
|
+
return new ke(u({
|
|
2343
|
+
args: e || ne.create([]).rest(ye.create()),
|
|
2344
2344
|
returns: t || ye.create(),
|
|
2345
2345
|
typeName: g.ZodFunction
|
|
2346
2346
|
}, b(s)));
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
|
-
class
|
|
2349
|
+
class Ue extends w {
|
|
2350
2350
|
get schema() {
|
|
2351
2351
|
return this._def.getter();
|
|
2352
2352
|
}
|
|
@@ -2355,11 +2355,11 @@ class Ve extends w {
|
|
|
2355
2355
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2356
2356
|
}
|
|
2357
2357
|
}
|
|
2358
|
-
|
|
2358
|
+
Ue.create = (n, e) => new Ue(u({
|
|
2359
2359
|
getter: n,
|
|
2360
2360
|
typeName: g.ZodLazy
|
|
2361
2361
|
}, b(e)));
|
|
2362
|
-
class
|
|
2362
|
+
class ze extends w {
|
|
2363
2363
|
_parse(e) {
|
|
2364
2364
|
if (e.data !== this._def.value) {
|
|
2365
2365
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2375,7 +2375,7 @@ class Ue extends w {
|
|
|
2375
2375
|
return this._def.value;
|
|
2376
2376
|
}
|
|
2377
2377
|
}
|
|
2378
|
-
|
|
2378
|
+
ze.create = (n, e) => new ze(u({
|
|
2379
2379
|
value: n,
|
|
2380
2380
|
typeName: g.ZodLiteral
|
|
2381
2381
|
}, b(e)));
|
|
@@ -2387,7 +2387,7 @@ function Xt(n, e) {
|
|
|
2387
2387
|
}
|
|
2388
2388
|
class fe extends w {
|
|
2389
2389
|
constructor() {
|
|
2390
|
-
super(...arguments),
|
|
2390
|
+
super(...arguments), Ie.set(this, void 0);
|
|
2391
2391
|
}
|
|
2392
2392
|
_parse(e) {
|
|
2393
2393
|
if (typeof e.data != "string") {
|
|
@@ -2398,7 +2398,7 @@ class fe extends w {
|
|
|
2398
2398
|
code: l.invalid_type
|
|
2399
2399
|
}), v;
|
|
2400
2400
|
}
|
|
2401
|
-
if (
|
|
2401
|
+
if (tt(this, Ie) || Ht(this, Ie, new Set(this._def.values)), !tt(this, Ie).has(e.data)) {
|
|
2402
2402
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2403
2403
|
return h(t, {
|
|
2404
2404
|
received: t.data,
|
|
@@ -2436,11 +2436,11 @@ class fe extends w {
|
|
|
2436
2436
|
return fe.create(this.options.filter((s) => !e.includes(s)), u(u({}, this._def), t));
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
|
-
|
|
2439
|
+
Ie = /* @__PURE__ */ new WeakMap();
|
|
2440
2440
|
fe.create = Xt;
|
|
2441
|
-
class
|
|
2441
|
+
class We extends w {
|
|
2442
2442
|
constructor() {
|
|
2443
|
-
super(...arguments),
|
|
2443
|
+
super(...arguments), Ne.set(this, void 0);
|
|
2444
2444
|
}
|
|
2445
2445
|
_parse(e) {
|
|
2446
2446
|
const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
@@ -2452,7 +2452,7 @@ class ze extends w {
|
|
|
2452
2452
|
code: l.invalid_type
|
|
2453
2453
|
}), v;
|
|
2454
2454
|
}
|
|
2455
|
-
if (
|
|
2455
|
+
if (tt(this, Ne) || Ht(this, Ne, new Set(x.getValidEnumValues(this._def.values))), !tt(this, Ne).has(e.data)) {
|
|
2456
2456
|
const r = x.objectValues(t);
|
|
2457
2457
|
return h(s, {
|
|
2458
2458
|
received: s.data,
|
|
@@ -2466,12 +2466,12 @@ class ze extends w {
|
|
|
2466
2466
|
return this._def.values;
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
|
-
|
|
2470
|
-
|
|
2469
|
+
Ne = /* @__PURE__ */ new WeakMap();
|
|
2470
|
+
We.create = (n, e) => new We(u({
|
|
2471
2471
|
values: n,
|
|
2472
2472
|
typeName: g.ZodNativeEnum
|
|
2473
2473
|
}, b(e)));
|
|
2474
|
-
class
|
|
2474
|
+
class Ee extends w {
|
|
2475
2475
|
unwrap() {
|
|
2476
2476
|
return this._def.type;
|
|
2477
2477
|
}
|
|
@@ -2490,7 +2490,7 @@ class Se extends w {
|
|
|
2490
2490
|
})));
|
|
2491
2491
|
}
|
|
2492
2492
|
}
|
|
2493
|
-
|
|
2493
|
+
Ee.create = (n, e) => new Ee(u({
|
|
2494
2494
|
type: n,
|
|
2495
2495
|
typeName: g.ZodPromise
|
|
2496
2496
|
}, b(e)));
|
|
@@ -2513,7 +2513,7 @@ class G extends w {
|
|
|
2513
2513
|
if (a.addIssue = a.addIssue.bind(a), r.type === "preprocess") {
|
|
2514
2514
|
const i = r.transform(s.data, a);
|
|
2515
2515
|
if (s.common.async)
|
|
2516
|
-
return Promise.resolve(i).then((o) =>
|
|
2516
|
+
return Promise.resolve(i).then((o) => F(this, null, function* () {
|
|
2517
2517
|
if (t.value === "aborted")
|
|
2518
2518
|
return v;
|
|
2519
2519
|
const c = yield this._def.schema._parseAsync({
|
|
@@ -2521,7 +2521,7 @@ class G extends w {
|
|
|
2521
2521
|
path: s.path,
|
|
2522
2522
|
parent: s
|
|
2523
2523
|
});
|
|
2524
|
-
return c.status === "aborted" ? v : c.status === "dirty" || t.value === "dirty" ?
|
|
2524
|
+
return c.status === "aborted" ? v : c.status === "dirty" || t.value === "dirty" ? xe(c.value) : c;
|
|
2525
2525
|
}));
|
|
2526
2526
|
{
|
|
2527
2527
|
if (t.value === "aborted")
|
|
@@ -2531,7 +2531,7 @@ class G extends w {
|
|
|
2531
2531
|
path: s.path,
|
|
2532
2532
|
parent: s
|
|
2533
2533
|
});
|
|
2534
|
-
return o.status === "aborted" ? v : o.status === "dirty" || t.value === "dirty" ?
|
|
2534
|
+
return o.status === "aborted" ? v : o.status === "dirty" || t.value === "dirty" ? xe(o.value) : o;
|
|
2535
2535
|
}
|
|
2536
2536
|
}
|
|
2537
2537
|
if (r.type === "refinement") {
|
|
@@ -2581,7 +2581,7 @@ G.createWithPreprocess = (n, e, t) => new G(u({
|
|
|
2581
2581
|
effect: { type: "preprocess", transform: n },
|
|
2582
2582
|
typeName: g.ZodEffects
|
|
2583
2583
|
}, b(t)));
|
|
2584
|
-
class
|
|
2584
|
+
class ee extends w {
|
|
2585
2585
|
_parse(e) {
|
|
2586
2586
|
return this._getType(e) === p.undefined ? $(void 0) : this._def.innerType._parse(e);
|
|
2587
2587
|
}
|
|
@@ -2589,7 +2589,7 @@ class te extends w {
|
|
|
2589
2589
|
return this._def.innerType;
|
|
2590
2590
|
}
|
|
2591
2591
|
}
|
|
2592
|
-
|
|
2592
|
+
ee.create = (n, e) => new ee(u({
|
|
2593
2593
|
innerType: n,
|
|
2594
2594
|
typeName: g.ZodOptional
|
|
2595
2595
|
}, b(e)));
|
|
@@ -2605,7 +2605,7 @@ he.create = (n, e) => new he(u({
|
|
|
2605
2605
|
innerType: n,
|
|
2606
2606
|
typeName: g.ZodNullable
|
|
2607
2607
|
}, b(e)));
|
|
2608
|
-
class
|
|
2608
|
+
class Be extends w {
|
|
2609
2609
|
_parse(e) {
|
|
2610
2610
|
const { ctx: t } = this._processInputParams(e);
|
|
2611
2611
|
let s = t.data;
|
|
@@ -2619,12 +2619,12 @@ class We extends w {
|
|
|
2619
2619
|
return this._def.innerType;
|
|
2620
2620
|
}
|
|
2621
2621
|
}
|
|
2622
|
-
|
|
2622
|
+
Be.create = (n, e) => new Be(u({
|
|
2623
2623
|
innerType: n,
|
|
2624
2624
|
typeName: g.ZodDefault,
|
|
2625
2625
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
2626
2626
|
}, b(e)));
|
|
2627
|
-
class
|
|
2627
|
+
class qe extends w {
|
|
2628
2628
|
_parse(e) {
|
|
2629
2629
|
const { ctx: t } = this._processInputParams(e), s = y(u({}, t), {
|
|
2630
2630
|
common: y(u({}, t.common), {
|
|
@@ -2635,7 +2635,7 @@ class Be extends w {
|
|
|
2635
2635
|
path: s.path,
|
|
2636
2636
|
parent: u({}, s)
|
|
2637
2637
|
});
|
|
2638
|
-
return
|
|
2638
|
+
return Me(r) ? r.then((a) => ({
|
|
2639
2639
|
status: "valid",
|
|
2640
2640
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2641
2641
|
get error() {
|
|
@@ -2657,12 +2657,12 @@ class Be extends w {
|
|
|
2657
2657
|
return this._def.innerType;
|
|
2658
2658
|
}
|
|
2659
2659
|
}
|
|
2660
|
-
|
|
2660
|
+
qe.create = (n, e) => new qe(u({
|
|
2661
2661
|
innerType: n,
|
|
2662
2662
|
typeName: g.ZodCatch,
|
|
2663
2663
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
2664
2664
|
}, b(e)));
|
|
2665
|
-
class
|
|
2665
|
+
class at extends w {
|
|
2666
2666
|
_parse(e) {
|
|
2667
2667
|
if (this._getType(e) !== p.nan) {
|
|
2668
2668
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2675,11 +2675,11 @@ class rt extends w {
|
|
|
2675
2675
|
return { status: "valid", value: e.data };
|
|
2676
2676
|
}
|
|
2677
2677
|
}
|
|
2678
|
-
|
|
2678
|
+
at.create = (n) => new at(u({
|
|
2679
2679
|
typeName: g.ZodNaN
|
|
2680
2680
|
}, b(n)));
|
|
2681
2681
|
const Vn = Symbol("zod_brand");
|
|
2682
|
-
class
|
|
2682
|
+
class Et extends w {
|
|
2683
2683
|
_parse(e) {
|
|
2684
2684
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
2685
2685
|
return this._def.type._parse({
|
|
@@ -2692,17 +2692,17 @@ class St extends w {
|
|
|
2692
2692
|
return this._def.type;
|
|
2693
2693
|
}
|
|
2694
2694
|
}
|
|
2695
|
-
class
|
|
2695
|
+
class Ge extends w {
|
|
2696
2696
|
_parse(e) {
|
|
2697
2697
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2698
2698
|
if (s.common.async)
|
|
2699
|
-
return
|
|
2699
|
+
return F(this, null, function* () {
|
|
2700
2700
|
const a = yield this._def.in._parseAsync({
|
|
2701
2701
|
data: s.data,
|
|
2702
2702
|
path: s.path,
|
|
2703
2703
|
parent: s
|
|
2704
2704
|
});
|
|
2705
|
-
return a.status === "aborted" ? v : a.status === "dirty" ? (t.dirty(),
|
|
2705
|
+
return a.status === "aborted" ? v : a.status === "dirty" ? (t.dirty(), xe(a.value)) : this._def.out._parseAsync({
|
|
2706
2706
|
data: a.value,
|
|
2707
2707
|
path: s.path,
|
|
2708
2708
|
parent: s
|
|
@@ -2725,34 +2725,34 @@ class Je extends w {
|
|
|
2725
2725
|
}
|
|
2726
2726
|
}
|
|
2727
2727
|
static create(e, t) {
|
|
2728
|
-
return new
|
|
2728
|
+
return new Ge({
|
|
2729
2729
|
in: e,
|
|
2730
2730
|
out: t,
|
|
2731
2731
|
typeName: g.ZodPipeline
|
|
2732
2732
|
});
|
|
2733
2733
|
}
|
|
2734
2734
|
}
|
|
2735
|
-
class
|
|
2735
|
+
class He extends w {
|
|
2736
2736
|
_parse(e) {
|
|
2737
2737
|
const t = this._def.innerType._parse(e), s = (r) => (ge(r) && (r.value = Object.freeze(r.value)), r);
|
|
2738
|
-
return
|
|
2738
|
+
return Me(t) ? t.then((r) => s(r)) : s(t);
|
|
2739
2739
|
}
|
|
2740
2740
|
unwrap() {
|
|
2741
2741
|
return this._def.innerType;
|
|
2742
2742
|
}
|
|
2743
2743
|
}
|
|
2744
|
-
|
|
2744
|
+
He.create = (n, e) => new He(u({
|
|
2745
2745
|
innerType: n,
|
|
2746
2746
|
typeName: g.ZodReadonly
|
|
2747
2747
|
}, b(e)));
|
|
2748
2748
|
function Yt(n, e = {}, t) {
|
|
2749
|
-
return n ?
|
|
2749
|
+
return n ? Se.create().superRefine((s, r) => {
|
|
2750
2750
|
var a, i;
|
|
2751
2751
|
if (!n(s)) {
|
|
2752
2752
|
const o = typeof e == "function" ? e(s) : typeof e == "string" ? { message: e } : e, c = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, d = typeof o == "string" ? { message: o } : o;
|
|
2753
2753
|
r.addIssue(y(u({ code: "custom" }, d), { fatal: c }));
|
|
2754
2754
|
}
|
|
2755
|
-
}) :
|
|
2755
|
+
}) : Se.create();
|
|
2756
2756
|
}
|
|
2757
2757
|
const Un = {
|
|
2758
2758
|
object: S.lazycreate
|
|
@@ -2763,79 +2763,79 @@ var g;
|
|
|
2763
2763
|
})(g || (g = {}));
|
|
2764
2764
|
const zn = (n, e = {
|
|
2765
2765
|
message: `Input not instance of ${n.name}`
|
|
2766
|
-
}) => Yt((t) => t instanceof n, e), Qt = H.create, en = de.create, Wn =
|
|
2766
|
+
}) => Yt((t) => t instanceof n, e), Qt = H.create, en = de.create, Wn = at.create, Bn = le.create, tn = $e.create, qn = ve.create, Hn = nt.create, Jn = Pe.create, Gn = Fe.create, Kn = Se.create, Xn = ye.create, Yn = oe.create, Qn = st.create, es = J.create, ts = S.create, ns = S.strictCreate, ss = Le.create, rs = it.create, as = De.create, is = ne.create, os = Ve.create, cs = rt.create, us = _e.create, ds = ke.create, ls = Ue.create, fs = ze.create, hs = fe.create, ps = We.create, ms = Ee.create, Pt = G.create, ys = ee.create, gs = he.create, vs = G.createWithPreprocess, _s = Ge.create, bs = () => Qt().optional(), ws = () => en().optional(), xs = () => tn().optional(), ks = {
|
|
2767
2767
|
string: (n) => H.create(y(u({}, n), { coerce: !0 })),
|
|
2768
2768
|
number: (n) => de.create(y(u({}, n), { coerce: !0 })),
|
|
2769
|
-
boolean: (n) =>
|
|
2769
|
+
boolean: (n) => $e.create(y(u({}, n), {
|
|
2770
2770
|
coerce: !0
|
|
2771
2771
|
})),
|
|
2772
2772
|
bigint: (n) => le.create(y(u({}, n), { coerce: !0 })),
|
|
2773
2773
|
date: (n) => ve.create(y(u({}, n), { coerce: !0 }))
|
|
2774
2774
|
}, Ts = v;
|
|
2775
|
-
var
|
|
2775
|
+
var I = /* @__PURE__ */ Object.freeze({
|
|
2776
2776
|
__proto__: null,
|
|
2777
|
-
defaultErrorMap:
|
|
2777
|
+
defaultErrorMap: Te,
|
|
2778
2778
|
setErrorMap: vn,
|
|
2779
|
-
getErrorMap:
|
|
2780
|
-
makeIssue:
|
|
2779
|
+
getErrorMap: Qe,
|
|
2780
|
+
makeIssue: et,
|
|
2781
2781
|
EMPTY_PATH: _n,
|
|
2782
2782
|
addIssueToContext: h,
|
|
2783
2783
|
ParseStatus: R,
|
|
2784
2784
|
INVALID: v,
|
|
2785
|
-
DIRTY:
|
|
2785
|
+
DIRTY: xe,
|
|
2786
2786
|
OK: $,
|
|
2787
|
-
isAborted:
|
|
2788
|
-
isDirty:
|
|
2787
|
+
isAborted: pt,
|
|
2788
|
+
isDirty: mt,
|
|
2789
2789
|
isValid: ge,
|
|
2790
|
-
isAsync:
|
|
2790
|
+
isAsync: Me,
|
|
2791
2791
|
get util() {
|
|
2792
2792
|
return x;
|
|
2793
2793
|
},
|
|
2794
2794
|
get objectUtil() {
|
|
2795
|
-
return
|
|
2795
|
+
return ht;
|
|
2796
2796
|
},
|
|
2797
2797
|
ZodParsedType: p,
|
|
2798
|
-
getParsedType:
|
|
2798
|
+
getParsedType: ie,
|
|
2799
2799
|
ZodType: w,
|
|
2800
2800
|
datetimeRegex: Kt,
|
|
2801
2801
|
ZodString: H,
|
|
2802
2802
|
ZodNumber: de,
|
|
2803
2803
|
ZodBigInt: le,
|
|
2804
|
-
ZodBoolean:
|
|
2804
|
+
ZodBoolean: $e,
|
|
2805
2805
|
ZodDate: ve,
|
|
2806
|
-
ZodSymbol:
|
|
2807
|
-
ZodUndefined:
|
|
2808
|
-
ZodNull:
|
|
2809
|
-
ZodAny:
|
|
2806
|
+
ZodSymbol: nt,
|
|
2807
|
+
ZodUndefined: Pe,
|
|
2808
|
+
ZodNull: Fe,
|
|
2809
|
+
ZodAny: Se,
|
|
2810
2810
|
ZodUnknown: ye,
|
|
2811
|
-
ZodNever:
|
|
2812
|
-
ZodVoid:
|
|
2811
|
+
ZodNever: oe,
|
|
2812
|
+
ZodVoid: st,
|
|
2813
2813
|
ZodArray: J,
|
|
2814
2814
|
ZodObject: S,
|
|
2815
|
-
ZodUnion:
|
|
2816
|
-
ZodDiscriminatedUnion:
|
|
2817
|
-
ZodIntersection:
|
|
2818
|
-
ZodTuple:
|
|
2819
|
-
ZodRecord:
|
|
2820
|
-
ZodMap:
|
|
2815
|
+
ZodUnion: Le,
|
|
2816
|
+
ZodDiscriminatedUnion: it,
|
|
2817
|
+
ZodIntersection: De,
|
|
2818
|
+
ZodTuple: ne,
|
|
2819
|
+
ZodRecord: Ve,
|
|
2820
|
+
ZodMap: rt,
|
|
2821
2821
|
ZodSet: _e,
|
|
2822
|
-
ZodFunction:
|
|
2823
|
-
ZodLazy:
|
|
2824
|
-
ZodLiteral:
|
|
2822
|
+
ZodFunction: ke,
|
|
2823
|
+
ZodLazy: Ue,
|
|
2824
|
+
ZodLiteral: ze,
|
|
2825
2825
|
ZodEnum: fe,
|
|
2826
|
-
ZodNativeEnum:
|
|
2827
|
-
ZodPromise:
|
|
2826
|
+
ZodNativeEnum: We,
|
|
2827
|
+
ZodPromise: Ee,
|
|
2828
2828
|
ZodEffects: G,
|
|
2829
2829
|
ZodTransformer: G,
|
|
2830
|
-
ZodOptional:
|
|
2830
|
+
ZodOptional: ee,
|
|
2831
2831
|
ZodNullable: he,
|
|
2832
|
-
ZodDefault:
|
|
2833
|
-
ZodCatch:
|
|
2834
|
-
ZodNaN:
|
|
2832
|
+
ZodDefault: Be,
|
|
2833
|
+
ZodCatch: qe,
|
|
2834
|
+
ZodNaN: at,
|
|
2835
2835
|
BRAND: Vn,
|
|
2836
|
-
ZodBranded:
|
|
2837
|
-
ZodPipeline:
|
|
2838
|
-
ZodReadonly:
|
|
2836
|
+
ZodBranded: Et,
|
|
2837
|
+
ZodPipeline: Ge,
|
|
2838
|
+
ZodReadonly: He,
|
|
2839
2839
|
custom: Yt,
|
|
2840
2840
|
Schema: w,
|
|
2841
2841
|
ZodSchema: w,
|
|
@@ -2888,14 +2888,15 @@ var N = /* @__PURE__ */ Object.freeze({
|
|
|
2888
2888
|
quotelessJson: gn,
|
|
2889
2889
|
ZodError: U
|
|
2890
2890
|
});
|
|
2891
|
-
const Ss =
|
|
2892
|
-
language:
|
|
2891
|
+
const Ss = I.object({
|
|
2892
|
+
language: I.enum(["typescript", "javascript"]).optional(),
|
|
2893
|
+
disableMarkedForExport: I.boolean().optional()
|
|
2893
2894
|
}).and(
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
framework:
|
|
2897
|
-
model:
|
|
2898
|
-
styling:
|
|
2895
|
+
I.union([
|
|
2896
|
+
I.object({
|
|
2897
|
+
framework: I.literal("react"),
|
|
2898
|
+
model: I.string().optional(),
|
|
2899
|
+
styling: I.enum([
|
|
2899
2900
|
"plain_css",
|
|
2900
2901
|
"css_modules",
|
|
2901
2902
|
"styled_components",
|
|
@@ -2904,19 +2905,19 @@ const Ss = N.object({
|
|
|
2904
2905
|
"scss",
|
|
2905
2906
|
"inline_styles"
|
|
2906
2907
|
]),
|
|
2907
|
-
uiLibrary:
|
|
2908
|
-
enableUILibraryTheming:
|
|
2909
|
-
enableCompactStructure:
|
|
2910
|
-
enableAutoSplit:
|
|
2911
|
-
autoSplitThreshold:
|
|
2908
|
+
uiLibrary: I.enum(["mui", "antd", "radix", "shadcn"]).optional(),
|
|
2909
|
+
enableUILibraryTheming: I.boolean().optional(),
|
|
2910
|
+
enableCompactStructure: I.boolean().optional(),
|
|
2911
|
+
enableAutoSplit: I.boolean().optional(),
|
|
2912
|
+
autoSplitThreshold: I.number().optional()
|
|
2912
2913
|
}),
|
|
2913
|
-
|
|
2914
|
-
framework:
|
|
2915
|
-
styling:
|
|
2916
|
-
enableTranslation:
|
|
2914
|
+
I.object({
|
|
2915
|
+
framework: I.literal("html"),
|
|
2916
|
+
styling: I.enum(["plain_css", "inline_styles"]),
|
|
2917
|
+
enableTranslation: I.boolean().optional()
|
|
2917
2918
|
})
|
|
2918
2919
|
])
|
|
2919
|
-
),
|
|
2920
|
+
), Es = (n) => {
|
|
2920
2921
|
const e = Ss.safeParse(n);
|
|
2921
2922
|
if (e.success === !1) {
|
|
2922
2923
|
const t = new Error("Invalid codegen settings");
|
|
@@ -2924,34 +2925,34 @@ const Ss = N.object({
|
|
|
2924
2925
|
}
|
|
2925
2926
|
return e.data;
|
|
2926
2927
|
};
|
|
2927
|
-
var
|
|
2928
|
+
var z, Je;
|
|
2928
2929
|
class Zr {
|
|
2929
2930
|
constructor({
|
|
2930
2931
|
auth: e,
|
|
2931
2932
|
apiBaseAddress: t = "https://public-api.animaapp.com"
|
|
2932
2933
|
} = {}) {
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2934
|
+
ot(this, z);
|
|
2935
|
+
ot(this, Je);
|
|
2936
|
+
ct(this, Je, t), e && (this.auth = e);
|
|
2936
2937
|
}
|
|
2937
2938
|
hasAuth() {
|
|
2938
|
-
return !!
|
|
2939
|
+
return !!K(this, z);
|
|
2939
2940
|
}
|
|
2940
2941
|
set auth(e) {
|
|
2941
|
-
|
|
2942
|
+
ct(this, z, e);
|
|
2942
2943
|
}
|
|
2943
2944
|
get headers() {
|
|
2944
2945
|
const e = {
|
|
2945
2946
|
"Content-Type": "application/json"
|
|
2946
2947
|
};
|
|
2947
|
-
return
|
|
2948
|
+
return K(this, z) && (e.Authorization = `Bearer ${K(this, z).token}`, "teamId" in K(this, z) && (e["X-Team-Id"] = K(this, z).teamId), "userId" in K(this, z) && K(this, z).userId && (e["X-User-Id"] = K(this, z).userId)), e;
|
|
2948
2949
|
}
|
|
2949
2950
|
generateCode(s) {
|
|
2950
|
-
return
|
|
2951
|
-
var f, _,
|
|
2951
|
+
return F(this, arguments, function* (e, t = {}) {
|
|
2952
|
+
var f, _, N, A, O, Z, B, se;
|
|
2952
2953
|
if (this.hasAuth() === !1)
|
|
2953
2954
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
2954
|
-
const r = {}, a =
|
|
2955
|
+
const r = {}, a = Es(e.settings), i = yield fetch(`${K(this, Je)}/v1/codegen`, {
|
|
2955
2956
|
method: "POST",
|
|
2956
2957
|
headers: y(u({}, this.headers), {
|
|
2957
2958
|
Accept: "text/event-stream"
|
|
@@ -2970,24 +2971,25 @@ class Zr {
|
|
|
2970
2971
|
enableUILibraryTheming: a.enableUILibraryTheming,
|
|
2971
2972
|
enableCompactStructure: a.enableCompactStructure,
|
|
2972
2973
|
enableAutoSplit: a.enableAutoSplit,
|
|
2973
|
-
autoSplitThreshold: a.autoSplitThreshold
|
|
2974
|
+
autoSplitThreshold: a.autoSplitThreshold,
|
|
2975
|
+
disableMarkedForExport: a.disableMarkedForExport
|
|
2974
2976
|
})
|
|
2975
2977
|
});
|
|
2976
2978
|
if (!i.ok) {
|
|
2977
|
-
let
|
|
2979
|
+
let q;
|
|
2978
2980
|
try {
|
|
2979
|
-
|
|
2980
|
-
} catch (
|
|
2981
|
-
|
|
2981
|
+
q = (yield i.json()).message || `HTTP error! status: ${i.status}`;
|
|
2982
|
+
} catch (P) {
|
|
2983
|
+
q = `HTTP error! status: ${i.status}`;
|
|
2982
2984
|
}
|
|
2983
|
-
throw new
|
|
2985
|
+
throw new Oe({
|
|
2984
2986
|
name: "HTTP Error",
|
|
2985
|
-
reason:
|
|
2987
|
+
reason: q,
|
|
2986
2988
|
status: i.status
|
|
2987
2989
|
});
|
|
2988
2990
|
}
|
|
2989
2991
|
if (!i.body)
|
|
2990
|
-
throw new
|
|
2992
|
+
throw new Oe({
|
|
2991
2993
|
name: "Stream Error",
|
|
2992
2994
|
reason: "Response body is null",
|
|
2993
2995
|
status: i.status
|
|
@@ -2996,69 +2998,73 @@ class Zr {
|
|
|
2996
2998
|
let d = "";
|
|
2997
2999
|
try {
|
|
2998
3000
|
for (; ; ) {
|
|
2999
|
-
const { done:
|
|
3000
|
-
if (
|
|
3001
|
+
const { done: q, value: P } = yield o.read();
|
|
3002
|
+
if (q)
|
|
3001
3003
|
break;
|
|
3002
|
-
d += c.decode(
|
|
3003
|
-
const
|
|
3004
|
+
d += c.decode(P, { stream: !0 });
|
|
3005
|
+
const ce = d.split(`
|
|
3004
3006
|
`);
|
|
3005
|
-
d =
|
|
3006
|
-
for (const
|
|
3007
|
-
if (!(!
|
|
3008
|
-
let
|
|
3007
|
+
d = ce.pop() || "";
|
|
3008
|
+
for (const be of ce)
|
|
3009
|
+
if (!(!be.trim() || be.startsWith(":")) && be.startsWith("data: ")) {
|
|
3010
|
+
let k;
|
|
3009
3011
|
try {
|
|
3010
|
-
|
|
3011
|
-
} catch (
|
|
3012
|
+
k = JSON.parse(be.slice(6));
|
|
3013
|
+
} catch (C) {
|
|
3012
3014
|
continue;
|
|
3013
3015
|
}
|
|
3014
|
-
switch (
|
|
3016
|
+
switch (k.type) {
|
|
3017
|
+
case "queueing": {
|
|
3018
|
+
typeof t == "function" ? t(k) : (f = t.onQueueing) == null || f.call(t);
|
|
3019
|
+
break;
|
|
3020
|
+
}
|
|
3015
3021
|
case "start": {
|
|
3016
|
-
r.sessionId =
|
|
3022
|
+
r.sessionId = k.sessionId, typeof t == "function" ? t(k) : (_ = t.onStart) == null || _.call(t, { sessionId: k.sessionId });
|
|
3017
3023
|
break;
|
|
3018
3024
|
}
|
|
3019
3025
|
case "pre_codegen": {
|
|
3020
|
-
typeof t == "function" ? t(
|
|
3026
|
+
typeof t == "function" ? t(k) : (N = t.onPreCodegen) == null || N.call(t, { message: k.message });
|
|
3021
3027
|
break;
|
|
3022
3028
|
}
|
|
3023
3029
|
case "assets_uploaded": {
|
|
3024
|
-
typeof t == "function" ? t(
|
|
3030
|
+
typeof t == "function" ? t(k) : (A = t.onAssetsUploaded) == null || A.call(t);
|
|
3025
3031
|
break;
|
|
3026
3032
|
}
|
|
3027
3033
|
case "assets_list": {
|
|
3028
|
-
r.assets =
|
|
3034
|
+
r.assets = k.payload.assets, typeof t == "function" ? t(k) : (O = t.onAssetsList) == null || O.call(t, k.payload);
|
|
3029
3035
|
break;
|
|
3030
3036
|
}
|
|
3031
3037
|
case "figma_metadata": {
|
|
3032
|
-
r.figmaFileName =
|
|
3033
|
-
figmaFileName:
|
|
3034
|
-
figmaSelectedFrameName:
|
|
3038
|
+
r.figmaFileName = k.figmaFileName, r.figmaSelectedFrameName = k.figmaSelectedFrameName, typeof t == "function" ? t(k) : (Z = t.onFigmaMetadata) == null || Z.call(t, {
|
|
3039
|
+
figmaFileName: k.figmaFileName,
|
|
3040
|
+
figmaSelectedFrameName: k.figmaSelectedFrameName
|
|
3035
3041
|
});
|
|
3036
3042
|
break;
|
|
3037
3043
|
}
|
|
3038
3044
|
case "generating_code": {
|
|
3039
|
-
|
|
3040
|
-
status:
|
|
3041
|
-
progress:
|
|
3042
|
-
files:
|
|
3045
|
+
k.payload.status === "success" && (r.files = k.payload.files), typeof t == "function" ? t(k) : (B = t.onGeneratingCode) == null || B.call(t, {
|
|
3046
|
+
status: k.payload.status,
|
|
3047
|
+
progress: k.payload.progress,
|
|
3048
|
+
files: k.payload.files
|
|
3043
3049
|
});
|
|
3044
3050
|
break;
|
|
3045
3051
|
}
|
|
3046
3052
|
case "codegen_completed": {
|
|
3047
|
-
typeof t == "function" ? t(
|
|
3053
|
+
typeof t == "function" ? t(k) : (se = t.onCodegenCompleted) == null || se.call(t);
|
|
3048
3054
|
break;
|
|
3049
3055
|
}
|
|
3050
3056
|
case "error":
|
|
3051
|
-
throw new
|
|
3052
|
-
name:
|
|
3053
|
-
reason:
|
|
3057
|
+
throw new Oe({
|
|
3058
|
+
name: k.payload.errorName,
|
|
3059
|
+
reason: k.payload.reason
|
|
3054
3060
|
});
|
|
3055
3061
|
case "done": {
|
|
3056
3062
|
if (!r.files)
|
|
3057
|
-
throw new
|
|
3063
|
+
throw new Oe({
|
|
3058
3064
|
name: "Invalid response",
|
|
3059
3065
|
reason: "No files found"
|
|
3060
3066
|
});
|
|
3061
|
-
return r.tokenUsage =
|
|
3067
|
+
return r.tokenUsage = k.payload.tokenUsage, r;
|
|
3062
3068
|
}
|
|
3063
3069
|
}
|
|
3064
3070
|
}
|
|
@@ -3066,7 +3072,7 @@ class Zr {
|
|
|
3066
3072
|
} finally {
|
|
3067
3073
|
o.cancel();
|
|
3068
3074
|
}
|
|
3069
|
-
throw new
|
|
3075
|
+
throw new Oe({
|
|
3070
3076
|
name: "Connection",
|
|
3071
3077
|
reason: "Connection closed before the 'done' message",
|
|
3072
3078
|
status: 500
|
|
@@ -3074,7 +3080,7 @@ class Zr {
|
|
|
3074
3080
|
});
|
|
3075
3081
|
}
|
|
3076
3082
|
}
|
|
3077
|
-
|
|
3083
|
+
z = new WeakMap(), Je = new WeakMap();
|
|
3078
3084
|
const Mr = (n) => {
|
|
3079
3085
|
var e;
|
|
3080
3086
|
if (!n)
|
|
@@ -3108,7 +3114,7 @@ const Fr = ({
|
|
|
3108
3114
|
function r(a) {
|
|
3109
3115
|
if (s.has(a) || !n[a])
|
|
3110
3116
|
return;
|
|
3111
|
-
s.add(a), t[a] = n[a],
|
|
3117
|
+
s.add(a), t[a] = n[a], As(n[a].content).forEach((o) => {
|
|
3112
3118
|
try {
|
|
3113
3119
|
const c = Os(a, o);
|
|
3114
3120
|
if (c.startsWith("src/")) {
|
|
@@ -3129,7 +3135,7 @@ const Fr = ({
|
|
|
3129
3135
|
a.startsWith(e) ? r(a) : a.startsWith("src/") || (t[a] = i);
|
|
3130
3136
|
}), t;
|
|
3131
3137
|
};
|
|
3132
|
-
function
|
|
3138
|
+
function As(n) {
|
|
3133
3139
|
const e = /import.*?["']([^"']+)["']/g, t = /export.*from\s+["']([^"']+)["']/g, s = [];
|
|
3134
3140
|
let r;
|
|
3135
3141
|
for (; (r = e.exec(n)) !== null; )
|
|
@@ -3195,7 +3201,7 @@ var Fs = Object.defineProperty, Ls = Object.defineProperties, Ds = Object.getOwn
|
|
|
3195
3201
|
for (var t of Ft(e))
|
|
3196
3202
|
Us.call(e, t) && Dt(n, t, e[t]);
|
|
3197
3203
|
return n;
|
|
3198
|
-
}, At = (n, e) => Ls(n, Ds(e)),
|
|
3204
|
+
}, At = (n, e) => Ls(n, Ds(e)), Ot = (n, e, t) => e.has(n) || on("Cannot " + t), T = (n, e, t) => (Ot(n, e, "read from private field"), t ? t.call(n) : e.get(n)), W = (n, e, t) => e.has(n) ? on("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), j = (n, e, t, s) => (Ot(n, e, "write to private field"), e.set(n, t), t), Q = (n, e, t) => (Ot(n, e, "access private method"), t), E = (n, e, t) => new Promise((s, r) => {
|
|
3199
3205
|
var a = (c) => {
|
|
3200
3206
|
try {
|
|
3201
3207
|
o(t.next(c));
|
|
@@ -3214,55 +3220,55 @@ var Fs = Object.defineProperty, Ls = Object.defineProperties, Ds = Object.getOwn
|
|
|
3214
3220
|
function Bs(n) {
|
|
3215
3221
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
3216
3222
|
}
|
|
3217
|
-
var
|
|
3223
|
+
var gt = { exports: {} }, qs = gt.exports, Vt;
|
|
3218
3224
|
function Hs() {
|
|
3219
3225
|
return Vt || (Vt = 1, function(n, e) {
|
|
3220
3226
|
(function(t, s) {
|
|
3221
3227
|
n.exports = s();
|
|
3222
3228
|
})(qs, function() {
|
|
3223
|
-
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ws, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined",
|
|
3224
|
-
function
|
|
3225
|
-
var It = typeof
|
|
3229
|
+
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ws, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined", N = i && typeof Set.prototype.entries == "function", A = a && typeof Map.prototype.entries == "function", O = N && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), Z = A && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), B = f && typeof Array.prototype[Symbol.iterator] == "function", se = B && Object.getPrototypeOf([][Symbol.iterator]()), q = f && typeof String.prototype[Symbol.iterator] == "function", P = q && Object.getPrototypeOf(""[Symbol.iterator]()), ce = 8, be = -1;
|
|
3230
|
+
function k(C) {
|
|
3231
|
+
var It = typeof C;
|
|
3226
3232
|
if (It !== "object")
|
|
3227
3233
|
return It;
|
|
3228
|
-
if (
|
|
3234
|
+
if (C === null)
|
|
3229
3235
|
return "null";
|
|
3230
|
-
if (
|
|
3236
|
+
if (C === s)
|
|
3231
3237
|
return "global";
|
|
3232
|
-
if (Array.isArray(
|
|
3238
|
+
if (Array.isArray(C) && (_ === !1 || !(Symbol.toStringTag in C)))
|
|
3233
3239
|
return "Array";
|
|
3234
3240
|
if (typeof window == "object" && window !== null) {
|
|
3235
|
-
if (typeof window.location == "object" &&
|
|
3241
|
+
if (typeof window.location == "object" && C === window.location)
|
|
3236
3242
|
return "Location";
|
|
3237
|
-
if (typeof window.document == "object" &&
|
|
3243
|
+
if (typeof window.document == "object" && C === window.document)
|
|
3238
3244
|
return "Document";
|
|
3239
3245
|
if (typeof window.navigator == "object") {
|
|
3240
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
3246
|
+
if (typeof window.navigator.mimeTypes == "object" && C === window.navigator.mimeTypes)
|
|
3241
3247
|
return "MimeTypeArray";
|
|
3242
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
3248
|
+
if (typeof window.navigator.plugins == "object" && C === window.navigator.plugins)
|
|
3243
3249
|
return "PluginArray";
|
|
3244
3250
|
}
|
|
3245
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
3246
|
-
if (
|
|
3251
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && C instanceof window.HTMLElement) {
|
|
3252
|
+
if (C.tagName === "BLOCKQUOTE")
|
|
3247
3253
|
return "HTMLQuoteElement";
|
|
3248
|
-
if (
|
|
3254
|
+
if (C.tagName === "TD")
|
|
3249
3255
|
return "HTMLTableDataCellElement";
|
|
3250
|
-
if (
|
|
3256
|
+
if (C.tagName === "TH")
|
|
3251
3257
|
return "HTMLTableHeaderCellElement";
|
|
3252
3258
|
}
|
|
3253
3259
|
}
|
|
3254
|
-
var Nt = _ &&
|
|
3260
|
+
var Nt = _ && C[Symbol.toStringTag];
|
|
3255
3261
|
if (typeof Nt == "string")
|
|
3256
3262
|
return Nt;
|
|
3257
|
-
var D = Object.getPrototypeOf(
|
|
3258
|
-
return D === RegExp.prototype ? "RegExp" : D === Date.prototype ? "Date" : t && D === Promise.prototype ? "Promise" : i && D === Set.prototype ? "Set" : a && D === Map.prototype ? "Map" : c && D === WeakSet.prototype ? "WeakSet" : o && D === WeakMap.prototype ? "WeakMap" : d && D === DataView.prototype ? "DataView" : a && D === Z ? "Map Iterator" : i && D === O ? "Set Iterator" :
|
|
3263
|
+
var D = Object.getPrototypeOf(C);
|
|
3264
|
+
return D === RegExp.prototype ? "RegExp" : D === Date.prototype ? "Date" : t && D === Promise.prototype ? "Promise" : i && D === Set.prototype ? "Set" : a && D === Map.prototype ? "Map" : c && D === WeakSet.prototype ? "WeakSet" : o && D === WeakMap.prototype ? "WeakMap" : d && D === DataView.prototype ? "DataView" : a && D === Z ? "Map Iterator" : i && D === O ? "Set Iterator" : B && D === se ? "Array Iterator" : q && D === P ? "String Iterator" : D === null ? "Object" : Object.prototype.toString.call(C).slice(ce, be);
|
|
3259
3265
|
}
|
|
3260
|
-
return
|
|
3266
|
+
return k;
|
|
3261
3267
|
});
|
|
3262
|
-
}(
|
|
3268
|
+
}(gt)), gt.exports;
|
|
3263
3269
|
}
|
|
3264
3270
|
var Js = Hs();
|
|
3265
|
-
const Gs = /* @__PURE__ */ Bs(Js),
|
|
3271
|
+
const Gs = /* @__PURE__ */ Bs(Js), Ct = typeof Buffer != "undefined", Ks = Ct && typeof Buffer.from != "undefined", Xs = Ct ? (
|
|
3266
3272
|
/**
|
|
3267
3273
|
* is value is Buffer?
|
|
3268
3274
|
*
|
|
@@ -3293,7 +3299,7 @@ const Gs = /* @__PURE__ */ Bs(Js), Ot = typeof Buffer != "undefined", Ks = Ot &&
|
|
|
3293
3299
|
function(n) {
|
|
3294
3300
|
return Buffer.from(n);
|
|
3295
3301
|
}
|
|
3296
|
-
) :
|
|
3302
|
+
) : Ct ? (
|
|
3297
3303
|
/**
|
|
3298
3304
|
* copy Buffer
|
|
3299
3305
|
*
|
|
@@ -3340,7 +3346,7 @@ function er(n, e, t = null) {
|
|
|
3340
3346
|
return e;
|
|
3341
3347
|
}
|
|
3342
3348
|
}
|
|
3343
|
-
function
|
|
3349
|
+
function vt(n) {
|
|
3344
3350
|
return Qs.has(n);
|
|
3345
3351
|
}
|
|
3346
3352
|
function Ut(n, e, t, s = null) {
|
|
@@ -3359,7 +3365,7 @@ function Ut(n, e, t, s = null) {
|
|
|
3359
3365
|
}
|
|
3360
3366
|
return n;
|
|
3361
3367
|
}
|
|
3362
|
-
const tr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, nr = typeof global != "undefined" && global !== null && global.Object === Object && global, sr = typeof self != "undefined" && self !== null && self.Object === Object && self,
|
|
3368
|
+
const tr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, nr = typeof global != "undefined" && global !== null && global.Object === Object && global, sr = typeof self != "undefined" && self !== null && self.Object === Object && self, dt = tr || nr || sr || Function("return this")();
|
|
3363
3369
|
function rr(n) {
|
|
3364
3370
|
return n.slice(0);
|
|
3365
3371
|
}
|
|
@@ -3384,8 +3390,8 @@ function dr(n) {
|
|
|
3384
3390
|
function lr(n) {
|
|
3385
3391
|
return new String(n);
|
|
3386
3392
|
}
|
|
3387
|
-
function
|
|
3388
|
-
return
|
|
3393
|
+
function re(n, e) {
|
|
3394
|
+
return dt[e].from ? dt[e].from(n) : new dt[e](n);
|
|
3389
3395
|
}
|
|
3390
3396
|
function M(n) {
|
|
3391
3397
|
return n;
|
|
@@ -3414,15 +3420,15 @@ const mr = /* @__PURE__ */ new Map([
|
|
|
3414
3420
|
["String", lr],
|
|
3415
3421
|
// typed arrays
|
|
3416
3422
|
// TODO: pass bound function
|
|
3417
|
-
["Float32Array",
|
|
3418
|
-
["Float64Array",
|
|
3419
|
-
["Int16Array",
|
|
3420
|
-
["Int32Array",
|
|
3421
|
-
["Int8Array",
|
|
3422
|
-
["Uint16Array",
|
|
3423
|
-
["Uint32Array",
|
|
3424
|
-
["Uint8Array",
|
|
3425
|
-
["Uint8ClampedArray",
|
|
3423
|
+
["Float32Array", re],
|
|
3424
|
+
["Float64Array", re],
|
|
3425
|
+
["Int16Array", re],
|
|
3426
|
+
["Int32Array", re],
|
|
3427
|
+
["Int8Array", re],
|
|
3428
|
+
["Uint16Array", re],
|
|
3429
|
+
["Uint32Array", re],
|
|
3430
|
+
["Uint8Array", re],
|
|
3431
|
+
["Uint8ClampedArray", re],
|
|
3426
3432
|
// shallow copy
|
|
3427
3433
|
["Array Iterator", M],
|
|
3428
3434
|
["Map Iterator", M],
|
|
@@ -3461,7 +3467,7 @@ const mr = /* @__PURE__ */ new Map([
|
|
|
3461
3467
|
]);
|
|
3462
3468
|
function yr() {
|
|
3463
3469
|
}
|
|
3464
|
-
function
|
|
3470
|
+
function _t(n, e = null, t = yr) {
|
|
3465
3471
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
3466
3472
|
const s = e || Ae(n), r = mr.get(s);
|
|
3467
3473
|
if (s === "Object") {
|
|
@@ -3471,7 +3477,7 @@ function vt(n, e = null, t = yr) {
|
|
|
3471
3477
|
}
|
|
3472
3478
|
return r ? r(n, s) : n;
|
|
3473
3479
|
}
|
|
3474
|
-
function
|
|
3480
|
+
function Ce(n, e = {}) {
|
|
3475
3481
|
typeof e == "function" && (e = {
|
|
3476
3482
|
customizer: e
|
|
3477
3483
|
});
|
|
@@ -3481,14 +3487,14 @@ function Oe(n, e = {}) {
|
|
|
3481
3487
|
// TODO: max depth
|
|
3482
3488
|
// depth = Infinity,
|
|
3483
3489
|
} = e, s = Ae(n);
|
|
3484
|
-
if (!
|
|
3485
|
-
return
|
|
3486
|
-
const r =
|
|
3487
|
-
return
|
|
3488
|
-
}
|
|
3489
|
-
function
|
|
3490
|
-
const a = Ae(n), i =
|
|
3491
|
-
if (!
|
|
3490
|
+
if (!vt(s))
|
|
3491
|
+
return bt(n, null, null, null);
|
|
3492
|
+
const r = _t(n, s, t), a = new WeakMap([[n, r]]), i = new WeakSet([n]);
|
|
3493
|
+
return bt(n, r, a, i);
|
|
3494
|
+
}
|
|
3495
|
+
function bt(n, e, t, s, r) {
|
|
3496
|
+
const a = Ae(n), i = _t(n, a);
|
|
3497
|
+
if (!vt(a))
|
|
3492
3498
|
return i;
|
|
3493
3499
|
let o;
|
|
3494
3500
|
switch (a) {
|
|
@@ -3509,11 +3515,11 @@ function _t(n, e, t, s, r) {
|
|
|
3509
3515
|
if (s.has(d))
|
|
3510
3516
|
Ut(e, c, t.get(d), a);
|
|
3511
3517
|
else {
|
|
3512
|
-
const f = Ae(d), _ =
|
|
3513
|
-
|
|
3518
|
+
const f = Ae(d), _ = _t(d, f);
|
|
3519
|
+
vt(f) && (t.set(d, _), s.add(d)), Ut(
|
|
3514
3520
|
e,
|
|
3515
3521
|
c,
|
|
3516
|
-
|
|
3522
|
+
bt(
|
|
3517
3523
|
d,
|
|
3518
3524
|
_,
|
|
3519
3525
|
t,
|
|
@@ -3526,32 +3532,32 @@ function _t(n, e, t, s, r) {
|
|
|
3526
3532
|
return e;
|
|
3527
3533
|
}
|
|
3528
3534
|
const gr = (n) => new Promise((e) => setTimeout(e, n));
|
|
3529
|
-
var
|
|
3535
|
+
var Ke, pe, Xe, wt, cn;
|
|
3530
3536
|
class vr {
|
|
3531
3537
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
3532
|
-
|
|
3538
|
+
W(this, wt), W(this, Ke), W(this, pe), W(this, Xe), j(this, Ke, e), j(this, Xe, t), j(this, pe, 0);
|
|
3533
3539
|
}
|
|
3534
3540
|
run() {
|
|
3535
|
-
return
|
|
3541
|
+
return E(this, null, function* () {
|
|
3536
3542
|
try {
|
|
3537
|
-
return yield
|
|
3543
|
+
return yield T(this, Xe).call(this);
|
|
3538
3544
|
} catch (e) {
|
|
3539
|
-
if (j(this, pe,
|
|
3545
|
+
if (j(this, pe, T(this, pe) + 1), T(this, pe) > T(this, Ke))
|
|
3540
3546
|
throw console.error("Max attempts reached"), e;
|
|
3541
|
-
const t =
|
|
3547
|
+
const t = Q(this, wt, cn).call(this);
|
|
3542
3548
|
return yield gr(t), yield this.run();
|
|
3543
3549
|
}
|
|
3544
3550
|
});
|
|
3545
3551
|
}
|
|
3546
3552
|
}
|
|
3547
|
-
|
|
3548
|
-
return
|
|
3553
|
+
Ke = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakSet(), cn = function() {
|
|
3554
|
+
return T(this, pe) * 1e3 * 1.5;
|
|
3549
3555
|
};
|
|
3550
3556
|
function _r() {
|
|
3551
3557
|
return typeof CompressionStream != "undefined";
|
|
3552
3558
|
}
|
|
3553
3559
|
function br(n) {
|
|
3554
|
-
return
|
|
3560
|
+
return E(this, null, function* () {
|
|
3555
3561
|
const e = new Blob([n]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
3556
3562
|
try {
|
|
3557
3563
|
for (var s = zs(e), r, a, i; r = !(a = yield s.next()).done; r = !1) {
|
|
@@ -3572,7 +3578,7 @@ function br(n) {
|
|
|
3572
3578
|
});
|
|
3573
3579
|
}
|
|
3574
3580
|
function wr(n) {
|
|
3575
|
-
return
|
|
3581
|
+
return E(this, null, function* () {
|
|
3576
3582
|
const e = yield new Blob(n).arrayBuffer();
|
|
3577
3583
|
return new Uint8Array(e);
|
|
3578
3584
|
});
|
|
@@ -3610,7 +3616,7 @@ class Wt extends Error {
|
|
|
3610
3616
|
}
|
|
3611
3617
|
}
|
|
3612
3618
|
}
|
|
3613
|
-
class
|
|
3619
|
+
class je extends Error {
|
|
3614
3620
|
constructor(e = {}) {
|
|
3615
3621
|
const { canceled: t = !1 } = e;
|
|
3616
3622
|
super("Abort Error"), this.name = "Abort Error", this.canceled = t;
|
|
@@ -3621,7 +3627,7 @@ class kr extends Error {
|
|
|
3621
3627
|
super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
|
|
3622
3628
|
}
|
|
3623
3629
|
}
|
|
3624
|
-
class
|
|
3630
|
+
class lt extends Error {
|
|
3625
3631
|
constructor(e) {
|
|
3626
3632
|
super(e), this.name = "Request Validation Error";
|
|
3627
3633
|
}
|
|
@@ -3632,14 +3638,14 @@ function un() {
|
|
|
3632
3638
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
3633
3639
|
).join("");
|
|
3634
3640
|
}
|
|
3635
|
-
function
|
|
3641
|
+
function xt() {
|
|
3636
3642
|
return Math.floor(Date.now() / 1e3).toString();
|
|
3637
3643
|
}
|
|
3638
3644
|
const Tr = 5 * 60 * 1e3, Sr = 1 * 1e3;
|
|
3639
|
-
var me,
|
|
3640
|
-
class
|
|
3645
|
+
var me, L, X, kt, Tt, Re;
|
|
3646
|
+
class Er {
|
|
3641
3647
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
3642
|
-
|
|
3648
|
+
W(this, X), W(this, me), W(this, L), this.baseAddress = t, j(this, me, e), j(this, L, {}), this.plugins = [];
|
|
3643
3649
|
}
|
|
3644
3650
|
get headers() {
|
|
3645
3651
|
throw new Error("Missing implementation");
|
|
@@ -3651,54 +3657,54 @@ class Ar {
|
|
|
3651
3657
|
this.plugins = this.plugins.filter((t) => t.name !== e);
|
|
3652
3658
|
}
|
|
3653
3659
|
withOptions(e = {}) {
|
|
3654
|
-
return j(this,
|
|
3660
|
+
return j(this, L, e), this;
|
|
3655
3661
|
}
|
|
3656
3662
|
get(e) {
|
|
3657
|
-
return
|
|
3663
|
+
return E(this, arguments, function* (t, s = {}) {
|
|
3658
3664
|
const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
|
|
3659
3665
|
let o = a != null ? a : this.headers;
|
|
3660
|
-
const c =
|
|
3661
|
-
return j(this,
|
|
3666
|
+
const c = Ce(T(this, L));
|
|
3667
|
+
return j(this, L, {}), c.extraHeaders && (o = V(V({}, o), c.extraHeaders)), c.requestValidation && (o = At(V({}, o), { "X-Request-Nonce": un(), "X-Request-Timestamp": xt() })), c.async ? yield Q(this, X, Tt).call(this, `${i}${t}`, c.async, { headers: o }) : yield Q(this, X, kt).call(this, `${i}${t}`, c, { headers: o });
|
|
3662
3668
|
});
|
|
3663
3669
|
}
|
|
3664
3670
|
post(e, t) {
|
|
3665
|
-
return
|
|
3666
|
-
const i =
|
|
3667
|
-
return j(this,
|
|
3671
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3672
|
+
const i = Ce(T(this, L));
|
|
3673
|
+
return j(this, L, {}), Q(this, X, Re).call(this, s, "POST", r, a, i);
|
|
3668
3674
|
});
|
|
3669
3675
|
}
|
|
3670
3676
|
put(e, t) {
|
|
3671
|
-
return
|
|
3672
|
-
const i =
|
|
3673
|
-
return j(this,
|
|
3677
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3678
|
+
const i = Ce(T(this, L));
|
|
3679
|
+
return j(this, L, {}), Q(this, X, Re).call(this, s, "PUT", r, a, i);
|
|
3674
3680
|
});
|
|
3675
3681
|
}
|
|
3676
3682
|
delete(e, t) {
|
|
3677
|
-
return
|
|
3678
|
-
const i =
|
|
3679
|
-
return j(this,
|
|
3683
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3684
|
+
const i = Ce(T(this, L));
|
|
3685
|
+
return j(this, L, {}), Q(this, X, Re).call(this, s, "DELETE", r, a, i);
|
|
3680
3686
|
});
|
|
3681
3687
|
}
|
|
3682
3688
|
patch(e, t) {
|
|
3683
|
-
return
|
|
3684
|
-
const i =
|
|
3685
|
-
return j(this,
|
|
3689
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3690
|
+
const i = Ce(T(this, L));
|
|
3691
|
+
return j(this, L, {}), Q(this, X, Re).call(this, s, "PATCH", r, a, i);
|
|
3686
3692
|
});
|
|
3687
3693
|
}
|
|
3688
3694
|
}
|
|
3689
|
-
me = /* @__PURE__ */ new WeakMap(),
|
|
3690
|
-
return
|
|
3691
|
-
const s = () =>
|
|
3695
|
+
me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakSet(), kt = function(n, e, t) {
|
|
3696
|
+
return E(this, null, function* () {
|
|
3697
|
+
const s = () => E(this, null, function* () {
|
|
3692
3698
|
var c, d;
|
|
3693
3699
|
try {
|
|
3694
|
-
return yield
|
|
3700
|
+
return yield T(this, me).call(this, n, V(V({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
3695
3701
|
} catch (f) {
|
|
3696
|
-
throw f instanceof Error && f.name === "AbortError" ? new
|
|
3702
|
+
throw f instanceof Error && f.name === "AbortError" ? new je({ canceled: (d = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? d : !1 }) : f;
|
|
3697
3703
|
}
|
|
3698
3704
|
}), { headers: r } = t != null ? t : {}, a = (c, d) => {
|
|
3699
3705
|
var f, _;
|
|
3700
3706
|
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(d)) || ((_ = c == null ? void 0 : c.headersObject) == null ? void 0 : _[d]) || "";
|
|
3701
|
-
}, i = (c) =>
|
|
3707
|
+
}, i = (c) => E(this, null, function* () {
|
|
3702
3708
|
var d;
|
|
3703
3709
|
if (!c.ok) {
|
|
3704
3710
|
const _ = yield c.text().catch();
|
|
@@ -3713,15 +3719,15 @@ me = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3713
3719
|
}
|
|
3714
3720
|
if (e.requestValidation && process.env.UI_TESTS !== !0)
|
|
3715
3721
|
try {
|
|
3716
|
-
const _ = a(c, "x-response-nonce"),
|
|
3717
|
-
if (!_ || _ !==
|
|
3718
|
-
throw new
|
|
3719
|
-
const
|
|
3720
|
-
if (isNaN(
|
|
3721
|
-
throw new
|
|
3722
|
+
const _ = a(c, "x-response-nonce"), N = r == null ? void 0 : r["X-Request-Nonce"];
|
|
3723
|
+
if (!_ || _ !== N)
|
|
3724
|
+
throw new lt("Response nonce mismatch");
|
|
3725
|
+
const A = Number(a(c, "x-response-timestamp")), O = Number(xt()), Z = 60 * 60 * 24;
|
|
3726
|
+
if (isNaN(A) || Math.abs(O - A) > Z)
|
|
3727
|
+
throw new lt("Invalid response timestamp");
|
|
3722
3728
|
} catch (_) {
|
|
3723
|
-
const
|
|
3724
|
-
throw new
|
|
3729
|
+
const N = _ instanceof Error ? _.message : "Request validation failed";
|
|
3730
|
+
throw new lt(N);
|
|
3725
3731
|
}
|
|
3726
3732
|
let f = yield c.text();
|
|
3727
3733
|
try {
|
|
@@ -3740,8 +3746,8 @@ me = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3740
3746
|
const o = yield s();
|
|
3741
3747
|
return yield i(o);
|
|
3742
3748
|
});
|
|
3743
|
-
},
|
|
3744
|
-
return
|
|
3749
|
+
}, Tt = function(n, e, t) {
|
|
3750
|
+
return E(this, null, function* () {
|
|
3745
3751
|
var s, r;
|
|
3746
3752
|
const {
|
|
3747
3753
|
onProgress: a,
|
|
@@ -3751,9 +3757,9 @@ me = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3751
3757
|
} = e, d = `${n}/async`, f = `${n}/async/job`;
|
|
3752
3758
|
let _;
|
|
3753
3759
|
try {
|
|
3754
|
-
_ = yield
|
|
3760
|
+
_ = yield T(this, me).call(this, d, V(V({}, t), i && { signal: i }));
|
|
3755
3761
|
} catch (O) {
|
|
3756
|
-
throw O instanceof Error && O.name === "AbortError" ? new
|
|
3762
|
+
throw O instanceof Error && O.name === "AbortError" ? new je({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : O;
|
|
3757
3763
|
}
|
|
3758
3764
|
if (!_.ok) {
|
|
3759
3765
|
const O = yield _.text().catch();
|
|
@@ -3766,55 +3772,55 @@ me = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3766
3772
|
body: O
|
|
3767
3773
|
});
|
|
3768
3774
|
}
|
|
3769
|
-
const
|
|
3770
|
-
if (!
|
|
3775
|
+
const N = yield _.json(), { job_id: A } = N;
|
|
3776
|
+
if (!A)
|
|
3771
3777
|
throw new Error("Job ID not found in response");
|
|
3772
|
-
return new Promise((O, Z) =>
|
|
3773
|
-
const
|
|
3778
|
+
return new Promise((O, Z) => E(this, null, function* () {
|
|
3779
|
+
const B = setTimeout(() => {
|
|
3774
3780
|
Z(new Error("Job timed out"));
|
|
3775
|
-
}, c),
|
|
3781
|
+
}, c), se = (q = 0) => E(this, null, function* () {
|
|
3776
3782
|
if (i != null && i.aborted) {
|
|
3777
|
-
clearTimeout(
|
|
3778
|
-
Z(new
|
|
3779
|
-
}).catch((
|
|
3780
|
-
Z(new
|
|
3783
|
+
clearTimeout(B), T(this, me).call(this, `${f}/${A}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
3784
|
+
Z(new je({ canceled: !0 }));
|
|
3785
|
+
}).catch((P) => {
|
|
3786
|
+
Z(new je({ canceled: !1 }));
|
|
3781
3787
|
});
|
|
3782
3788
|
return;
|
|
3783
3789
|
}
|
|
3784
3790
|
try {
|
|
3785
|
-
const
|
|
3786
|
-
if (
|
|
3787
|
-
clearTimeout(
|
|
3788
|
-
const
|
|
3789
|
-
O(
|
|
3790
|
-
} else if (
|
|
3791
|
-
clearTimeout(
|
|
3791
|
+
const P = yield (yield T(this, me).call(this, `${f}/${A}`, { headers: this.headers })).json();
|
|
3792
|
+
if (P.status === "success") {
|
|
3793
|
+
clearTimeout(B);
|
|
3794
|
+
const ce = P.response_json;
|
|
3795
|
+
O(ce);
|
|
3796
|
+
} else if (P.status === "failed")
|
|
3797
|
+
clearTimeout(B), Z(new kr(P.response_json));
|
|
3792
3798
|
else {
|
|
3793
|
-
a && a(
|
|
3794
|
-
const
|
|
3795
|
-
setTimeout(() =>
|
|
3799
|
+
a && a(P.response_json);
|
|
3800
|
+
const ce = o(q);
|
|
3801
|
+
setTimeout(() => se(q + 1), ce);
|
|
3796
3802
|
}
|
|
3797
|
-
} catch (
|
|
3798
|
-
Z(
|
|
3803
|
+
} catch (P) {
|
|
3804
|
+
Z(P);
|
|
3799
3805
|
}
|
|
3800
3806
|
});
|
|
3801
|
-
|
|
3807
|
+
se();
|
|
3802
3808
|
}));
|
|
3803
3809
|
});
|
|
3804
|
-
},
|
|
3805
|
-
return
|
|
3810
|
+
}, Re = function(n, e, t, s, r) {
|
|
3811
|
+
return E(this, null, function* () {
|
|
3806
3812
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
3807
3813
|
let c = i != null ? i : this.headers;
|
|
3808
|
-
r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c = At(V({}, c), { "X-Request-Nonce": un(), "X-Request-Timestamp":
|
|
3814
|
+
r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c = At(V({}, c), { "X-Request-Nonce": un(), "X-Request-Timestamp": xt() }));
|
|
3809
3815
|
let d = s.skipBodyJsonStringify ? t : JSON.stringify(t);
|
|
3810
|
-
return r.compress && _r() && (c["Content-Encoding"] = "gzip", d = yield br(d)), r.async ? yield
|
|
3816
|
+
return r.compress && _r() && (c["Content-Encoding"] = "gzip", d = yield br(d)), r.async ? yield Q(this, X, Tt).call(this, `${o}${n}`, r.async, {
|
|
3811
3817
|
method: e,
|
|
3812
3818
|
headers: c,
|
|
3813
3819
|
body: d
|
|
3814
|
-
}) : yield
|
|
3820
|
+
}) : yield Q(this, X, kt).call(this, `${o}${n}`, r, { method: e, headers: c, body: d });
|
|
3815
3821
|
});
|
|
3816
3822
|
};
|
|
3817
|
-
const Bt = (n, e, t, s) => n instanceof
|
|
3823
|
+
const Bt = (n, e, t, s) => n instanceof je ? n : new xr({ resource: e, api: String(t), args: s, cause: n }), ft = (n, e) => new Proxy(e, {
|
|
3818
3824
|
get(t, s) {
|
|
3819
3825
|
return (...r) => {
|
|
3820
3826
|
var a;
|
|
@@ -3835,100 +3841,100 @@ const Bt = (n, e, t, s) => n instanceof Ne ? n : new xr({ resource: e, api: Stri
|
|
|
3835
3841
|
};
|
|
3836
3842
|
}
|
|
3837
3843
|
});
|
|
3838
|
-
var
|
|
3839
|
-
class
|
|
3844
|
+
var Ze;
|
|
3845
|
+
class Ar {
|
|
3840
3846
|
constructor(e) {
|
|
3841
|
-
|
|
3847
|
+
W(this, Ze), this.resourceName = "Files", j(this, Ze, e);
|
|
3842
3848
|
}
|
|
3843
3849
|
get(e) {
|
|
3844
|
-
return
|
|
3850
|
+
return E(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
3845
3851
|
const r = new URLSearchParams(V({
|
|
3846
3852
|
plugin_data: "857346721138427857"
|
|
3847
3853
|
}, s)).toString(), a = `v1/files/${t}?${r}`;
|
|
3848
|
-
return yield
|
|
3854
|
+
return yield T(this, Ze).get(a);
|
|
3849
3855
|
});
|
|
3850
3856
|
}
|
|
3851
3857
|
getImageFills(e) {
|
|
3852
|
-
return
|
|
3858
|
+
return E(this, arguments, function* ({ fileKey: t }) {
|
|
3853
3859
|
var s, r;
|
|
3854
3860
|
const a = `v1/files/${t}/images`;
|
|
3855
|
-
return (r = (s = (yield
|
|
3861
|
+
return (r = (s = (yield T(this, Ze).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
|
|
3856
3862
|
});
|
|
3857
3863
|
}
|
|
3858
3864
|
}
|
|
3859
|
-
|
|
3865
|
+
Ze = /* @__PURE__ */ new WeakMap();
|
|
3860
3866
|
const Or = (n, e, t) => {
|
|
3861
3867
|
const s = e.sort();
|
|
3862
3868
|
return `${n}-${s.join("-")}-${t}`;
|
|
3863
3869
|
}, Cr = (n) => n ? n.ts > Date.now() - 1e3 * 30 : !1;
|
|
3864
|
-
var
|
|
3870
|
+
var Y, St, dn;
|
|
3865
3871
|
class Ir {
|
|
3866
3872
|
constructor(e) {
|
|
3867
|
-
|
|
3873
|
+
W(this, St), W(this, Y), this.resourceName = "Images", j(this, Y, e);
|
|
3868
3874
|
}
|
|
3869
3875
|
/**
|
|
3870
3876
|
* Return the URL for the _layer_ images for the given nodes.
|
|
3871
3877
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
3872
3878
|
*/
|
|
3873
3879
|
get(e) {
|
|
3874
|
-
return
|
|
3875
|
-
const i = Or(t, s, r), o =
|
|
3880
|
+
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, format: r = "jpg", scale: a }) {
|
|
3881
|
+
const i = Or(t, s, r), o = T(this, Y).cache.images.entries.get(i);
|
|
3876
3882
|
if (Cr(o))
|
|
3877
3883
|
return o.result;
|
|
3878
|
-
o &&
|
|
3879
|
-
const c =
|
|
3884
|
+
o && T(this, Y).cache.images.entries.delete(i);
|
|
3885
|
+
const c = T(this, Y).cache.images.pendingRequests.get(i);
|
|
3880
3886
|
if (c)
|
|
3881
3887
|
return c;
|
|
3882
|
-
const d =
|
|
3883
|
-
|
|
3888
|
+
const d = Q(this, St, dn).call(this, i, t, s, r, a);
|
|
3889
|
+
T(this, Y).cache.images.pendingRequests.set(i, d);
|
|
3884
3890
|
try {
|
|
3885
3891
|
return yield d;
|
|
3886
3892
|
} finally {
|
|
3887
|
-
|
|
3893
|
+
T(this, Y).cache.images.pendingRequests.delete(i);
|
|
3888
3894
|
}
|
|
3889
3895
|
});
|
|
3890
3896
|
}
|
|
3891
3897
|
}
|
|
3892
|
-
|
|
3893
|
-
return
|
|
3894
|
-
const a = yield
|
|
3898
|
+
Y = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), dn = function(n, e, t, s, r) {
|
|
3899
|
+
return E(this, null, function* () {
|
|
3900
|
+
const a = yield T(this, Y).get(
|
|
3895
3901
|
`v1/images/${e}?ids=${t}&format=${s}${r ? `&scale=${r}` : ""}`
|
|
3896
3902
|
);
|
|
3897
|
-
return
|
|
3903
|
+
return T(this, Y).cache.images.entries.set(n, {
|
|
3898
3904
|
result: a,
|
|
3899
3905
|
ts: Date.now()
|
|
3900
3906
|
}), a;
|
|
3901
3907
|
});
|
|
3902
3908
|
};
|
|
3903
|
-
var
|
|
3909
|
+
var Ye;
|
|
3904
3910
|
class Nr {
|
|
3905
3911
|
constructor(e) {
|
|
3906
|
-
|
|
3912
|
+
W(this, Ye), this.resourceName = "Nodes", j(this, Ye, e);
|
|
3907
3913
|
}
|
|
3908
3914
|
get(e) {
|
|
3909
|
-
return
|
|
3915
|
+
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, params: r = {} }) {
|
|
3910
3916
|
const a = At(V({}, r), {
|
|
3911
3917
|
ids: s.join(",")
|
|
3912
3918
|
}), i = new URLSearchParams(V({
|
|
3913
3919
|
plugin_data: "857346721138427857"
|
|
3914
3920
|
}, a)).toString(), o = `v1/files/${t}/nodes?${i}`;
|
|
3915
|
-
return yield
|
|
3921
|
+
return yield T(this, Ye).get(o);
|
|
3916
3922
|
});
|
|
3917
3923
|
}
|
|
3918
3924
|
}
|
|
3919
|
-
|
|
3925
|
+
Ye = /* @__PURE__ */ new WeakMap();
|
|
3920
3926
|
var ue;
|
|
3921
|
-
class ln extends
|
|
3927
|
+
class ln extends Er {
|
|
3922
3928
|
constructor({
|
|
3923
3929
|
baseAddress: e = "https://api.figma.com/",
|
|
3924
3930
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
3925
3931
|
} = {}) {
|
|
3926
|
-
super({ fetch: t, baseAddress: e }),
|
|
3932
|
+
super({ fetch: t, baseAddress: e }), W(this, ue, ""), this.cache = {
|
|
3927
3933
|
images: {
|
|
3928
3934
|
entries: /* @__PURE__ */ new Map(),
|
|
3929
3935
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
3930
3936
|
}
|
|
3931
|
-
}, this.files =
|
|
3937
|
+
}, this.files = ft(this, new Ar(this)), this.nodes = ft(this, new Nr(this)), this.images = ft(this, new Ir(this));
|
|
3932
3938
|
}
|
|
3933
3939
|
set token(e) {
|
|
3934
3940
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
@@ -3936,17 +3942,17 @@ class ln extends Ar {
|
|
|
3936
3942
|
j(this, ue, e);
|
|
3937
3943
|
}
|
|
3938
3944
|
get token() {
|
|
3939
|
-
return
|
|
3945
|
+
return T(this, ue);
|
|
3940
3946
|
}
|
|
3941
3947
|
get headers() {
|
|
3942
3948
|
const e = {
|
|
3943
3949
|
"Content-Type": "application/json"
|
|
3944
3950
|
};
|
|
3945
|
-
return
|
|
3951
|
+
return T(this, ue).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = T(this, ue) : T(this, ue).startsWith("figu_") && (e.Authorization = `Bearer ${T(this, ue)}`), e;
|
|
3946
3952
|
}
|
|
3947
3953
|
}
|
|
3948
3954
|
ue = /* @__PURE__ */ new WeakMap();
|
|
3949
|
-
const Vr = (r) =>
|
|
3955
|
+
const Vr = (r) => F(void 0, [r], function* ({
|
|
3950
3956
|
fileKey: n,
|
|
3951
3957
|
authToken: e,
|
|
3952
3958
|
figmaRestApi: t = new ln(),
|
|
@@ -3961,7 +3967,7 @@ const Vr = (r) => P(void 0, [r], function* ({
|
|
|
3961
3967
|
} catch (a) {
|
|
3962
3968
|
throw console.error(a), a;
|
|
3963
3969
|
}
|
|
3964
|
-
}), Ur = (a) =>
|
|
3970
|
+
}), Ur = (a) => F(void 0, [a], function* ({
|
|
3965
3971
|
fileKey: n,
|
|
3966
3972
|
authToken: e,
|
|
3967
3973
|
nodeIds: t,
|
|
@@ -4003,26 +4009,26 @@ const Vr = (r) => P(void 0, [r], function* ({
|
|
|
4003
4009
|
}), t.close();
|
|
4004
4010
|
});
|
|
4005
4011
|
}
|
|
4006
|
-
}), zr = (n, e) =>
|
|
4007
|
-
var c, d, f, _,
|
|
4012
|
+
}), zr = (n, e) => F(void 0, null, function* () {
|
|
4013
|
+
var c, d, f, _, N, A, O;
|
|
4008
4014
|
const t = jr(n, e), [s, r] = t.tee(), a = yield s.getReader().read();
|
|
4009
4015
|
if (a.done || !a.value || ((c = a.value) == null ? void 0 : c.type) === "error" && ((f = (d = a.value) == null ? void 0 : d.payload) != null && f.status))
|
|
4010
4016
|
return new Response(JSON.stringify(a.value), {
|
|
4011
|
-
status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (O = (
|
|
4017
|
+
status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (O = (A = (N = a.value) == null ? void 0 : N.payload) == null ? void 0 : A.status) != null ? O : 500,
|
|
4012
4018
|
headers: {
|
|
4013
4019
|
"Content-Type": "application/json"
|
|
4014
4020
|
}
|
|
4015
4021
|
});
|
|
4016
4022
|
const i = new TextEncoder(), o = r.pipeThrough(
|
|
4017
4023
|
new TransformStream({
|
|
4018
|
-
transform(Z,
|
|
4019
|
-
const
|
|
4024
|
+
transform(Z, B) {
|
|
4025
|
+
const se = `event: ${Z.type}
|
|
4020
4026
|
data: ${JSON.stringify(
|
|
4021
4027
|
Z
|
|
4022
4028
|
)}
|
|
4023
4029
|
|
|
4024
4030
|
`;
|
|
4025
|
-
|
|
4031
|
+
B.enqueue(i.encode(se));
|
|
4026
4032
|
}
|
|
4027
4033
|
})
|
|
4028
4034
|
);
|
|
@@ -4037,7 +4043,7 @@ data: ${JSON.stringify(
|
|
|
4037
4043
|
});
|
|
4038
4044
|
export {
|
|
4039
4045
|
Zr as Anima,
|
|
4040
|
-
|
|
4046
|
+
Oe as CodegenError,
|
|
4041
4047
|
Is as FigmaTokenIssue,
|
|
4042
4048
|
js as NotFound,
|
|
4043
4049
|
Ns as RateLimitExceeded,
|
|
@@ -4056,6 +4062,6 @@ export {
|
|
|
4056
4062
|
Ms as isRateLimitExceeded,
|
|
4057
4063
|
Lr as isUnknownFigmaApiException,
|
|
4058
4064
|
Mr as isValidFigmaUrl,
|
|
4059
|
-
|
|
4065
|
+
Es as validateSettings
|
|
4060
4066
|
};
|
|
4061
4067
|
//# sourceMappingURL=index.js.map
|