@animaapp/anima-sdk 0.2.1 → 0.2.2
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 +5 -5
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +549 -491
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/anima.ts +3 -1
- package/src/dataStream.ts +6 -1
- package/src/settings.ts +4 -2
- package/src/types.ts +35 -34
- package/src/utils/files.ts +95 -0
- package/src/utils/index.ts +2 -0
- /package/src/{utils.ts → utils/figma.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var fn = Object.defineProperty, hn = Object.defineProperties;
|
|
2
2
|
var pn = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var jt = Object.getOwnPropertySymbols;
|
|
4
4
|
var mn = Object.prototype.hasOwnProperty, yn = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var Zt = (n) => {
|
|
6
6
|
throw TypeError(n);
|
|
@@ -8,14 +8,14 @@ var Zt = (n) => {
|
|
|
8
8
|
var Rt = (n, e, t) => e in n ? fn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, d = (n, e) => {
|
|
9
9
|
for (var t in e || (e = {}))
|
|
10
10
|
mn.call(e, t) && Rt(n, t, e[t]);
|
|
11
|
-
if (
|
|
12
|
-
for (var t of
|
|
11
|
+
if (jt)
|
|
12
|
+
for (var t of jt(e))
|
|
13
13
|
yn.call(e, t) && Rt(n, t, e[t]);
|
|
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
17
|
var X = (n, e, t) => (Mt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), it = (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), ot = (n, e, t, s) => (Mt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
|
|
18
|
-
var
|
|
18
|
+
var $ = (n, e, t) => new Promise((s, r) => {
|
|
19
19
|
var a = (c) => {
|
|
20
20
|
try {
|
|
21
21
|
o(t.next(c));
|
|
@@ -253,7 +253,7 @@ const ke = (n, e) => {
|
|
|
253
253
|
return { message: t };
|
|
254
254
|
};
|
|
255
255
|
let qt = ke;
|
|
256
|
-
function
|
|
256
|
+
function vn(n) {
|
|
257
257
|
qt = n;
|
|
258
258
|
}
|
|
259
259
|
function Ye() {
|
|
@@ -276,8 +276,8 @@ const Qe = (n) => {
|
|
|
276
276
|
path: a,
|
|
277
277
|
message: o
|
|
278
278
|
});
|
|
279
|
-
},
|
|
280
|
-
function
|
|
279
|
+
}, _n = [];
|
|
280
|
+
function h(n, e) {
|
|
281
281
|
const t = Ye(), s = Qe({
|
|
282
282
|
issueData: e,
|
|
283
283
|
data: n.data,
|
|
@@ -295,7 +295,7 @@ function f(n, e) {
|
|
|
295
295
|
});
|
|
296
296
|
n.common.issues.push(s);
|
|
297
297
|
}
|
|
298
|
-
class
|
|
298
|
+
class j {
|
|
299
299
|
constructor() {
|
|
300
300
|
this.value = "valid";
|
|
301
301
|
}
|
|
@@ -309,13 +309,13 @@ class I {
|
|
|
309
309
|
const s = [];
|
|
310
310
|
for (const r of t) {
|
|
311
311
|
if (r.status === "aborted")
|
|
312
|
-
return
|
|
312
|
+
return v;
|
|
313
313
|
r.status === "dirty" && e.dirty(), s.push(r.value);
|
|
314
314
|
}
|
|
315
315
|
return { status: e.value, value: s };
|
|
316
316
|
}
|
|
317
317
|
static mergeObjectAsync(e, t) {
|
|
318
|
-
return
|
|
318
|
+
return $(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;
|
|
@@ -324,7 +324,7 @@ class I {
|
|
|
324
324
|
value: i
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
|
-
return
|
|
327
|
+
return j.mergeObjectSync(e, s);
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
static mergeObjectSync(e, t) {
|
|
@@ -332,13 +332,13 @@ class I {
|
|
|
332
332
|
for (const r of t) {
|
|
333
333
|
const { key: a, value: i } = r;
|
|
334
334
|
if (a.status === "aborted" || i.status === "aborted")
|
|
335
|
-
return
|
|
335
|
+
return v;
|
|
336
336
|
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value != "undefined" || r.alwaysSet) && (s[a.value] = i.value);
|
|
337
337
|
}
|
|
338
338
|
return { status: e.value, value: s };
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
-
const
|
|
341
|
+
const v = Object.freeze({
|
|
342
342
|
status: "aborted"
|
|
343
343
|
}), we = (n) => ({ status: "dirty", value: n }), M = (n) => ({ status: "valid", value: n }), ht = (n) => n.status === "aborted", pt = (n) => n.status === "dirty", ge = (n) => n.status === "valid", Ze = (n) => typeof Promise != "undefined" && n instanceof Promise;
|
|
344
344
|
function et(n, e, t, s) {
|
|
@@ -353,7 +353,7 @@ 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 Ce,
|
|
356
|
+
var Ce, Ie;
|
|
357
357
|
class ne {
|
|
358
358
|
constructor(e, t, s, r) {
|
|
359
359
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = r;
|
|
@@ -362,7 +362,7 @@ class ne {
|
|
|
362
362
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
const
|
|
365
|
+
const $t = (n, e) => {
|
|
366
366
|
if (ge(e))
|
|
367
367
|
return { success: !0, data: e.value };
|
|
368
368
|
if (!n.common.issues.length)
|
|
@@ -385,8 +385,8 @@ function b(n) {
|
|
|
385
385
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
386
386
|
return e ? { errorMap: e, description: r } : { errorMap: (i, o) => {
|
|
387
387
|
var c, u;
|
|
388
|
-
const { message:
|
|
389
|
-
return i.code === "invalid_enum_value" ? { message:
|
|
388
|
+
const { message: f } = n;
|
|
389
|
+
return i.code === "invalid_enum_value" ? { message: f != null ? f : o.defaultError } : typeof o.data == "undefined" ? { message: (c = f != null ? f : s) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (u = f != null ? f : t) !== null && u !== void 0 ? u : o.defaultError };
|
|
390
390
|
}, description: r };
|
|
391
391
|
}
|
|
392
392
|
class w {
|
|
@@ -408,7 +408,7 @@ class w {
|
|
|
408
408
|
}
|
|
409
409
|
_processInputParams(e) {
|
|
410
410
|
return {
|
|
411
|
-
status: new
|
|
411
|
+
status: new j(),
|
|
412
412
|
ctx: {
|
|
413
413
|
common: e.parent.common,
|
|
414
414
|
data: e.data,
|
|
@@ -449,7 +449,7 @@ class w {
|
|
|
449
449
|
data: e,
|
|
450
450
|
parsedType: oe(e)
|
|
451
451
|
}, a = this._parseSync({ data: e, path: r.path, parent: r });
|
|
452
|
-
return
|
|
452
|
+
return $t(r, a);
|
|
453
453
|
}
|
|
454
454
|
"~validate"(e) {
|
|
455
455
|
var t, s;
|
|
@@ -485,7 +485,7 @@ class w {
|
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
parseAsync(e, t) {
|
|
488
|
-
return
|
|
488
|
+
return $(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 $(this, null, function* () {
|
|
497
497
|
const s = {
|
|
498
498
|
common: {
|
|
499
499
|
issues: [],
|
|
@@ -506,7 +506,7 @@ class w {
|
|
|
506
506
|
data: e,
|
|
507
507
|
parsedType: oe(e)
|
|
508
508
|
}, r = this._parse({ data: e, path: s.path, parent: s }), a = yield Ze(r) ? r : Promise.resolve(r);
|
|
509
|
-
return
|
|
509
|
+
return $t(s, a);
|
|
510
510
|
});
|
|
511
511
|
}
|
|
512
512
|
refine(e, t) {
|
|
@@ -554,10 +554,10 @@ class w {
|
|
|
554
554
|
return Se.create(this, this._def);
|
|
555
555
|
}
|
|
556
556
|
or(e) {
|
|
557
|
-
return
|
|
557
|
+
return Fe.create([this, e], this._def);
|
|
558
558
|
}
|
|
559
559
|
and(e) {
|
|
560
|
-
return
|
|
560
|
+
return Le.create(this, e, this._def);
|
|
561
561
|
}
|
|
562
562
|
transform(e) {
|
|
563
563
|
return new G(y(d({}, b(this._def)), {
|
|
@@ -568,7 +568,7 @@ class w {
|
|
|
568
568
|
}
|
|
569
569
|
default(e) {
|
|
570
570
|
const t = typeof e == "function" ? e : () => e;
|
|
571
|
-
return new
|
|
571
|
+
return new We(y(d({}, b(this._def)), {
|
|
572
572
|
innerType: this,
|
|
573
573
|
defaultValue: t,
|
|
574
574
|
typeName: g.ZodDefault
|
|
@@ -582,7 +582,7 @@ class w {
|
|
|
582
582
|
}
|
|
583
583
|
catch(e) {
|
|
584
584
|
const t = typeof e == "function" ? e : () => e;
|
|
585
|
-
return new
|
|
585
|
+
return new Be(y(d({}, b(this._def)), {
|
|
586
586
|
innerType: this,
|
|
587
587
|
catchValue: t,
|
|
588
588
|
typeName: g.ZodCatch
|
|
@@ -609,12 +609,12 @@ class w {
|
|
|
609
609
|
}
|
|
610
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
611
|
let ct;
|
|
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])$/,
|
|
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";
|
|
615
615
|
return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function $n(n) {
|
|
618
618
|
return new RegExp(`^${Gt(n)}$`);
|
|
619
619
|
}
|
|
620
620
|
function Kt(n) {
|
|
@@ -622,10 +622,10 @@ function Kt(n) {
|
|
|
622
622
|
const t = [];
|
|
623
623
|
return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
return !!((e === "v4" || !e) && Cn.test(n) || (e === "v6" || !e) &&
|
|
625
|
+
function Pn(n, e) {
|
|
626
|
+
return !!((e === "v4" || !e) && Cn.test(n) || (e === "v6" || !e) && Nn.test(n));
|
|
627
627
|
}
|
|
628
|
-
function
|
|
628
|
+
function Fn(n, e) {
|
|
629
629
|
if (!Sn.test(n))
|
|
630
630
|
return !1;
|
|
631
631
|
try {
|
|
@@ -635,24 +635,24 @@ function Ln(n, e) {
|
|
|
635
635
|
return !1;
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
|
-
function
|
|
639
|
-
return !!((e === "v4" || !e) &&
|
|
638
|
+
function Ln(n, e) {
|
|
639
|
+
return !!((e === "v4" || !e) && In.test(n) || (e === "v6" || !e) && jn.test(n));
|
|
640
640
|
}
|
|
641
641
|
class H extends w {
|
|
642
642
|
_parse(e) {
|
|
643
643
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
|
|
644
644
|
const a = this._getOrReturnCtx(e);
|
|
645
|
-
return
|
|
645
|
+
return h(a, {
|
|
646
646
|
code: l.invalid_type,
|
|
647
647
|
expected: p.string,
|
|
648
648
|
received: a.parsedType
|
|
649
|
-
}),
|
|
649
|
+
}), v;
|
|
650
650
|
}
|
|
651
|
-
const s = new
|
|
651
|
+
const s = new j();
|
|
652
652
|
let r;
|
|
653
653
|
for (const a of this._def.checks)
|
|
654
654
|
if (a.kind === "min")
|
|
655
|
-
e.data.length < a.value && (r = this._getOrReturnCtx(e, r),
|
|
655
|
+
e.data.length < a.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
656
656
|
code: l.too_small,
|
|
657
657
|
minimum: a.value,
|
|
658
658
|
type: "string",
|
|
@@ -661,7 +661,7 @@ class H extends w {
|
|
|
661
661
|
message: a.message
|
|
662
662
|
}), s.dirty());
|
|
663
663
|
else if (a.kind === "max")
|
|
664
|
-
e.data.length > a.value && (r = this._getOrReturnCtx(e, r),
|
|
664
|
+
e.data.length > a.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
665
665
|
code: l.too_big,
|
|
666
666
|
maximum: a.value,
|
|
667
667
|
type: "string",
|
|
@@ -671,14 +671,14 @@ class H extends w {
|
|
|
671
671
|
}), s.dirty());
|
|
672
672
|
else if (a.kind === "length") {
|
|
673
673
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
674
|
-
(i || o) && (r = this._getOrReturnCtx(e, r), i ?
|
|
674
|
+
(i || o) && (r = this._getOrReturnCtx(e, r), i ? h(r, {
|
|
675
675
|
code: l.too_big,
|
|
676
676
|
maximum: a.value,
|
|
677
677
|
type: "string",
|
|
678
678
|
inclusive: !0,
|
|
679
679
|
exact: !0,
|
|
680
680
|
message: a.message
|
|
681
|
-
}) : o &&
|
|
681
|
+
}) : o && h(r, {
|
|
682
682
|
code: l.too_small,
|
|
683
683
|
minimum: a.value,
|
|
684
684
|
type: "string",
|
|
@@ -687,43 +687,43 @@ class H extends w {
|
|
|
687
687
|
message: a.message
|
|
688
688
|
}), s.dirty());
|
|
689
689
|
} else if (a.kind === "email")
|
|
690
|
-
An.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
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
|
-
ct || (ct = new RegExp(On, "u")), ct.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
696
|
+
ct || (ct = new RegExp(On, "u")), ct.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
|
|
700
700
|
}), s.dirty());
|
|
701
701
|
else if (a.kind === "uuid")
|
|
702
|
-
kn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
702
|
+
kn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
703
703
|
validation: "uuid",
|
|
704
704
|
code: l.invalid_string,
|
|
705
705
|
message: a.message
|
|
706
706
|
}), s.dirty());
|
|
707
707
|
else if (a.kind === "nanoid")
|
|
708
|
-
Tn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
708
|
+
Tn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
709
709
|
validation: "nanoid",
|
|
710
710
|
code: l.invalid_string,
|
|
711
711
|
message: a.message
|
|
712
712
|
}), s.dirty());
|
|
713
713
|
else if (a.kind === "cuid")
|
|
714
|
-
bn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
714
|
+
bn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
715
715
|
validation: "cuid",
|
|
716
716
|
code: l.invalid_string,
|
|
717
717
|
message: a.message
|
|
718
718
|
}), s.dirty());
|
|
719
719
|
else if (a.kind === "cuid2")
|
|
720
|
-
wn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
720
|
+
wn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
721
721
|
validation: "cuid2",
|
|
722
722
|
code: l.invalid_string,
|
|
723
723
|
message: a.message
|
|
724
724
|
}), s.dirty());
|
|
725
725
|
else if (a.kind === "ulid")
|
|
726
|
-
xn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
726
|
+
xn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
727
727
|
validation: "ulid",
|
|
728
728
|
code: l.invalid_string,
|
|
729
729
|
message: a.message
|
|
@@ -732,61 +732,61 @@ class H extends w {
|
|
|
732
732
|
try {
|
|
733
733
|
new URL(e.data);
|
|
734
734
|
} catch (i) {
|
|
735
|
-
r = this._getOrReturnCtx(e, r),
|
|
735
|
+
r = this._getOrReturnCtx(e, r), h(r, {
|
|
736
736
|
validation: "url",
|
|
737
737
|
code: l.invalid_string,
|
|
738
738
|
message: a.message
|
|
739
739
|
}), s.dirty();
|
|
740
740
|
}
|
|
741
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
741
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
742
742
|
validation: "regex",
|
|
743
743
|
code: l.invalid_string,
|
|
744
744
|
message: a.message
|
|
745
|
-
}), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (r = this._getOrReturnCtx(e, r),
|
|
745
|
+
}), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
746
746
|
code: l.invalid_string,
|
|
747
747
|
validation: { includes: a.value, position: a.position },
|
|
748
748
|
message: a.message
|
|
749
|
-
}), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (r = this._getOrReturnCtx(e, r),
|
|
749
|
+
}), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
750
750
|
code: l.invalid_string,
|
|
751
751
|
validation: { startsWith: a.value },
|
|
752
752
|
message: a.message
|
|
753
|
-
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (r = this._getOrReturnCtx(e, r),
|
|
753
|
+
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
754
754
|
code: l.invalid_string,
|
|
755
755
|
validation: { endsWith: a.value },
|
|
756
756
|
message: a.message
|
|
757
|
-
}), s.dirty()) : a.kind === "datetime" ? Kt(a).test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
757
|
+
}), s.dirty()) : a.kind === "datetime" ? Kt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
758
758
|
code: l.invalid_string,
|
|
759
759
|
validation: "datetime",
|
|
760
760
|
message: a.message
|
|
761
|
-
}), s.dirty()) : a.kind === "date" ? Mn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
761
|
+
}), s.dirty()) : a.kind === "date" ? Mn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
762
762
|
code: l.invalid_string,
|
|
763
763
|
validation: "date",
|
|
764
764
|
message: a.message
|
|
765
|
-
}), s.dirty()) : a.kind === "time" ?
|
|
765
|
+
}), s.dirty()) : a.kind === "time" ? $n(a).test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
766
766
|
code: l.invalid_string,
|
|
767
767
|
validation: "time",
|
|
768
768
|
message: a.message
|
|
769
|
-
}), s.dirty()) : a.kind === "duration" ? En.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
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
|
|
773
|
-
}), s.dirty()) : a.kind === "ip" ?
|
|
773
|
+
}), s.dirty()) : a.kind === "ip" ? Pn(e.data, a.version) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
774
774
|
validation: "ip",
|
|
775
775
|
code: l.invalid_string,
|
|
776
776
|
message: a.message
|
|
777
|
-
}), s.dirty()) : a.kind === "jwt" ?
|
|
777
|
+
}), s.dirty()) : a.kind === "jwt" ? Fn(e.data, a.alg) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
778
778
|
validation: "jwt",
|
|
779
779
|
code: l.invalid_string,
|
|
780
780
|
message: a.message
|
|
781
|
-
}), s.dirty()) : a.kind === "cidr" ?
|
|
781
|
+
}), s.dirty()) : a.kind === "cidr" ? Ln(e.data, a.version) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
782
782
|
validation: "cidr",
|
|
783
783
|
code: l.invalid_string,
|
|
784
784
|
message: a.message
|
|
785
|
-
}), s.dirty()) : a.kind === "base64" ? Rn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
785
|
+
}), s.dirty()) : a.kind === "base64" ? Rn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
786
786
|
validation: "base64",
|
|
787
787
|
code: l.invalid_string,
|
|
788
788
|
message: a.message
|
|
789
|
-
}), s.dirty()) : a.kind === "base64url" ? Zn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
789
|
+
}), s.dirty()) : a.kind === "base64url" ? Zn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
790
790
|
validation: "base64url",
|
|
791
791
|
code: l.invalid_string,
|
|
792
792
|
message: a.message
|
|
@@ -1009,7 +1009,7 @@ H.create = (n) => {
|
|
|
1009
1009
|
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1
|
|
1010
1010
|
}, b(n)));
|
|
1011
1011
|
};
|
|
1012
|
-
function
|
|
1012
|
+
function Dn(n, e) {
|
|
1013
1013
|
const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, a = parseInt(n.toFixed(r).replace(".", "")), i = parseInt(e.toFixed(r).replace(".", ""));
|
|
1014
1014
|
return a % i / Math.pow(10, r);
|
|
1015
1015
|
}
|
|
@@ -1020,39 +1020,39 @@ class ue extends w {
|
|
|
1020
1020
|
_parse(e) {
|
|
1021
1021
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== p.number) {
|
|
1022
1022
|
const a = this._getOrReturnCtx(e);
|
|
1023
|
-
return
|
|
1023
|
+
return h(a, {
|
|
1024
1024
|
code: l.invalid_type,
|
|
1025
1025
|
expected: p.number,
|
|
1026
1026
|
received: a.parsedType
|
|
1027
|
-
}),
|
|
1027
|
+
}), v;
|
|
1028
1028
|
}
|
|
1029
1029
|
let s;
|
|
1030
|
-
const r = new
|
|
1030
|
+
const r = new j();
|
|
1031
1031
|
for (const a of this._def.checks)
|
|
1032
|
-
a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
1032
|
+
a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1033
1033
|
code: l.invalid_type,
|
|
1034
1034
|
expected: "integer",
|
|
1035
1035
|
received: "float",
|
|
1036
1036
|
message: a.message
|
|
1037
|
-
}), r.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
1037
|
+
}), r.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1038
1038
|
code: l.too_small,
|
|
1039
1039
|
minimum: a.value,
|
|
1040
1040
|
type: "number",
|
|
1041
1041
|
inclusive: a.inclusive,
|
|
1042
1042
|
exact: !1,
|
|
1043
1043
|
message: a.message
|
|
1044
|
-
}), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
1044
|
+
}), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1045
1045
|
code: l.too_big,
|
|
1046
1046
|
maximum: a.value,
|
|
1047
1047
|
type: "number",
|
|
1048
1048
|
inclusive: a.inclusive,
|
|
1049
1049
|
exact: !1,
|
|
1050
1050
|
message: a.message
|
|
1051
|
-
}), r.dirty()) : a.kind === "multipleOf" ?
|
|
1051
|
+
}), r.dirty()) : a.kind === "multipleOf" ? Dn(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1052
1052
|
code: l.not_multiple_of,
|
|
1053
1053
|
multipleOf: a.value,
|
|
1054
1054
|
message: a.message
|
|
1055
|
-
}), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
1055
|
+
}), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1056
1056
|
code: l.not_finite,
|
|
1057
1057
|
message: a.message
|
|
1058
1058
|
}), r.dirty()) : x.assertNever(a);
|
|
@@ -1196,21 +1196,21 @@ class le extends w {
|
|
|
1196
1196
|
if (this._getType(e) !== p.bigint)
|
|
1197
1197
|
return this._getInvalidInput(e);
|
|
1198
1198
|
let s;
|
|
1199
|
-
const r = new
|
|
1199
|
+
const r = new j();
|
|
1200
1200
|
for (const a of this._def.checks)
|
|
1201
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
1201
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1202
1202
|
code: l.too_small,
|
|
1203
1203
|
type: "bigint",
|
|
1204
1204
|
minimum: a.value,
|
|
1205
1205
|
inclusive: a.inclusive,
|
|
1206
1206
|
message: a.message
|
|
1207
|
-
}), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
1207
|
+
}), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1208
1208
|
code: l.too_big,
|
|
1209
1209
|
type: "bigint",
|
|
1210
1210
|
maximum: a.value,
|
|
1211
1211
|
inclusive: a.inclusive,
|
|
1212
1212
|
message: a.message
|
|
1213
|
-
}), r.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s),
|
|
1213
|
+
}), r.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1214
1214
|
code: l.not_multiple_of,
|
|
1215
1215
|
multipleOf: a.value,
|
|
1216
1216
|
message: a.message
|
|
@@ -1219,11 +1219,11 @@ class le extends w {
|
|
|
1219
1219
|
}
|
|
1220
1220
|
_getInvalidInput(e) {
|
|
1221
1221
|
const t = this._getOrReturnCtx(e);
|
|
1222
|
-
return
|
|
1222
|
+
return h(t, {
|
|
1223
1223
|
code: l.invalid_type,
|
|
1224
1224
|
expected: p.bigint,
|
|
1225
1225
|
received: t.parsedType
|
|
1226
|
-
}),
|
|
1226
|
+
}), v;
|
|
1227
1227
|
}
|
|
1228
1228
|
gte(e, t) {
|
|
1229
1229
|
return this.setLimit("min", e, !0, m.toString(t));
|
|
@@ -1319,11 +1319,11 @@ class Me 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);
|
|
1322
|
-
return
|
|
1322
|
+
return h(s, {
|
|
1323
1323
|
code: l.invalid_type,
|
|
1324
1324
|
expected: p.boolean,
|
|
1325
1325
|
received: s.parsedType
|
|
1326
|
-
}),
|
|
1326
|
+
}), v;
|
|
1327
1327
|
}
|
|
1328
1328
|
return M(e.data);
|
|
1329
1329
|
}
|
|
@@ -1332,33 +1332,33 @@ Me.create = (n) => new Me(d({
|
|
|
1332
1332
|
typeName: g.ZodBoolean,
|
|
1333
1333
|
coerce: (n == null ? void 0 : n.coerce) || !1
|
|
1334
1334
|
}, b(n)));
|
|
1335
|
-
class
|
|
1335
|
+
class ve extends w {
|
|
1336
1336
|
_parse(e) {
|
|
1337
1337
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
1338
1338
|
const a = this._getOrReturnCtx(e);
|
|
1339
|
-
return
|
|
1339
|
+
return h(a, {
|
|
1340
1340
|
code: l.invalid_type,
|
|
1341
1341
|
expected: p.date,
|
|
1342
1342
|
received: a.parsedType
|
|
1343
|
-
}),
|
|
1343
|
+
}), v;
|
|
1344
1344
|
}
|
|
1345
1345
|
if (isNaN(e.data.getTime())) {
|
|
1346
1346
|
const a = this._getOrReturnCtx(e);
|
|
1347
|
-
return
|
|
1347
|
+
return h(a, {
|
|
1348
1348
|
code: l.invalid_date
|
|
1349
|
-
}),
|
|
1349
|
+
}), v;
|
|
1350
1350
|
}
|
|
1351
|
-
const s = new
|
|
1351
|
+
const s = new j();
|
|
1352
1352
|
let r;
|
|
1353
1353
|
for (const a of this._def.checks)
|
|
1354
|
-
a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r),
|
|
1354
|
+
a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1355
1355
|
code: l.too_small,
|
|
1356
1356
|
message: a.message,
|
|
1357
1357
|
inclusive: !0,
|
|
1358
1358
|
exact: !1,
|
|
1359
1359
|
minimum: a.value,
|
|
1360
1360
|
type: "date"
|
|
1361
|
-
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (r = this._getOrReturnCtx(e, r),
|
|
1361
|
+
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1362
1362
|
code: l.too_big,
|
|
1363
1363
|
message: a.message,
|
|
1364
1364
|
inclusive: !0,
|
|
@@ -1372,7 +1372,7 @@ class _e extends w {
|
|
|
1372
1372
|
};
|
|
1373
1373
|
}
|
|
1374
1374
|
_addCheck(e) {
|
|
1375
|
-
return new
|
|
1375
|
+
return new ve(y(d({}, this._def), {
|
|
1376
1376
|
checks: [...this._def.checks, e]
|
|
1377
1377
|
}));
|
|
1378
1378
|
}
|
|
@@ -1403,7 +1403,7 @@ class _e extends w {
|
|
|
1403
1403
|
return e != null ? new Date(e) : null;
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
|
-
|
|
1406
|
+
ve.create = (n) => new ve(d({
|
|
1407
1407
|
checks: [],
|
|
1408
1408
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1409
1409
|
typeName: g.ZodDate
|
|
@@ -1412,11 +1412,11 @@ class tt extends w {
|
|
|
1412
1412
|
_parse(e) {
|
|
1413
1413
|
if (this._getType(e) !== p.symbol) {
|
|
1414
1414
|
const s = this._getOrReturnCtx(e);
|
|
1415
|
-
return
|
|
1415
|
+
return h(s, {
|
|
1416
1416
|
code: l.invalid_type,
|
|
1417
1417
|
expected: p.symbol,
|
|
1418
1418
|
received: s.parsedType
|
|
1419
|
-
}),
|
|
1419
|
+
}), v;
|
|
1420
1420
|
}
|
|
1421
1421
|
return M(e.data);
|
|
1422
1422
|
}
|
|
@@ -1424,36 +1424,36 @@ class tt extends w {
|
|
|
1424
1424
|
tt.create = (n) => new tt(d({
|
|
1425
1425
|
typeName: g.ZodSymbol
|
|
1426
1426
|
}, b(n)));
|
|
1427
|
-
class
|
|
1427
|
+
class $e extends w {
|
|
1428
1428
|
_parse(e) {
|
|
1429
1429
|
if (this._getType(e) !== p.undefined) {
|
|
1430
1430
|
const s = this._getOrReturnCtx(e);
|
|
1431
|
-
return
|
|
1431
|
+
return h(s, {
|
|
1432
1432
|
code: l.invalid_type,
|
|
1433
1433
|
expected: p.undefined,
|
|
1434
1434
|
received: s.parsedType
|
|
1435
|
-
}),
|
|
1435
|
+
}), v;
|
|
1436
1436
|
}
|
|
1437
1437
|
return M(e.data);
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
|
-
|
|
1440
|
+
$e.create = (n) => new $e(d({
|
|
1441
1441
|
typeName: g.ZodUndefined
|
|
1442
1442
|
}, b(n)));
|
|
1443
|
-
class
|
|
1443
|
+
class Pe extends w {
|
|
1444
1444
|
_parse(e) {
|
|
1445
1445
|
if (this._getType(e) !== p.null) {
|
|
1446
1446
|
const s = this._getOrReturnCtx(e);
|
|
1447
|
-
return
|
|
1447
|
+
return h(s, {
|
|
1448
1448
|
code: l.invalid_type,
|
|
1449
1449
|
expected: p.null,
|
|
1450
1450
|
received: s.parsedType
|
|
1451
|
-
}),
|
|
1451
|
+
}), v;
|
|
1452
1452
|
}
|
|
1453
1453
|
return M(e.data);
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
|
-
|
|
1456
|
+
Pe.create = (n) => new Pe(d({
|
|
1457
1457
|
typeName: g.ZodNull
|
|
1458
1458
|
}, b(n)));
|
|
1459
1459
|
class Te extends w {
|
|
@@ -1481,11 +1481,11 @@ ye.create = (n) => new ye(d({
|
|
|
1481
1481
|
class ce extends w {
|
|
1482
1482
|
_parse(e) {
|
|
1483
1483
|
const t = this._getOrReturnCtx(e);
|
|
1484
|
-
return
|
|
1484
|
+
return h(t, {
|
|
1485
1485
|
code: l.invalid_type,
|
|
1486
1486
|
expected: p.never,
|
|
1487
1487
|
received: t.parsedType
|
|
1488
|
-
}),
|
|
1488
|
+
}), v;
|
|
1489
1489
|
}
|
|
1490
1490
|
}
|
|
1491
1491
|
ce.create = (n) => new ce(d({
|
|
@@ -1495,11 +1495,11 @@ class nt extends w {
|
|
|
1495
1495
|
_parse(e) {
|
|
1496
1496
|
if (this._getType(e) !== p.undefined) {
|
|
1497
1497
|
const s = this._getOrReturnCtx(e);
|
|
1498
|
-
return
|
|
1498
|
+
return h(s, {
|
|
1499
1499
|
code: l.invalid_type,
|
|
1500
1500
|
expected: p.void,
|
|
1501
1501
|
received: s.parsedType
|
|
1502
|
-
}),
|
|
1502
|
+
}), v;
|
|
1503
1503
|
}
|
|
1504
1504
|
return M(e.data);
|
|
1505
1505
|
}
|
|
@@ -1511,14 +1511,14 @@ class J extends w {
|
|
|
1511
1511
|
_parse(e) {
|
|
1512
1512
|
const { ctx: t, status: s } = this._processInputParams(e), r = this._def;
|
|
1513
1513
|
if (t.parsedType !== p.array)
|
|
1514
|
-
return
|
|
1514
|
+
return h(t, {
|
|
1515
1515
|
code: l.invalid_type,
|
|
1516
1516
|
expected: p.array,
|
|
1517
1517
|
received: t.parsedType
|
|
1518
|
-
}),
|
|
1518
|
+
}), v;
|
|
1519
1519
|
if (r.exactLength !== null) {
|
|
1520
1520
|
const i = t.data.length > r.exactLength.value, o = t.data.length < r.exactLength.value;
|
|
1521
|
-
(i || o) && (
|
|
1521
|
+
(i || o) && (h(t, {
|
|
1522
1522
|
code: i ? l.too_big : l.too_small,
|
|
1523
1523
|
minimum: o ? r.exactLength.value : void 0,
|
|
1524
1524
|
maximum: i ? r.exactLength.value : void 0,
|
|
@@ -1528,14 +1528,14 @@ class J extends w {
|
|
|
1528
1528
|
message: r.exactLength.message
|
|
1529
1529
|
}), s.dirty());
|
|
1530
1530
|
}
|
|
1531
|
-
if (r.minLength !== null && t.data.length < r.minLength.value && (
|
|
1531
|
+
if (r.minLength !== null && t.data.length < r.minLength.value && (h(t, {
|
|
1532
1532
|
code: l.too_small,
|
|
1533
1533
|
minimum: r.minLength.value,
|
|
1534
1534
|
type: "array",
|
|
1535
1535
|
inclusive: !0,
|
|
1536
1536
|
exact: !1,
|
|
1537
1537
|
message: r.minLength.message
|
|
1538
|
-
}), s.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (
|
|
1538
|
+
}), s.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (h(t, {
|
|
1539
1539
|
code: l.too_big,
|
|
1540
1540
|
maximum: r.maxLength.value,
|
|
1541
1541
|
type: "array",
|
|
@@ -1543,9 +1543,9 @@ 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 ne(t, i, t.path, o)))).then((i) =>
|
|
1546
|
+
return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new ne(t, i, t.path, o)))).then((i) => j.mergeArray(s, i));
|
|
1547
1547
|
const a = [...t.data].map((i, o) => r.type._parseSync(new ne(t, i, t.path, o)));
|
|
1548
|
-
return
|
|
1548
|
+
return j.mergeArray(s, a);
|
|
1549
1549
|
}
|
|
1550
1550
|
get element() {
|
|
1551
1551
|
return this._def.type;
|
|
@@ -1603,11 +1603,11 @@ class S extends w {
|
|
|
1603
1603
|
_parse(e) {
|
|
1604
1604
|
if (this._getType(e) !== p.object) {
|
|
1605
1605
|
const u = this._getOrReturnCtx(e);
|
|
1606
|
-
return
|
|
1606
|
+
return h(u, {
|
|
1607
1607
|
code: l.invalid_type,
|
|
1608
1608
|
expected: p.object,
|
|
1609
1609
|
received: u.parsedType
|
|
1610
|
-
}),
|
|
1610
|
+
}), v;
|
|
1611
1611
|
}
|
|
1612
1612
|
const { status: s, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1613
1613
|
if (!(this._def.catchall instanceof ce && this._def.unknownKeys === "strip"))
|
|
@@ -1615,53 +1615,53 @@ class S extends w {
|
|
|
1615
1615
|
i.includes(u) || o.push(u);
|
|
1616
1616
|
const c = [];
|
|
1617
1617
|
for (const u of i) {
|
|
1618
|
-
const
|
|
1618
|
+
const f = a[u], _ = r.data[u];
|
|
1619
1619
|
c.push({
|
|
1620
1620
|
key: { status: "valid", value: u },
|
|
1621
|
-
value:
|
|
1621
|
+
value: f._parse(new ne(r, _, r.path, u)),
|
|
1622
1622
|
alwaysSet: u in r.data
|
|
1623
1623
|
});
|
|
1624
1624
|
}
|
|
1625
1625
|
if (this._def.catchall instanceof ce) {
|
|
1626
1626
|
const u = this._def.unknownKeys;
|
|
1627
1627
|
if (u === "passthrough")
|
|
1628
|
-
for (const
|
|
1628
|
+
for (const f of o)
|
|
1629
1629
|
c.push({
|
|
1630
|
-
key: { status: "valid", value:
|
|
1631
|
-
value: { status: "valid", value: r.data[
|
|
1630
|
+
key: { status: "valid", value: f },
|
|
1631
|
+
value: { status: "valid", value: r.data[f] }
|
|
1632
1632
|
});
|
|
1633
1633
|
else if (u === "strict")
|
|
1634
|
-
o.length > 0 && (
|
|
1634
|
+
o.length > 0 && (h(r, {
|
|
1635
1635
|
code: l.unrecognized_keys,
|
|
1636
1636
|
keys: o
|
|
1637
1637
|
}), s.dirty());
|
|
1638
1638
|
else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1639
1639
|
} else {
|
|
1640
1640
|
const u = this._def.catchall;
|
|
1641
|
-
for (const
|
|
1642
|
-
const
|
|
1641
|
+
for (const f of o) {
|
|
1642
|
+
const _ = r.data[f];
|
|
1643
1643
|
c.push({
|
|
1644
|
-
key: { status: "valid", value:
|
|
1644
|
+
key: { status: "valid", value: f },
|
|
1645
1645
|
value: u._parse(
|
|
1646
|
-
new ne(r,
|
|
1646
|
+
new ne(r, _, r.path, f)
|
|
1647
1647
|
//, ctx.child(key), value, getParsedType(value)
|
|
1648
1648
|
),
|
|
1649
|
-
alwaysSet:
|
|
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(() => $(this, null, function* () {
|
|
1654
1654
|
const u = [];
|
|
1655
|
-
for (const
|
|
1656
|
-
const
|
|
1655
|
+
for (const f of c) {
|
|
1656
|
+
const _ = yield f.key, C = yield f.value;
|
|
1657
1657
|
u.push({
|
|
1658
|
-
key:
|
|
1658
|
+
key: _,
|
|
1659
1659
|
value: C,
|
|
1660
|
-
alwaysSet:
|
|
1660
|
+
alwaysSet: f.alwaysSet
|
|
1661
1661
|
});
|
|
1662
1662
|
}
|
|
1663
1663
|
return u;
|
|
1664
|
-
})).then((u) =>
|
|
1664
|
+
})).then((u) => j.mergeObjectSync(s, u)) : j.mergeObjectSync(s, c);
|
|
1665
1665
|
}
|
|
1666
1666
|
get shape() {
|
|
1667
1667
|
return this._def.shape();
|
|
@@ -1858,7 +1858,7 @@ S.lazycreate = (n, e) => new S(d({
|
|
|
1858
1858
|
catchall: ce.create(),
|
|
1859
1859
|
typeName: g.ZodObject
|
|
1860
1860
|
}, b(e)));
|
|
1861
|
-
class
|
|
1861
|
+
class Fe extends w {
|
|
1862
1862
|
_parse(e) {
|
|
1863
1863
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
1864
1864
|
function r(a) {
|
|
@@ -1869,13 +1869,13 @@ class Le extends w {
|
|
|
1869
1869
|
if (o.result.status === "dirty")
|
|
1870
1870
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1871
1871
|
const i = a.map((o) => new U(o.ctx.common.issues));
|
|
1872
|
-
return
|
|
1872
|
+
return h(t, {
|
|
1873
1873
|
code: l.invalid_union,
|
|
1874
1874
|
unionErrors: i
|
|
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) => $(this, null, function* () {
|
|
1879
1879
|
const i = y(d({}, t), {
|
|
1880
1880
|
common: y(d({}, t.common), {
|
|
1881
1881
|
issues: []
|
|
@@ -1900,42 +1900,42 @@ class Le extends w {
|
|
|
1900
1900
|
issues: []
|
|
1901
1901
|
}),
|
|
1902
1902
|
parent: null
|
|
1903
|
-
}),
|
|
1903
|
+
}), f = c._parseSync({
|
|
1904
1904
|
data: t.data,
|
|
1905
1905
|
path: t.path,
|
|
1906
1906
|
parent: u
|
|
1907
1907
|
});
|
|
1908
|
-
if (
|
|
1909
|
-
return
|
|
1910
|
-
|
|
1908
|
+
if (f.status === "valid")
|
|
1909
|
+
return f;
|
|
1910
|
+
f.status === "dirty" && !a && (a = { result: f, ctx: u }), u.common.issues.length && i.push(u.common.issues);
|
|
1911
1911
|
}
|
|
1912
1912
|
if (a)
|
|
1913
1913
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1914
1914
|
const o = i.map((c) => new U(c));
|
|
1915
|
-
return
|
|
1915
|
+
return h(t, {
|
|
1916
1916
|
code: l.invalid_union,
|
|
1917
1917
|
unionErrors: o
|
|
1918
|
-
}),
|
|
1918
|
+
}), v;
|
|
1919
1919
|
}
|
|
1920
1920
|
}
|
|
1921
1921
|
get options() {
|
|
1922
1922
|
return this._def.options;
|
|
1923
1923
|
}
|
|
1924
1924
|
}
|
|
1925
|
-
|
|
1925
|
+
Fe.create = (n, e) => new Fe(d({
|
|
1926
1926
|
options: n,
|
|
1927
1927
|
typeName: g.ZodUnion
|
|
1928
1928
|
}, b(e)));
|
|
1929
|
-
const ie = (n) => n instanceof
|
|
1929
|
+
const ie = (n) => n instanceof Ve ? ie(n.schema) : n instanceof G ? ie(n.innerType()) : n instanceof Ue ? [n.value] : n instanceof fe ? n.options : n instanceof ze ? x.objectValues(n.enum) : n instanceof We ? ie(n._def.innerType) : n instanceof $e ? [void 0] : n instanceof Pe ? [null] : n instanceof te ? [void 0, ...ie(n.unwrap())] : n instanceof he ? [null, ...ie(n.unwrap())] : n instanceof St || n instanceof qe ? ie(n.unwrap()) : n instanceof Be ? ie(n._def.innerType) : [];
|
|
1930
1930
|
class at extends w {
|
|
1931
1931
|
_parse(e) {
|
|
1932
1932
|
const { ctx: t } = this._processInputParams(e);
|
|
1933
1933
|
if (t.parsedType !== p.object)
|
|
1934
|
-
return
|
|
1934
|
+
return h(t, {
|
|
1935
1935
|
code: l.invalid_type,
|
|
1936
1936
|
expected: p.object,
|
|
1937
1937
|
received: t.parsedType
|
|
1938
|
-
}),
|
|
1938
|
+
}), v;
|
|
1939
1939
|
const s = this.discriminator, r = t.data[s], a = this.optionsMap.get(r);
|
|
1940
1940
|
return a ? t.common.async ? a._parseAsync({
|
|
1941
1941
|
data: t.data,
|
|
@@ -1945,11 +1945,11 @@ class at extends w {
|
|
|
1945
1945
|
data: t.data,
|
|
1946
1946
|
path: t.path,
|
|
1947
1947
|
parent: t
|
|
1948
|
-
}) : (
|
|
1948
|
+
}) : (h(t, {
|
|
1949
1949
|
code: l.invalid_union_discriminator,
|
|
1950
1950
|
options: Array.from(this.optionsMap.keys()),
|
|
1951
1951
|
path: [s]
|
|
1952
|
-
}),
|
|
1952
|
+
}), v);
|
|
1953
1953
|
}
|
|
1954
1954
|
get discriminator() {
|
|
1955
1955
|
return this._def.discriminator;
|
|
@@ -2014,15 +2014,15 @@ 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 Le extends w {
|
|
2018
2018
|
_parse(e) {
|
|
2019
2019
|
const { status: t, ctx: s } = this._processInputParams(e), r = (a, i) => {
|
|
2020
2020
|
if (ht(a) || ht(i))
|
|
2021
|
-
return
|
|
2021
|
+
return v;
|
|
2022
2022
|
const o = mt(a.value, i.value);
|
|
2023
|
-
return o.valid ? ((pt(a) || pt(i)) && t.dirty(), { status: t.value, value: o.data }) : (
|
|
2023
|
+
return o.valid ? ((pt(a) || pt(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
|
|
2024
2024
|
code: l.invalid_intersection_types
|
|
2025
|
-
}),
|
|
2025
|
+
}), v);
|
|
2026
2026
|
};
|
|
2027
2027
|
return s.common.async ? Promise.all([
|
|
2028
2028
|
this._def.left._parseAsync({
|
|
@@ -2046,7 +2046,7 @@ class De extends w {
|
|
|
2046
2046
|
}));
|
|
2047
2047
|
}
|
|
2048
2048
|
}
|
|
2049
|
-
|
|
2049
|
+
Le.create = (n, e, t) => new Le(d({
|
|
2050
2050
|
left: n,
|
|
2051
2051
|
right: e,
|
|
2052
2052
|
typeName: g.ZodIntersection
|
|
@@ -2055,20 +2055,20 @@ class se extends w {
|
|
|
2055
2055
|
_parse(e) {
|
|
2056
2056
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2057
2057
|
if (s.parsedType !== p.array)
|
|
2058
|
-
return
|
|
2058
|
+
return h(s, {
|
|
2059
2059
|
code: l.invalid_type,
|
|
2060
2060
|
expected: p.array,
|
|
2061
2061
|
received: s.parsedType
|
|
2062
|
-
}),
|
|
2062
|
+
}), v;
|
|
2063
2063
|
if (s.data.length < this._def.items.length)
|
|
2064
|
-
return
|
|
2064
|
+
return h(s, {
|
|
2065
2065
|
code: l.too_small,
|
|
2066
2066
|
minimum: this._def.items.length,
|
|
2067
2067
|
inclusive: !0,
|
|
2068
2068
|
exact: !1,
|
|
2069
2069
|
type: "array"
|
|
2070
|
-
}),
|
|
2071
|
-
!this._def.rest && s.data.length > this._def.items.length && (
|
|
2070
|
+
}), v;
|
|
2071
|
+
!this._def.rest && s.data.length > this._def.items.length && (h(s, {
|
|
2072
2072
|
code: l.too_big,
|
|
2073
2073
|
maximum: this._def.items.length,
|
|
2074
2074
|
inclusive: !0,
|
|
@@ -2079,7 +2079,7 @@ class se extends w {
|
|
|
2079
2079
|
const c = this._def.items[o] || this._def.rest;
|
|
2080
2080
|
return c ? c._parse(new ne(s, i, s.path, o)) : null;
|
|
2081
2081
|
}).filter((i) => !!i);
|
|
2082
|
-
return s.common.async ? Promise.all(a).then((i) =>
|
|
2082
|
+
return s.common.async ? Promise.all(a).then((i) => j.mergeArray(t, i)) : j.mergeArray(t, a);
|
|
2083
2083
|
}
|
|
2084
2084
|
get items() {
|
|
2085
2085
|
return this._def.items;
|
|
@@ -2099,7 +2099,7 @@ se.create = (n, e) => {
|
|
|
2099
2099
|
rest: null
|
|
2100
2100
|
}, b(e)));
|
|
2101
2101
|
};
|
|
2102
|
-
class
|
|
2102
|
+
class De extends w {
|
|
2103
2103
|
get keySchema() {
|
|
2104
2104
|
return this._def.keyType;
|
|
2105
2105
|
}
|
|
@@ -2109,11 +2109,11 @@ class Ve extends w {
|
|
|
2109
2109
|
_parse(e) {
|
|
2110
2110
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2111
2111
|
if (s.parsedType !== p.object)
|
|
2112
|
-
return
|
|
2112
|
+
return h(s, {
|
|
2113
2113
|
code: l.invalid_type,
|
|
2114
2114
|
expected: p.object,
|
|
2115
2115
|
received: s.parsedType
|
|
2116
|
-
}),
|
|
2116
|
+
}), v;
|
|
2117
2117
|
const r = [], a = this._def.keyType, i = this._def.valueType;
|
|
2118
2118
|
for (const o in s.data)
|
|
2119
2119
|
r.push({
|
|
@@ -2121,17 +2121,17 @@ class Ve extends w {
|
|
|
2121
2121
|
value: i._parse(new ne(s, s.data[o], s.path, o)),
|
|
2122
2122
|
alwaysSet: o in s.data
|
|
2123
2123
|
});
|
|
2124
|
-
return s.common.async ?
|
|
2124
|
+
return s.common.async ? j.mergeObjectAsync(t, r) : j.mergeObjectSync(t, r);
|
|
2125
2125
|
}
|
|
2126
2126
|
get element() {
|
|
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 De(d({
|
|
2131
2131
|
keyType: e,
|
|
2132
2132
|
valueType: t,
|
|
2133
2133
|
typeName: g.ZodRecord
|
|
2134
|
-
}, b(s))) : new
|
|
2134
|
+
}, b(s))) : new De(d({
|
|
2135
2135
|
keyType: H.create(),
|
|
2136
2136
|
valueType: e,
|
|
2137
2137
|
typeName: g.ZodRecord
|
|
@@ -2148,33 +2148,33 @@ class st extends w {
|
|
|
2148
2148
|
_parse(e) {
|
|
2149
2149
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2150
2150
|
if (s.parsedType !== p.map)
|
|
2151
|
-
return
|
|
2151
|
+
return h(s, {
|
|
2152
2152
|
code: l.invalid_type,
|
|
2153
2153
|
expected: p.map,
|
|
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], u) => ({
|
|
2157
2157
|
key: r._parse(new ne(s, o, s.path, [u, "key"])),
|
|
2158
2158
|
value: a._parse(new ne(s, c, s.path, [u, "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(() => $(this, null, function* () {
|
|
2163
2163
|
for (const c of i) {
|
|
2164
|
-
const u = yield c.key,
|
|
2165
|
-
if (u.status === "aborted" ||
|
|
2166
|
-
return
|
|
2167
|
-
(u.status === "dirty" ||
|
|
2164
|
+
const u = yield c.key, f = yield c.value;
|
|
2165
|
+
if (u.status === "aborted" || f.status === "aborted")
|
|
2166
|
+
return v;
|
|
2167
|
+
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
|
|
2168
2168
|
}
|
|
2169
2169
|
return { status: t.value, value: o };
|
|
2170
2170
|
}));
|
|
2171
2171
|
} else {
|
|
2172
2172
|
const o = /* @__PURE__ */ new Map();
|
|
2173
2173
|
for (const c of i) {
|
|
2174
|
-
const u = c.key,
|
|
2175
|
-
if (u.status === "aborted" ||
|
|
2176
|
-
return
|
|
2177
|
-
(u.status === "dirty" ||
|
|
2174
|
+
const u = c.key, f = c.value;
|
|
2175
|
+
if (u.status === "aborted" || f.status === "aborted")
|
|
2176
|
+
return v;
|
|
2177
|
+
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
|
|
2178
2178
|
}
|
|
2179
2179
|
return { status: t.value, value: o };
|
|
2180
2180
|
}
|
|
@@ -2185,24 +2185,24 @@ st.create = (n, e, t) => new st(d({
|
|
|
2185
2185
|
keyType: n,
|
|
2186
2186
|
typeName: g.ZodMap
|
|
2187
2187
|
}, b(t)));
|
|
2188
|
-
class
|
|
2188
|
+
class _e extends w {
|
|
2189
2189
|
_parse(e) {
|
|
2190
2190
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2191
2191
|
if (s.parsedType !== p.set)
|
|
2192
|
-
return
|
|
2192
|
+
return h(s, {
|
|
2193
2193
|
code: l.invalid_type,
|
|
2194
2194
|
expected: p.set,
|
|
2195
2195
|
received: s.parsedType
|
|
2196
|
-
}),
|
|
2196
|
+
}), v;
|
|
2197
2197
|
const r = this._def;
|
|
2198
|
-
r.minSize !== null && s.data.size < r.minSize.value && (
|
|
2198
|
+
r.minSize !== null && s.data.size < r.minSize.value && (h(s, {
|
|
2199
2199
|
code: l.too_small,
|
|
2200
2200
|
minimum: r.minSize.value,
|
|
2201
2201
|
type: "set",
|
|
2202
2202
|
inclusive: !0,
|
|
2203
2203
|
exact: !1,
|
|
2204
2204
|
message: r.minSize.message
|
|
2205
|
-
}), t.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (
|
|
2205
|
+
}), t.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (h(s, {
|
|
2206
2206
|
code: l.too_big,
|
|
2207
2207
|
maximum: r.maxSize.value,
|
|
2208
2208
|
type: "set",
|
|
@@ -2213,10 +2213,10 @@ class ve extends w {
|
|
|
2213
2213
|
const a = this._def.valueType;
|
|
2214
2214
|
function i(c) {
|
|
2215
2215
|
const u = /* @__PURE__ */ new Set();
|
|
2216
|
-
for (const
|
|
2217
|
-
if (
|
|
2218
|
-
return
|
|
2219
|
-
|
|
2216
|
+
for (const f of c) {
|
|
2217
|
+
if (f.status === "aborted")
|
|
2218
|
+
return v;
|
|
2219
|
+
f.status === "dirty" && t.dirty(), u.add(f.value);
|
|
2220
2220
|
}
|
|
2221
2221
|
return { status: t.value, value: u };
|
|
2222
2222
|
}
|
|
@@ -2224,12 +2224,12 @@ class ve extends w {
|
|
|
2224
2224
|
return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
2225
2225
|
}
|
|
2226
2226
|
min(e, t) {
|
|
2227
|
-
return new
|
|
2227
|
+
return new _e(y(d({}, this._def), {
|
|
2228
2228
|
minSize: { value: e, message: m.toString(t) }
|
|
2229
2229
|
}));
|
|
2230
2230
|
}
|
|
2231
2231
|
max(e, t) {
|
|
2232
|
-
return new
|
|
2232
|
+
return new _e(y(d({}, this._def), {
|
|
2233
2233
|
maxSize: { value: e, message: m.toString(t) }
|
|
2234
2234
|
}));
|
|
2235
2235
|
}
|
|
@@ -2240,7 +2240,7 @@ class ve extends w {
|
|
|
2240
2240
|
return this.min(1, e);
|
|
2241
2241
|
}
|
|
2242
2242
|
}
|
|
2243
|
-
|
|
2243
|
+
_e.create = (n, e) => new _e(d({
|
|
2244
2244
|
valueType: n,
|
|
2245
2245
|
minSize: null,
|
|
2246
2246
|
maxSize: null,
|
|
@@ -2253,11 +2253,11 @@ class xe extends w {
|
|
|
2253
2253
|
_parse(e) {
|
|
2254
2254
|
const { ctx: t } = this._processInputParams(e);
|
|
2255
2255
|
if (t.parsedType !== p.function)
|
|
2256
|
-
return
|
|
2256
|
+
return h(t, {
|
|
2257
2257
|
code: l.invalid_type,
|
|
2258
2258
|
expected: p.function,
|
|
2259
2259
|
received: t.parsedType
|
|
2260
|
-
}),
|
|
2260
|
+
}), v;
|
|
2261
2261
|
function s(o, c) {
|
|
2262
2262
|
return Qe({
|
|
2263
2263
|
data: o,
|
|
@@ -2294,12 +2294,12 @@ class xe extends w {
|
|
|
2294
2294
|
if (this._def.returns instanceof Se) {
|
|
2295
2295
|
const o = this;
|
|
2296
2296
|
return M(function(...c) {
|
|
2297
|
-
return
|
|
2298
|
-
const u = new U([]),
|
|
2297
|
+
return $(this, null, function* () {
|
|
2298
|
+
const u = new U([]), f = yield o._def.args.parseAsync(c, a).catch((A) => {
|
|
2299
2299
|
throw u.addIssue(s(c, A)), u;
|
|
2300
|
-
}),
|
|
2301
|
-
return yield o._def.returns._def.type.parseAsync(
|
|
2302
|
-
throw u.addIssue(r(
|
|
2300
|
+
}), _ = yield Reflect.apply(i, this, f);
|
|
2301
|
+
return yield o._def.returns._def.type.parseAsync(_, a).catch((A) => {
|
|
2302
|
+
throw u.addIssue(r(_, A)), u;
|
|
2303
2303
|
});
|
|
2304
2304
|
});
|
|
2305
2305
|
});
|
|
@@ -2309,10 +2309,10 @@ class xe extends w {
|
|
|
2309
2309
|
const u = o._def.args.safeParse(c, a);
|
|
2310
2310
|
if (!u.success)
|
|
2311
2311
|
throw new U([s(c, u.error)]);
|
|
2312
|
-
const
|
|
2313
|
-
if (!
|
|
2314
|
-
throw new U([r(
|
|
2315
|
-
return
|
|
2312
|
+
const f = Reflect.apply(i, this, u.data), _ = o._def.returns.safeParse(f, a);
|
|
2313
|
+
if (!_.success)
|
|
2314
|
+
throw new U([r(f, _.error)]);
|
|
2315
|
+
return _.data;
|
|
2316
2316
|
});
|
|
2317
2317
|
}
|
|
2318
2318
|
}
|
|
@@ -2346,7 +2346,7 @@ class xe extends w {
|
|
|
2346
2346
|
}, b(s)));
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
|
-
class
|
|
2349
|
+
class Ve extends w {
|
|
2350
2350
|
get schema() {
|
|
2351
2351
|
return this._def.getter();
|
|
2352
2352
|
}
|
|
@@ -2355,7 +2355,7 @@ class Fe extends w {
|
|
|
2355
2355
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2356
2356
|
}
|
|
2357
2357
|
}
|
|
2358
|
-
|
|
2358
|
+
Ve.create = (n, e) => new Ve(d({
|
|
2359
2359
|
getter: n,
|
|
2360
2360
|
typeName: g.ZodLazy
|
|
2361
2361
|
}, b(e)));
|
|
@@ -2363,11 +2363,11 @@ class Ue extends w {
|
|
|
2363
2363
|
_parse(e) {
|
|
2364
2364
|
if (e.data !== this._def.value) {
|
|
2365
2365
|
const t = this._getOrReturnCtx(e);
|
|
2366
|
-
return
|
|
2366
|
+
return h(t, {
|
|
2367
2367
|
received: t.data,
|
|
2368
2368
|
code: l.invalid_literal,
|
|
2369
2369
|
expected: this._def.value
|
|
2370
|
-
}),
|
|
2370
|
+
}), v;
|
|
2371
2371
|
}
|
|
2372
2372
|
return { status: "valid", value: e.data };
|
|
2373
2373
|
}
|
|
@@ -2392,19 +2392,19 @@ class fe extends w {
|
|
|
2392
2392
|
_parse(e) {
|
|
2393
2393
|
if (typeof e.data != "string") {
|
|
2394
2394
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2395
|
-
return
|
|
2395
|
+
return h(t, {
|
|
2396
2396
|
expected: x.joinValues(s),
|
|
2397
2397
|
received: t.parsedType,
|
|
2398
2398
|
code: l.invalid_type
|
|
2399
|
-
}),
|
|
2399
|
+
}), v;
|
|
2400
2400
|
}
|
|
2401
2401
|
if (et(this, Ce) || Ht(this, Ce, new Set(this._def.values)), !et(this, Ce).has(e.data)) {
|
|
2402
2402
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2403
|
-
return
|
|
2403
|
+
return h(t, {
|
|
2404
2404
|
received: t.data,
|
|
2405
2405
|
code: l.invalid_enum_value,
|
|
2406
2406
|
options: s
|
|
2407
|
-
}),
|
|
2407
|
+
}), v;
|
|
2408
2408
|
}
|
|
2409
2409
|
return M(e.data);
|
|
2410
2410
|
}
|
|
@@ -2440,25 +2440,25 @@ Ce = /* @__PURE__ */ new WeakMap();
|
|
|
2440
2440
|
fe.create = Xt;
|
|
2441
2441
|
class ze extends w {
|
|
2442
2442
|
constructor() {
|
|
2443
|
-
super(...arguments),
|
|
2443
|
+
super(...arguments), Ie.set(this, void 0);
|
|
2444
2444
|
}
|
|
2445
2445
|
_parse(e) {
|
|
2446
2446
|
const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
2447
2447
|
if (s.parsedType !== p.string && s.parsedType !== p.number) {
|
|
2448
2448
|
const r = x.objectValues(t);
|
|
2449
|
-
return
|
|
2449
|
+
return h(s, {
|
|
2450
2450
|
expected: x.joinValues(r),
|
|
2451
2451
|
received: s.parsedType,
|
|
2452
2452
|
code: l.invalid_type
|
|
2453
|
-
}),
|
|
2453
|
+
}), v;
|
|
2454
2454
|
}
|
|
2455
|
-
if (et(this,
|
|
2455
|
+
if (et(this, Ie) || Ht(this, Ie, new Set(x.getValidEnumValues(this._def.values))), !et(this, Ie).has(e.data)) {
|
|
2456
2456
|
const r = x.objectValues(t);
|
|
2457
|
-
return
|
|
2457
|
+
return h(s, {
|
|
2458
2458
|
received: s.data,
|
|
2459
2459
|
code: l.invalid_enum_value,
|
|
2460
2460
|
options: r
|
|
2461
|
-
}),
|
|
2461
|
+
}), v;
|
|
2462
2462
|
}
|
|
2463
2463
|
return M(e.data);
|
|
2464
2464
|
}
|
|
@@ -2466,7 +2466,7 @@ class ze extends w {
|
|
|
2466
2466
|
return this._def.values;
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
|
-
|
|
2469
|
+
Ie = /* @__PURE__ */ new WeakMap();
|
|
2470
2470
|
ze.create = (n, e) => new ze(d({
|
|
2471
2471
|
values: n,
|
|
2472
2472
|
typeName: g.ZodNativeEnum
|
|
@@ -2478,11 +2478,11 @@ class Se extends w {
|
|
|
2478
2478
|
_parse(e) {
|
|
2479
2479
|
const { ctx: t } = this._processInputParams(e);
|
|
2480
2480
|
if (t.parsedType !== p.promise && t.common.async === !1)
|
|
2481
|
-
return
|
|
2481
|
+
return h(t, {
|
|
2482
2482
|
code: l.invalid_type,
|
|
2483
2483
|
expected: p.promise,
|
|
2484
2484
|
received: t.parsedType
|
|
2485
|
-
}),
|
|
2485
|
+
}), v;
|
|
2486
2486
|
const s = t.parsedType === p.promise ? t.data : Promise.resolve(t.data);
|
|
2487
2487
|
return M(s.then((r) => this._def.type.parseAsync(r, {
|
|
2488
2488
|
path: t.path,
|
|
@@ -2504,7 +2504,7 @@ class G extends w {
|
|
|
2504
2504
|
_parse(e) {
|
|
2505
2505
|
const { status: t, ctx: s } = this._processInputParams(e), r = this._def.effect || null, a = {
|
|
2506
2506
|
addIssue: (i) => {
|
|
2507
|
-
|
|
2507
|
+
h(s, i), i.fatal ? t.abort() : t.dirty();
|
|
2508
2508
|
},
|
|
2509
2509
|
get path() {
|
|
2510
2510
|
return s.path;
|
|
@@ -2513,25 +2513,25 @@ 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) => $(this, null, function* () {
|
|
2517
2517
|
if (t.value === "aborted")
|
|
2518
|
-
return
|
|
2518
|
+
return v;
|
|
2519
2519
|
const c = yield this._def.schema._parseAsync({
|
|
2520
2520
|
data: o,
|
|
2521
2521
|
path: s.path,
|
|
2522
2522
|
parent: s
|
|
2523
2523
|
});
|
|
2524
|
-
return c.status === "aborted" ?
|
|
2524
|
+
return c.status === "aborted" ? v : c.status === "dirty" || t.value === "dirty" ? we(c.value) : c;
|
|
2525
2525
|
}));
|
|
2526
2526
|
{
|
|
2527
2527
|
if (t.value === "aborted")
|
|
2528
|
-
return
|
|
2528
|
+
return v;
|
|
2529
2529
|
const o = this._def.schema._parseSync({
|
|
2530
2530
|
data: i,
|
|
2531
2531
|
path: s.path,
|
|
2532
2532
|
parent: s
|
|
2533
2533
|
});
|
|
2534
|
-
return o.status === "aborted" ?
|
|
2534
|
+
return o.status === "aborted" ? v : o.status === "dirty" || t.value === "dirty" ? we(o.value) : o;
|
|
2535
2535
|
}
|
|
2536
2536
|
}
|
|
2537
2537
|
if (r.type === "refinement") {
|
|
@@ -2549,9 +2549,9 @@ class G extends w {
|
|
|
2549
2549
|
path: s.path,
|
|
2550
2550
|
parent: s
|
|
2551
2551
|
});
|
|
2552
|
-
return o.status === "aborted" ?
|
|
2552
|
+
return o.status === "aborted" ? v : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
2553
2553
|
} else
|
|
2554
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ?
|
|
2554
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? v : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2555
2555
|
}
|
|
2556
2556
|
if (r.type === "transform")
|
|
2557
2557
|
if (s.common.async === !1) {
|
|
@@ -2605,7 +2605,7 @@ he.create = (n, e) => new he(d({
|
|
|
2605
2605
|
innerType: n,
|
|
2606
2606
|
typeName: g.ZodNullable
|
|
2607
2607
|
}, b(e)));
|
|
2608
|
-
class
|
|
2608
|
+
class We 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 Be extends w {
|
|
|
2619
2619
|
return this._def.innerType;
|
|
2620
2620
|
}
|
|
2621
2621
|
}
|
|
2622
|
-
|
|
2622
|
+
We.create = (n, e) => new We(d({
|
|
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 Be extends w {
|
|
2628
2628
|
_parse(e) {
|
|
2629
2629
|
const { ctx: t } = this._processInputParams(e), s = y(d({}, t), {
|
|
2630
2630
|
common: y(d({}, t.common), {
|
|
@@ -2657,7 +2657,7 @@ class We extends w {
|
|
|
2657
2657
|
return this._def.innerType;
|
|
2658
2658
|
}
|
|
2659
2659
|
}
|
|
2660
|
-
|
|
2660
|
+
Be.create = (n, e) => new Be(d({
|
|
2661
2661
|
innerType: n,
|
|
2662
2662
|
typeName: g.ZodCatch,
|
|
2663
2663
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
@@ -2666,11 +2666,11 @@ class rt extends w {
|
|
|
2666
2666
|
_parse(e) {
|
|
2667
2667
|
if (this._getType(e) !== p.nan) {
|
|
2668
2668
|
const s = this._getOrReturnCtx(e);
|
|
2669
|
-
return
|
|
2669
|
+
return h(s, {
|
|
2670
2670
|
code: l.invalid_type,
|
|
2671
2671
|
expected: p.nan,
|
|
2672
2672
|
received: s.parsedType
|
|
2673
|
-
}),
|
|
2673
|
+
}), v;
|
|
2674
2674
|
}
|
|
2675
2675
|
return { status: "valid", value: e.data };
|
|
2676
2676
|
}
|
|
@@ -2678,7 +2678,7 @@ class rt extends w {
|
|
|
2678
2678
|
rt.create = (n) => new rt(d({
|
|
2679
2679
|
typeName: g.ZodNaN
|
|
2680
2680
|
}, b(n)));
|
|
2681
|
-
const
|
|
2681
|
+
const Vn = Symbol("zod_brand");
|
|
2682
2682
|
class St extends w {
|
|
2683
2683
|
_parse(e) {
|
|
2684
2684
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
@@ -2696,13 +2696,13 @@ class Je 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 $(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" ?
|
|
2705
|
+
return a.status === "aborted" ? v : a.status === "dirty" ? (t.dirty(), we(a.value)) : this._def.out._parseAsync({
|
|
2706
2706
|
data: a.value,
|
|
2707
2707
|
path: s.path,
|
|
2708
2708
|
parent: s
|
|
@@ -2714,7 +2714,7 @@ class Je extends w {
|
|
|
2714
2714
|
path: s.path,
|
|
2715
2715
|
parent: s
|
|
2716
2716
|
});
|
|
2717
|
-
return r.status === "aborted" ?
|
|
2717
|
+
return r.status === "aborted" ? v : r.status === "dirty" ? (t.dirty(), {
|
|
2718
2718
|
status: "dirty",
|
|
2719
2719
|
value: r.value
|
|
2720
2720
|
}) : this._def.out._parseSync({
|
|
@@ -2763,25 +2763,25 @@ 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 = ue.create,
|
|
2766
|
+
}) => Yt((t) => t instanceof n, e), Qt = H.create, en = ue.create, Wn = rt.create, Bn = le.create, tn = Me.create, qn = ve.create, Hn = tt.create, Jn = $e.create, Gn = Pe.create, Kn = Te.create, Xn = ye.create, Yn = ce.create, Qn = nt.create, es = J.create, ts = S.create, ns = S.strictCreate, ss = Fe.create, rs = at.create, as = Le.create, is = se.create, os = De.create, cs = st.create, ds = _e.create, us = xe.create, ls = Ve.create, fs = Ue.create, hs = fe.create, ps = ze.create, ms = Se.create, Pt = G.create, ys = te.create, gs = he.create, vs = G.createWithPreprocess, _s = Je.create, bs = () => Qt().optional(), ws = () => en().optional(), xs = () => tn().optional(), ks = {
|
|
2767
2767
|
string: (n) => H.create(y(d({}, n), { coerce: !0 })),
|
|
2768
2768
|
number: (n) => ue.create(y(d({}, n), { coerce: !0 })),
|
|
2769
2769
|
boolean: (n) => Me.create(y(d({}, n), {
|
|
2770
2770
|
coerce: !0
|
|
2771
2771
|
})),
|
|
2772
2772
|
bigint: (n) => le.create(y(d({}, n), { coerce: !0 })),
|
|
2773
|
-
date: (n) =>
|
|
2774
|
-
}, Ts =
|
|
2775
|
-
var
|
|
2773
|
+
date: (n) => ve.create(y(d({}, n), { coerce: !0 }))
|
|
2774
|
+
}, Ts = v;
|
|
2775
|
+
var P = /* @__PURE__ */ Object.freeze({
|
|
2776
2776
|
__proto__: null,
|
|
2777
2777
|
defaultErrorMap: ke,
|
|
2778
|
-
setErrorMap:
|
|
2778
|
+
setErrorMap: vn,
|
|
2779
2779
|
getErrorMap: Ye,
|
|
2780
2780
|
makeIssue: Qe,
|
|
2781
|
-
EMPTY_PATH:
|
|
2782
|
-
addIssueToContext:
|
|
2783
|
-
ParseStatus:
|
|
2784
|
-
INVALID:
|
|
2781
|
+
EMPTY_PATH: _n,
|
|
2782
|
+
addIssueToContext: h,
|
|
2783
|
+
ParseStatus: j,
|
|
2784
|
+
INVALID: v,
|
|
2785
2785
|
DIRTY: we,
|
|
2786
2786
|
OK: M,
|
|
2787
2787
|
isAborted: ht,
|
|
@@ -2802,25 +2802,25 @@ var V = /* @__PURE__ */ Object.freeze({
|
|
|
2802
2802
|
ZodNumber: ue,
|
|
2803
2803
|
ZodBigInt: le,
|
|
2804
2804
|
ZodBoolean: Me,
|
|
2805
|
-
ZodDate:
|
|
2805
|
+
ZodDate: ve,
|
|
2806
2806
|
ZodSymbol: tt,
|
|
2807
|
-
ZodUndefined:
|
|
2808
|
-
ZodNull:
|
|
2807
|
+
ZodUndefined: $e,
|
|
2808
|
+
ZodNull: Pe,
|
|
2809
2809
|
ZodAny: Te,
|
|
2810
2810
|
ZodUnknown: ye,
|
|
2811
2811
|
ZodNever: ce,
|
|
2812
2812
|
ZodVoid: nt,
|
|
2813
2813
|
ZodArray: J,
|
|
2814
2814
|
ZodObject: S,
|
|
2815
|
-
ZodUnion:
|
|
2815
|
+
ZodUnion: Fe,
|
|
2816
2816
|
ZodDiscriminatedUnion: at,
|
|
2817
|
-
ZodIntersection:
|
|
2817
|
+
ZodIntersection: Le,
|
|
2818
2818
|
ZodTuple: se,
|
|
2819
|
-
ZodRecord:
|
|
2819
|
+
ZodRecord: De,
|
|
2820
2820
|
ZodMap: st,
|
|
2821
|
-
ZodSet:
|
|
2821
|
+
ZodSet: _e,
|
|
2822
2822
|
ZodFunction: xe,
|
|
2823
|
-
ZodLazy:
|
|
2823
|
+
ZodLazy: Ve,
|
|
2824
2824
|
ZodLiteral: Ue,
|
|
2825
2825
|
ZodEnum: fe,
|
|
2826
2826
|
ZodNativeEnum: ze,
|
|
@@ -2829,10 +2829,10 @@ var V = /* @__PURE__ */ Object.freeze({
|
|
|
2829
2829
|
ZodTransformer: G,
|
|
2830
2830
|
ZodOptional: te,
|
|
2831
2831
|
ZodNullable: he,
|
|
2832
|
-
ZodDefault:
|
|
2833
|
-
ZodCatch:
|
|
2832
|
+
ZodDefault: We,
|
|
2833
|
+
ZodCatch: Be,
|
|
2834
2834
|
ZodNaN: rt,
|
|
2835
|
-
BRAND:
|
|
2835
|
+
BRAND: Vn,
|
|
2836
2836
|
ZodBranded: St,
|
|
2837
2837
|
ZodPipeline: Je,
|
|
2838
2838
|
ZodReadonly: qe,
|
|
@@ -2846,11 +2846,11 @@ var V = /* @__PURE__ */ Object.freeze({
|
|
|
2846
2846
|
coerce: ks,
|
|
2847
2847
|
any: Kn,
|
|
2848
2848
|
array: es,
|
|
2849
|
-
bigint:
|
|
2849
|
+
bigint: Bn,
|
|
2850
2850
|
boolean: tn,
|
|
2851
2851
|
date: qn,
|
|
2852
2852
|
discriminatedUnion: rs,
|
|
2853
|
-
effect:
|
|
2853
|
+
effect: Pt,
|
|
2854
2854
|
enum: hs,
|
|
2855
2855
|
function: us,
|
|
2856
2856
|
instanceof: zn,
|
|
@@ -2858,7 +2858,7 @@ var V = /* @__PURE__ */ Object.freeze({
|
|
|
2858
2858
|
lazy: ls,
|
|
2859
2859
|
literal: fs,
|
|
2860
2860
|
map: cs,
|
|
2861
|
-
nan:
|
|
2861
|
+
nan: Wn,
|
|
2862
2862
|
nativeEnum: ps,
|
|
2863
2863
|
never: Yn,
|
|
2864
2864
|
null: Gn,
|
|
@@ -2869,15 +2869,15 @@ var V = /* @__PURE__ */ Object.freeze({
|
|
|
2869
2869
|
onumber: ws,
|
|
2870
2870
|
optional: ys,
|
|
2871
2871
|
ostring: bs,
|
|
2872
|
-
pipeline:
|
|
2873
|
-
preprocess:
|
|
2872
|
+
pipeline: _s,
|
|
2873
|
+
preprocess: vs,
|
|
2874
2874
|
promise: ms,
|
|
2875
2875
|
record: os,
|
|
2876
2876
|
set: ds,
|
|
2877
2877
|
strictObject: ns,
|
|
2878
2878
|
string: Qt,
|
|
2879
2879
|
symbol: Hn,
|
|
2880
|
-
transformer:
|
|
2880
|
+
transformer: Pt,
|
|
2881
2881
|
tuple: is,
|
|
2882
2882
|
undefined: Jn,
|
|
2883
2883
|
union: ss,
|
|
@@ -2888,14 +2888,14 @@ var V = /* @__PURE__ */ Object.freeze({
|
|
|
2888
2888
|
quotelessJson: gn,
|
|
2889
2889
|
ZodError: U
|
|
2890
2890
|
});
|
|
2891
|
-
const Ss =
|
|
2892
|
-
language:
|
|
2891
|
+
const Ss = P.object({
|
|
2892
|
+
language: P.enum(["typescript", "javascript"]).optional()
|
|
2893
2893
|
}).and(
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
framework:
|
|
2897
|
-
model:
|
|
2898
|
-
styling:
|
|
2894
|
+
P.union([
|
|
2895
|
+
P.object({
|
|
2896
|
+
framework: P.literal("react"),
|
|
2897
|
+
model: P.string().optional(),
|
|
2898
|
+
styling: P.enum([
|
|
2899
2899
|
"plain_css",
|
|
2900
2900
|
"css_modules",
|
|
2901
2901
|
"styled_components",
|
|
@@ -2904,13 +2904,14 @@ const Ss = V.object({
|
|
|
2904
2904
|
"scss",
|
|
2905
2905
|
"inline_styles"
|
|
2906
2906
|
]),
|
|
2907
|
-
uiLibrary:
|
|
2908
|
-
enableUILibraryTheming:
|
|
2907
|
+
uiLibrary: P.enum(["mui", "antd", "radix", "shadcn"]).optional(),
|
|
2908
|
+
enableUILibraryTheming: P.boolean().optional(),
|
|
2909
|
+
enableCompactStructure: P.boolean().optional()
|
|
2909
2910
|
}),
|
|
2910
|
-
|
|
2911
|
-
framework:
|
|
2912
|
-
styling:
|
|
2913
|
-
enableTranslation:
|
|
2911
|
+
P.object({
|
|
2912
|
+
framework: P.literal("html"),
|
|
2913
|
+
styling: P.enum(["plain_css", "inline_styles"]),
|
|
2914
|
+
enableTranslation: P.boolean().optional()
|
|
2914
2915
|
})
|
|
2915
2916
|
])
|
|
2916
2917
|
), Es = (n) => {
|
|
@@ -2921,31 +2922,31 @@ const Ss = V.object({
|
|
|
2921
2922
|
}
|
|
2922
2923
|
return e.data;
|
|
2923
2924
|
};
|
|
2924
|
-
var
|
|
2925
|
-
class
|
|
2925
|
+
var W, He;
|
|
2926
|
+
class Zr {
|
|
2926
2927
|
constructor({
|
|
2927
2928
|
auth: e,
|
|
2928
2929
|
apiBaseAddress: t = "https://public-api.animaapp.com"
|
|
2929
2930
|
} = {}) {
|
|
2930
|
-
it(this,
|
|
2931
|
+
it(this, W);
|
|
2931
2932
|
it(this, He);
|
|
2932
2933
|
ot(this, He, t), e && (this.auth = e);
|
|
2933
2934
|
}
|
|
2934
2935
|
hasAuth() {
|
|
2935
|
-
return !!X(this,
|
|
2936
|
+
return !!X(this, W);
|
|
2936
2937
|
}
|
|
2937
2938
|
set auth(e) {
|
|
2938
|
-
ot(this,
|
|
2939
|
+
ot(this, W, e);
|
|
2939
2940
|
}
|
|
2940
2941
|
get headers() {
|
|
2941
2942
|
const e = {
|
|
2942
2943
|
"Content-Type": "application/json"
|
|
2943
2944
|
};
|
|
2944
|
-
return X(this,
|
|
2945
|
+
return X(this, W) && (e.Authorization = `Bearer ${X(this, W).token}`, "teamId" in X(this, W) && (e["X-Team-Id"] = X(this, W).teamId), "userId" in X(this, W) && X(this, W).userId && (e["X-User-Id"] = X(this, W).userId)), e;
|
|
2945
2946
|
}
|
|
2946
2947
|
generateCode(s) {
|
|
2947
|
-
return
|
|
2948
|
-
var
|
|
2948
|
+
return $(this, arguments, function* (e, t = {}) {
|
|
2949
|
+
var f, _, C, A, O, R, q;
|
|
2949
2950
|
if (this.hasAuth() === !1)
|
|
2950
2951
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
2951
2952
|
const r = {}, a = Es(e.settings), i = yield fetch(`${X(this, He)}/v1/codegen`, {
|
|
@@ -2964,7 +2965,8 @@ class jr {
|
|
|
2964
2965
|
styling: a.styling,
|
|
2965
2966
|
uiLibrary: a.uiLibrary,
|
|
2966
2967
|
enableTranslation: a.enableTranslation,
|
|
2967
|
-
enableUILibraryTheming: a.enableUILibraryTheming
|
|
2968
|
+
enableUILibraryTheming: a.enableUILibraryTheming,
|
|
2969
|
+
enableCompactStructure: a.enableCompactStructure
|
|
2968
2970
|
})
|
|
2969
2971
|
});
|
|
2970
2972
|
if (!i.ok) {
|
|
@@ -3007,11 +3009,11 @@ class jr {
|
|
|
3007
3009
|
}
|
|
3008
3010
|
switch (T.type) {
|
|
3009
3011
|
case "start": {
|
|
3010
|
-
r.sessionId = T.sessionId, typeof t == "function" ? t(T) : (
|
|
3012
|
+
r.sessionId = T.sessionId, typeof t == "function" ? t(T) : (f = t.onStart) == null || f.call(t, { sessionId: T.sessionId });
|
|
3011
3013
|
break;
|
|
3012
3014
|
}
|
|
3013
3015
|
case "pre_codegen": {
|
|
3014
|
-
typeof t == "function" ? t(T) : (
|
|
3016
|
+
typeof t == "function" ? t(T) : (_ = t.onPreCodegen) == null || _.call(t, { message: T.message });
|
|
3015
3017
|
break;
|
|
3016
3018
|
}
|
|
3017
3019
|
case "assets_uploaded": {
|
|
@@ -3052,7 +3054,7 @@ class jr {
|
|
|
3052
3054
|
name: "Invalid response",
|
|
3053
3055
|
reason: "No files found"
|
|
3054
3056
|
});
|
|
3055
|
-
return r;
|
|
3057
|
+
return r.tokenUsage = T.payload.tokenUsage, r;
|
|
3056
3058
|
}
|
|
3057
3059
|
}
|
|
3058
3060
|
}
|
|
@@ -3068,8 +3070,8 @@ class jr {
|
|
|
3068
3070
|
});
|
|
3069
3071
|
}
|
|
3070
3072
|
}
|
|
3071
|
-
|
|
3072
|
-
const
|
|
3073
|
+
W = new WeakMap(), He = new WeakMap();
|
|
3074
|
+
const Mr = (n) => {
|
|
3073
3075
|
var e;
|
|
3074
3076
|
if (!n)
|
|
3075
3077
|
return [!1, "", ""];
|
|
@@ -3082,65 +3084,114 @@ const Ir = (n) => {
|
|
|
3082
3084
|
} catch (t) {
|
|
3083
3085
|
return [!1, "", ""];
|
|
3084
3086
|
}
|
|
3085
|
-
},
|
|
3087
|
+
}, $r = ({
|
|
3086
3088
|
fileKey: n,
|
|
3087
3089
|
nodeId: e
|
|
3088
3090
|
}) => {
|
|
3089
3091
|
const t = new URL("https://www.figma.com");
|
|
3090
3092
|
return t.pathname = `design/${n}`, e && t.searchParams.set("node-id", e.replace(":", "-")), t;
|
|
3091
3093
|
};
|
|
3092
|
-
class
|
|
3094
|
+
class Pr extends Error {
|
|
3093
3095
|
constructor(e, t) {
|
|
3094
3096
|
super(e), this.response = t;
|
|
3095
3097
|
}
|
|
3096
3098
|
}
|
|
3099
|
+
const Fr = ({
|
|
3100
|
+
files: n,
|
|
3101
|
+
screenPath: e = "src/screens"
|
|
3102
|
+
}) => {
|
|
3103
|
+
const t = {}, s = /* @__PURE__ */ new Set();
|
|
3104
|
+
function r(a) {
|
|
3105
|
+
if (s.has(a) || !n[a])
|
|
3106
|
+
return;
|
|
3107
|
+
s.add(a), t[a] = n[a], As(n[a].content).forEach((o) => {
|
|
3108
|
+
try {
|
|
3109
|
+
const c = Os(a, o);
|
|
3110
|
+
if (c.startsWith("src/")) {
|
|
3111
|
+
const u = c.split("/").slice(0, -1).join("/");
|
|
3112
|
+
Cs(n, u).forEach((_) => {
|
|
3113
|
+
s.has(_) || r(_);
|
|
3114
|
+
});
|
|
3115
|
+
}
|
|
3116
|
+
} catch (c) {
|
|
3117
|
+
console.warn(
|
|
3118
|
+
`Failed to resolve import ${o} in ${a}:`,
|
|
3119
|
+
c
|
|
3120
|
+
);
|
|
3121
|
+
}
|
|
3122
|
+
});
|
|
3123
|
+
}
|
|
3124
|
+
return Object.entries(n).forEach(([a, i]) => {
|
|
3125
|
+
a.startsWith(e) ? r(a) : a.startsWith("src/") || (t[a] = i);
|
|
3126
|
+
}), t;
|
|
3127
|
+
};
|
|
3128
|
+
function As(n) {
|
|
3129
|
+
const e = /import.*?["']([^"']+)["']/g, t = /export.*from\s+["']([^"']+)["']/g, s = [];
|
|
3130
|
+
let r;
|
|
3131
|
+
for (; (r = e.exec(n)) !== null; )
|
|
3132
|
+
s.push(r[1]);
|
|
3133
|
+
for (; (r = t.exec(n)) !== null; )
|
|
3134
|
+
s.push(r[1]);
|
|
3135
|
+
return [...new Set(s)];
|
|
3136
|
+
}
|
|
3137
|
+
function Os(n, e) {
|
|
3138
|
+
if (!e.startsWith("."))
|
|
3139
|
+
return e;
|
|
3140
|
+
const t = n.split("/").slice(0, -1), s = e.split("/"), r = [...t];
|
|
3141
|
+
for (const a of s)
|
|
3142
|
+
a === ".." ? r.pop() : a !== "." && r.push(a);
|
|
3143
|
+
return r.join("/");
|
|
3144
|
+
}
|
|
3145
|
+
function Cs(n, e) {
|
|
3146
|
+
return Object.keys(n).filter((t) => t.startsWith(e));
|
|
3147
|
+
}
|
|
3097
3148
|
const nn = "Figma Token Issue";
|
|
3098
|
-
class
|
|
3149
|
+
class Is extends Error {
|
|
3099
3150
|
constructor({ fileKey: e, reason: t }) {
|
|
3100
3151
|
super(nn), this.fileKey = e, this.reason = t;
|
|
3101
3152
|
}
|
|
3102
3153
|
}
|
|
3103
3154
|
const sn = "Rate Limit Exceeded";
|
|
3104
|
-
class
|
|
3155
|
+
class Ns extends Error {
|
|
3105
3156
|
constructor({ fileKey: e }) {
|
|
3106
3157
|
super(sn), this.fileKey = e;
|
|
3107
3158
|
}
|
|
3108
3159
|
}
|
|
3109
3160
|
const rn = "Not Found";
|
|
3110
|
-
class
|
|
3161
|
+
class js extends Error {
|
|
3111
3162
|
constructor({ fileKey: e }) {
|
|
3112
3163
|
super(rn), this.fileKey = e;
|
|
3113
3164
|
}
|
|
3114
3165
|
}
|
|
3115
|
-
const
|
|
3116
|
-
class
|
|
3166
|
+
const Rs = (n) => n.message === rn, an = "Unknown Figma API Exception";
|
|
3167
|
+
class Zs extends Error {
|
|
3117
3168
|
constructor({ fileKey: e, cause: t }) {
|
|
3118
3169
|
super(an), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = t;
|
|
3119
3170
|
}
|
|
3120
3171
|
}
|
|
3121
|
-
const
|
|
3172
|
+
const Lr = (n) => n.message === an, Ms = (n) => n.message === sn, $s = (n) => [nn, ...[
|
|
3122
3173
|
"Invalid Figma token",
|
|
3123
3174
|
"Figma token expired"
|
|
3124
3175
|
]].includes(
|
|
3125
3176
|
n.message
|
|
3126
|
-
),
|
|
3177
|
+
), Ps = (n, e) => {
|
|
3127
3178
|
var s, r, a, i;
|
|
3128
3179
|
const t = ((s = n == null ? void 0 : n.cause) == null ? void 0 : s.body) || n.body;
|
|
3129
|
-
throw (t == null ? void 0 : t.status) === 403 ? new
|
|
3180
|
+
throw (t == null ? void 0 : t.status) === 403 ? new Is({
|
|
3130
3181
|
fileKey: e,
|
|
3131
3182
|
reason: (((a = (r = n == null ? void 0 : n.cause) == null ? void 0 : r.body) == null ? void 0 : a.reason) || ((i = n.body) == null ? void 0 : i.reason) || "Access denied").toString()
|
|
3132
|
-
}) : (t == null ? void 0 : t.status) === 429 ? new
|
|
3133
|
-
},
|
|
3134
|
-
var
|
|
3183
|
+
}) : (t == null ? void 0 : t.status) === 429 ? new Ns({ fileKey: e }) : (t == null ? void 0 : t.status) === 404 ? new js({ fileKey: e }) : new Zs({ fileKey: e, cause: n });
|
|
3184
|
+
}, Dr = (n) => Rs(n) ? "NotFound" : Ms(n) ? "RateLimitExceeded" : $s(n) ? "FigmaTokenIssue" : "UnknownFigmaApiException";
|
|
3185
|
+
var Fs = Object.defineProperty, Ls = Object.defineProperties, Ds = Object.getOwnPropertyDescriptors, Ft = Object.getOwnPropertySymbols, Vs = Object.prototype.hasOwnProperty, Us = Object.prototype.propertyIsEnumerable, Lt = (n, e) => (e = Symbol[n]) ? e : Symbol.for("Symbol." + n), on = (n) => {
|
|
3135
3186
|
throw TypeError(n);
|
|
3136
|
-
},
|
|
3187
|
+
}, Dt = (n, e, t) => e in n ? Fs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, V = (n, e) => {
|
|
3137
3188
|
for (var t in e || (e = {}))
|
|
3138
|
-
|
|
3139
|
-
if (
|
|
3140
|
-
for (var t of
|
|
3141
|
-
|
|
3189
|
+
Vs.call(e, t) && Dt(n, t, e[t]);
|
|
3190
|
+
if (Ft)
|
|
3191
|
+
for (var t of Ft(e))
|
|
3192
|
+
Us.call(e, t) && Dt(n, t, e[t]);
|
|
3142
3193
|
return n;
|
|
3143
|
-
}, Et = (n, e) =>
|
|
3194
|
+
}, Et = (n, e) => Ls(n, Ds(e)), At = (n, e, t) => e.has(n) || on("Cannot " + t), k = (n, e, t) => (At(n, e, "read from private field"), t ? t.call(n) : e.get(n)), B = (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), N = (n, e, t, s) => (At(n, e, "write to private field"), e.set(n, t), t), ee = (n, e, t) => (At(n, e, "access private method"), t), E = (n, e, t) => new Promise((s, r) => {
|
|
3144
3195
|
var a = (c) => {
|
|
3145
3196
|
try {
|
|
3146
3197
|
o(t.next(c));
|
|
@@ -3155,59 +3206,59 @@ var Ms = Object.defineProperty, Ps = Object.defineProperties, $s = Object.getOwn
|
|
|
3155
3206
|
}
|
|
3156
3207
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
3157
3208
|
o((t = t.apply(n, e)).next());
|
|
3158
|
-
}),
|
|
3159
|
-
function
|
|
3209
|
+
}), zs = (n, e, t) => (e = n[Lt("asyncIterator")]) ? e.call(n) : (n = n[Lt("iterator")](), e = {}, t = (s, r) => (r = n[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = r.call(n, a), c = a.done, Promise.resolve(a.value).then((u) => i({ value: u, done: c }), o)))), t("next"), t("return"), e), Ws = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
3210
|
+
function Bs(n) {
|
|
3160
3211
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
3161
3212
|
}
|
|
3162
|
-
var yt = { exports: {} },
|
|
3163
|
-
function
|
|
3164
|
-
return
|
|
3213
|
+
var yt = { exports: {} }, qs = yt.exports, Vt;
|
|
3214
|
+
function Hs() {
|
|
3215
|
+
return Vt || (Vt = 1, function(n, e) {
|
|
3165
3216
|
(function(t, s) {
|
|
3166
3217
|
n.exports = s();
|
|
3167
|
-
})(
|
|
3168
|
-
var t = typeof Promise == "function", s = typeof self == "object" ? self :
|
|
3169
|
-
function Ct(
|
|
3170
|
-
var
|
|
3171
|
-
if (
|
|
3172
|
-
return
|
|
3173
|
-
if (
|
|
3218
|
+
})(qs, function() {
|
|
3219
|
+
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", u = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined", C = i && typeof Set.prototype.entries == "function", A = a && typeof Map.prototype.entries == "function", O = C && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), R = A && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), q = f && typeof Array.prototype[Symbol.iterator] == "function", z = q && Object.getPrototypeOf([][Symbol.iterator]()), re = f && typeof String.prototype[Symbol.iterator] == "function", L = re && Object.getPrototypeOf(""[Symbol.iterator]()), K = 8, T = -1;
|
|
3220
|
+
function Ct(I) {
|
|
3221
|
+
var It = typeof I;
|
|
3222
|
+
if (It !== "object")
|
|
3223
|
+
return It;
|
|
3224
|
+
if (I === null)
|
|
3174
3225
|
return "null";
|
|
3175
|
-
if (
|
|
3226
|
+
if (I === s)
|
|
3176
3227
|
return "global";
|
|
3177
|
-
if (Array.isArray(
|
|
3228
|
+
if (Array.isArray(I) && (_ === !1 || !(Symbol.toStringTag in I)))
|
|
3178
3229
|
return "Array";
|
|
3179
3230
|
if (typeof window == "object" && window !== null) {
|
|
3180
|
-
if (typeof window.location == "object" &&
|
|
3231
|
+
if (typeof window.location == "object" && I === window.location)
|
|
3181
3232
|
return "Location";
|
|
3182
|
-
if (typeof window.document == "object" &&
|
|
3233
|
+
if (typeof window.document == "object" && I === window.document)
|
|
3183
3234
|
return "Document";
|
|
3184
3235
|
if (typeof window.navigator == "object") {
|
|
3185
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
3236
|
+
if (typeof window.navigator.mimeTypes == "object" && I === window.navigator.mimeTypes)
|
|
3186
3237
|
return "MimeTypeArray";
|
|
3187
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
3238
|
+
if (typeof window.navigator.plugins == "object" && I === window.navigator.plugins)
|
|
3188
3239
|
return "PluginArray";
|
|
3189
3240
|
}
|
|
3190
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
3191
|
-
if (
|
|
3241
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && I instanceof window.HTMLElement) {
|
|
3242
|
+
if (I.tagName === "BLOCKQUOTE")
|
|
3192
3243
|
return "HTMLQuoteElement";
|
|
3193
|
-
if (
|
|
3244
|
+
if (I.tagName === "TD")
|
|
3194
3245
|
return "HTMLTableDataCellElement";
|
|
3195
|
-
if (
|
|
3246
|
+
if (I.tagName === "TH")
|
|
3196
3247
|
return "HTMLTableHeaderCellElement";
|
|
3197
3248
|
}
|
|
3198
3249
|
}
|
|
3199
|
-
var
|
|
3200
|
-
if (typeof
|
|
3201
|
-
return
|
|
3202
|
-
var D = Object.getPrototypeOf(
|
|
3203
|
-
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" : u && D === DataView.prototype ? "DataView" : a && D === R ? "Map Iterator" : i && D === O ? "Set Iterator" : q && D === z ? "Array Iterator" : re && D === L ? "String Iterator" : D === null ? "Object" : Object.prototype.toString.call(
|
|
3250
|
+
var Nt = _ && I[Symbol.toStringTag];
|
|
3251
|
+
if (typeof Nt == "string")
|
|
3252
|
+
return Nt;
|
|
3253
|
+
var D = Object.getPrototypeOf(I);
|
|
3254
|
+
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" : u && D === DataView.prototype ? "DataView" : a && D === R ? "Map Iterator" : i && D === O ? "Set Iterator" : q && D === z ? "Array Iterator" : re && D === L ? "String Iterator" : D === null ? "Object" : Object.prototype.toString.call(I).slice(K, T);
|
|
3204
3255
|
}
|
|
3205
3256
|
return Ct;
|
|
3206
3257
|
});
|
|
3207
3258
|
}(yt)), yt.exports;
|
|
3208
3259
|
}
|
|
3209
|
-
var
|
|
3210
|
-
const
|
|
3260
|
+
var Js = Hs();
|
|
3261
|
+
const Gs = /* @__PURE__ */ Bs(Js), Ot = typeof Buffer != "undefined", Ks = Ot && typeof Buffer.from != "undefined", Xs = Ot ? (
|
|
3211
3262
|
/**
|
|
3212
3263
|
* is value is Buffer?
|
|
3213
3264
|
*
|
|
@@ -3228,7 +3279,7 @@ const qs = /* @__PURE__ */ Us(Ws), Ot = typeof Buffer != "undefined", Hs = Ot &&
|
|
|
3228
3279
|
function() {
|
|
3229
3280
|
return !1;
|
|
3230
3281
|
}
|
|
3231
|
-
),
|
|
3282
|
+
), Ys = Ks ? (
|
|
3232
3283
|
/**
|
|
3233
3284
|
* copy Buffer
|
|
3234
3285
|
*
|
|
@@ -3264,16 +3315,16 @@ const qs = /* @__PURE__ */ Us(Ws), Ot = typeof Buffer != "undefined", Hs = Ot &&
|
|
|
3264
3315
|
}
|
|
3265
3316
|
);
|
|
3266
3317
|
function Ee(n) {
|
|
3267
|
-
return
|
|
3318
|
+
return Xs(n) ? "Buffer" : Gs(n);
|
|
3268
3319
|
}
|
|
3269
|
-
const
|
|
3320
|
+
const Qs = /* @__PURE__ */ new Set([
|
|
3270
3321
|
"Arguments",
|
|
3271
3322
|
"Array",
|
|
3272
3323
|
"Map",
|
|
3273
3324
|
"Object",
|
|
3274
3325
|
"Set"
|
|
3275
3326
|
]);
|
|
3276
|
-
function
|
|
3327
|
+
function er(n, e, t = null) {
|
|
3277
3328
|
switch (t || Ee(n)) {
|
|
3278
3329
|
case "Arguments":
|
|
3279
3330
|
case "Array":
|
|
@@ -3286,7 +3337,7 @@ function Xs(n, e, t = null) {
|
|
|
3286
3337
|
}
|
|
3287
3338
|
}
|
|
3288
3339
|
function gt(n) {
|
|
3289
|
-
return
|
|
3340
|
+
return Qs.has(n);
|
|
3290
3341
|
}
|
|
3291
3342
|
function Ut(n, e, t, s = null) {
|
|
3292
3343
|
switch (s || Ee(n)) {
|
|
@@ -3304,29 +3355,29 @@ function Ut(n, e, t, s = null) {
|
|
|
3304
3355
|
}
|
|
3305
3356
|
return n;
|
|
3306
3357
|
}
|
|
3307
|
-
const
|
|
3308
|
-
function
|
|
3358
|
+
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")();
|
|
3359
|
+
function rr(n) {
|
|
3309
3360
|
return n.slice(0);
|
|
3310
3361
|
}
|
|
3311
|
-
function
|
|
3362
|
+
function ar(n) {
|
|
3312
3363
|
return new Boolean(n.valueOf());
|
|
3313
3364
|
}
|
|
3314
|
-
function
|
|
3365
|
+
function ir(n) {
|
|
3315
3366
|
return new DataView(n.buffer);
|
|
3316
3367
|
}
|
|
3317
|
-
function
|
|
3318
|
-
return
|
|
3368
|
+
function or(n) {
|
|
3369
|
+
return Ys(n);
|
|
3319
3370
|
}
|
|
3320
|
-
function
|
|
3371
|
+
function cr(n) {
|
|
3321
3372
|
return new Date(n.getTime());
|
|
3322
3373
|
}
|
|
3323
|
-
function
|
|
3374
|
+
function dr(n) {
|
|
3324
3375
|
return new Number(n);
|
|
3325
3376
|
}
|
|
3326
|
-
function
|
|
3377
|
+
function ur(n) {
|
|
3327
3378
|
return new RegExp(n.source, n.flags);
|
|
3328
3379
|
}
|
|
3329
|
-
function
|
|
3380
|
+
function lr(n) {
|
|
3330
3381
|
return new String(n);
|
|
3331
3382
|
}
|
|
3332
3383
|
function ae(n, e) {
|
|
@@ -3338,25 +3389,25 @@ function Z(n) {
|
|
|
3338
3389
|
function zt() {
|
|
3339
3390
|
return [];
|
|
3340
3391
|
}
|
|
3341
|
-
function
|
|
3392
|
+
function fr() {
|
|
3342
3393
|
return /* @__PURE__ */ new Map();
|
|
3343
3394
|
}
|
|
3344
|
-
function
|
|
3395
|
+
function hr() {
|
|
3345
3396
|
return {};
|
|
3346
3397
|
}
|
|
3347
|
-
function
|
|
3398
|
+
function pr() {
|
|
3348
3399
|
return /* @__PURE__ */ new Set();
|
|
3349
3400
|
}
|
|
3350
|
-
const
|
|
3401
|
+
const mr = /* @__PURE__ */ new Map([
|
|
3351
3402
|
// deep copy
|
|
3352
|
-
["ArrayBuffer",
|
|
3353
|
-
["Boolean",
|
|
3354
|
-
["Buffer",
|
|
3355
|
-
["DataView",
|
|
3356
|
-
["Date",
|
|
3357
|
-
["Number",
|
|
3358
|
-
["RegExp",
|
|
3359
|
-
["String",
|
|
3403
|
+
["ArrayBuffer", rr],
|
|
3404
|
+
["Boolean", ar],
|
|
3405
|
+
["Buffer", or],
|
|
3406
|
+
["DataView", ir],
|
|
3407
|
+
["Date", cr],
|
|
3408
|
+
["Number", dr],
|
|
3409
|
+
["RegExp", ur],
|
|
3410
|
+
["String", lr],
|
|
3360
3411
|
// typed arrays
|
|
3361
3412
|
// TODO: pass bound function
|
|
3362
3413
|
["Float32Array", ae],
|
|
@@ -3390,9 +3441,9 @@ const fr = /* @__PURE__ */ new Map([
|
|
|
3390
3441
|
// NOTE: return empty value, because recursively copy later.
|
|
3391
3442
|
["Arguments", zt],
|
|
3392
3443
|
["Array", zt],
|
|
3393
|
-
["Map",
|
|
3394
|
-
["Object",
|
|
3395
|
-
["Set",
|
|
3444
|
+
["Map", fr],
|
|
3445
|
+
["Object", hr],
|
|
3446
|
+
["Set", pr]
|
|
3396
3447
|
// NOTE: type-detect returns following types
|
|
3397
3448
|
// 'Location'
|
|
3398
3449
|
// 'Document'
|
|
@@ -3404,11 +3455,11 @@ const fr = /* @__PURE__ */ new Map([
|
|
|
3404
3455
|
// TODO: is type-detect never return 'object'?
|
|
3405
3456
|
// 'object'
|
|
3406
3457
|
]);
|
|
3407
|
-
function
|
|
3458
|
+
function yr() {
|
|
3408
3459
|
}
|
|
3409
|
-
function
|
|
3460
|
+
function vt(n, e = null, t = yr) {
|
|
3410
3461
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
3411
|
-
const s = e || Ee(n), r =
|
|
3462
|
+
const s = e || Ee(n), r = mr.get(s);
|
|
3412
3463
|
if (s === "Object") {
|
|
3413
3464
|
const a = t(n, s);
|
|
3414
3465
|
if (a !== void 0)
|
|
@@ -3427,12 +3478,12 @@ function Oe(n, e = {}) {
|
|
|
3427
3478
|
// depth = Infinity,
|
|
3428
3479
|
} = e, s = Ee(n);
|
|
3429
3480
|
if (!gt(s))
|
|
3430
|
-
return
|
|
3431
|
-
const r =
|
|
3432
|
-
return
|
|
3481
|
+
return _t(n, null, null, null);
|
|
3482
|
+
const r = vt(n, s, t), a = new WeakMap([[n, r]]), i = new WeakSet([n]);
|
|
3483
|
+
return _t(n, r, a, i);
|
|
3433
3484
|
}
|
|
3434
|
-
function
|
|
3435
|
-
const a = Ee(n), i =
|
|
3485
|
+
function _t(n, e, t, s, r) {
|
|
3486
|
+
const a = Ee(n), i = vt(n, a);
|
|
3436
3487
|
if (!gt(a))
|
|
3437
3488
|
return i;
|
|
3438
3489
|
let o;
|
|
@@ -3450,17 +3501,17 @@ function vt(n, e, t, s, r) {
|
|
|
3450
3501
|
break;
|
|
3451
3502
|
}
|
|
3452
3503
|
for (let c of o) {
|
|
3453
|
-
const u =
|
|
3504
|
+
const u = er(n, c, a);
|
|
3454
3505
|
if (s.has(u))
|
|
3455
3506
|
Ut(e, c, t.get(u), a);
|
|
3456
3507
|
else {
|
|
3457
|
-
const
|
|
3458
|
-
gt(
|
|
3508
|
+
const f = Ee(u), _ = vt(u, f);
|
|
3509
|
+
gt(f) && (t.set(u, _), s.add(u)), Ut(
|
|
3459
3510
|
e,
|
|
3460
3511
|
c,
|
|
3461
|
-
|
|
3512
|
+
_t(
|
|
3462
3513
|
u,
|
|
3463
|
-
|
|
3514
|
+
_,
|
|
3464
3515
|
t,
|
|
3465
3516
|
s
|
|
3466
3517
|
),
|
|
@@ -3470,21 +3521,21 @@ function vt(n, e, t, s, r) {
|
|
|
3470
3521
|
}
|
|
3471
3522
|
return e;
|
|
3472
3523
|
}
|
|
3473
|
-
const
|
|
3524
|
+
const gr = (n) => new Promise((e) => setTimeout(e, n));
|
|
3474
3525
|
var Ge, pe, Ke, bt, cn;
|
|
3475
|
-
class
|
|
3526
|
+
class vr {
|
|
3476
3527
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
3477
|
-
|
|
3528
|
+
B(this, bt), B(this, Ge), B(this, pe), B(this, Ke), N(this, Ge, e), N(this, Ke, t), N(this, pe, 0);
|
|
3478
3529
|
}
|
|
3479
3530
|
run() {
|
|
3480
3531
|
return E(this, null, function* () {
|
|
3481
3532
|
try {
|
|
3482
3533
|
return yield k(this, Ke).call(this);
|
|
3483
3534
|
} catch (e) {
|
|
3484
|
-
if (
|
|
3535
|
+
if (N(this, pe, k(this, pe) + 1), k(this, pe) > k(this, Ge))
|
|
3485
3536
|
throw console.error("Max attempts reached"), e;
|
|
3486
3537
|
const t = ee(this, bt, cn).call(this);
|
|
3487
|
-
return yield
|
|
3538
|
+
return yield gr(t), yield this.run();
|
|
3488
3539
|
}
|
|
3489
3540
|
});
|
|
3490
3541
|
}
|
|
@@ -3492,14 +3543,14 @@ class mr {
|
|
|
3492
3543
|
Ge = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap(), Ke = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakSet(), cn = function() {
|
|
3493
3544
|
return k(this, pe) * 1e3 * 1.5;
|
|
3494
3545
|
};
|
|
3495
|
-
function
|
|
3546
|
+
function _r() {
|
|
3496
3547
|
return typeof CompressionStream != "undefined";
|
|
3497
3548
|
}
|
|
3498
|
-
function
|
|
3549
|
+
function br(n) {
|
|
3499
3550
|
return E(this, null, function* () {
|
|
3500
3551
|
const e = new Blob([n]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
3501
3552
|
try {
|
|
3502
|
-
for (var s =
|
|
3553
|
+
for (var s = zs(e), r, a, i; r = !(a = yield s.next()).done; r = !1) {
|
|
3503
3554
|
const o = a.value;
|
|
3504
3555
|
t.push(o);
|
|
3505
3556
|
}
|
|
@@ -3513,23 +3564,23 @@ function gr(n) {
|
|
|
3513
3564
|
throw i[0];
|
|
3514
3565
|
}
|
|
3515
3566
|
}
|
|
3516
|
-
return yield
|
|
3567
|
+
return yield wr(t);
|
|
3517
3568
|
});
|
|
3518
3569
|
}
|
|
3519
|
-
function
|
|
3570
|
+
function wr(n) {
|
|
3520
3571
|
return E(this, null, function* () {
|
|
3521
3572
|
const e = yield new Blob(n).arrayBuffer();
|
|
3522
3573
|
return new Uint8Array(e);
|
|
3523
3574
|
});
|
|
3524
3575
|
}
|
|
3525
|
-
class
|
|
3576
|
+
class xr extends Error {
|
|
3526
3577
|
constructor({ resource: e, api: t, args: s, cause: r }) {
|
|
3527
3578
|
if (super(`API Error on resource "${e}" at api "${t}"`), this.causeProperties = {}, this.name = "API Error", this.resource = e, this.api = t, this.cause = r, this.args = s, r instanceof Error)
|
|
3528
3579
|
for (const [i, o] of Object.entries(r))
|
|
3529
3580
|
if (typeof Headers != "undefined" && o instanceof Headers) {
|
|
3530
3581
|
const c = {};
|
|
3531
|
-
o.forEach((u,
|
|
3532
|
-
c[
|
|
3582
|
+
o.forEach((u, f) => {
|
|
3583
|
+
c[f] = u;
|
|
3533
3584
|
}), this.causeProperties[i] = c;
|
|
3534
3585
|
} else
|
|
3535
3586
|
this.causeProperties[i] = o;
|
|
@@ -3537,7 +3588,7 @@ class vr extends Error {
|
|
|
3537
3588
|
a && typeof a == "object" && "code" in a && (this.code = a.code);
|
|
3538
3589
|
}
|
|
3539
3590
|
}
|
|
3540
|
-
class
|
|
3591
|
+
class Wt extends Error {
|
|
3541
3592
|
constructor({
|
|
3542
3593
|
url: e,
|
|
3543
3594
|
method: t,
|
|
@@ -3555,13 +3606,13 @@ class Bt extends Error {
|
|
|
3555
3606
|
}
|
|
3556
3607
|
}
|
|
3557
3608
|
}
|
|
3558
|
-
class
|
|
3609
|
+
class Ne extends Error {
|
|
3559
3610
|
constructor(e = {}) {
|
|
3560
3611
|
const { canceled: t = !1 } = e;
|
|
3561
3612
|
super("Abort Error"), this.name = "Abort Error", this.canceled = t;
|
|
3562
3613
|
}
|
|
3563
3614
|
}
|
|
3564
|
-
class
|
|
3615
|
+
class kr extends Error {
|
|
3565
3616
|
constructor(e) {
|
|
3566
3617
|
super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
|
|
3567
3618
|
}
|
|
@@ -3580,11 +3631,11 @@ function dn() {
|
|
|
3580
3631
|
function wt() {
|
|
3581
3632
|
return Math.floor(Date.now() / 1e3).toString();
|
|
3582
3633
|
}
|
|
3583
|
-
const
|
|
3584
|
-
var me,
|
|
3585
|
-
class
|
|
3634
|
+
const Tr = 5 * 60 * 1e3, Sr = 1 * 1e3;
|
|
3635
|
+
var me, F, Y, xt, kt, je;
|
|
3636
|
+
class Er {
|
|
3586
3637
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
3587
|
-
|
|
3638
|
+
B(this, Y), B(this, me), B(this, F), this.baseAddress = t, N(this, me, e), N(this, F, {}), this.plugins = [];
|
|
3588
3639
|
}
|
|
3589
3640
|
get headers() {
|
|
3590
3641
|
throw new Error("Missing implementation");
|
|
@@ -3596,87 +3647,87 @@ class kr {
|
|
|
3596
3647
|
this.plugins = this.plugins.filter((t) => t.name !== e);
|
|
3597
3648
|
}
|
|
3598
3649
|
withOptions(e = {}) {
|
|
3599
|
-
return
|
|
3650
|
+
return N(this, F, e), this;
|
|
3600
3651
|
}
|
|
3601
3652
|
get(e) {
|
|
3602
3653
|
return E(this, arguments, function* (t, s = {}) {
|
|
3603
3654
|
const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
|
|
3604
3655
|
let o = a != null ? a : this.headers;
|
|
3605
|
-
const c = Oe(k(this,
|
|
3606
|
-
return
|
|
3656
|
+
const c = Oe(k(this, F));
|
|
3657
|
+
return N(this, F, {}), c.extraHeaders && (o = V(V({}, o), c.extraHeaders)), c.requestValidation && (o = Et(V({}, o), { "X-Request-Nonce": dn(), "X-Request-Timestamp": wt() })), c.async ? yield ee(this, Y, kt).call(this, `${i}${t}`, c.async, { headers: o }) : yield ee(this, Y, xt).call(this, `${i}${t}`, c, { headers: o });
|
|
3607
3658
|
});
|
|
3608
3659
|
}
|
|
3609
3660
|
post(e, t) {
|
|
3610
3661
|
return E(this, arguments, function* (s, r, a = {}) {
|
|
3611
|
-
const i = Oe(k(this,
|
|
3612
|
-
return
|
|
3662
|
+
const i = Oe(k(this, F));
|
|
3663
|
+
return N(this, F, {}), ee(this, Y, je).call(this, s, "POST", r, a, i);
|
|
3613
3664
|
});
|
|
3614
3665
|
}
|
|
3615
3666
|
put(e, t) {
|
|
3616
3667
|
return E(this, arguments, function* (s, r, a = {}) {
|
|
3617
|
-
const i = Oe(k(this,
|
|
3618
|
-
return
|
|
3668
|
+
const i = Oe(k(this, F));
|
|
3669
|
+
return N(this, F, {}), ee(this, Y, je).call(this, s, "PUT", r, a, i);
|
|
3619
3670
|
});
|
|
3620
3671
|
}
|
|
3621
3672
|
delete(e, t) {
|
|
3622
3673
|
return E(this, arguments, function* (s, r, a = {}) {
|
|
3623
|
-
const i = Oe(k(this,
|
|
3624
|
-
return
|
|
3674
|
+
const i = Oe(k(this, F));
|
|
3675
|
+
return N(this, F, {}), ee(this, Y, je).call(this, s, "DELETE", r, a, i);
|
|
3625
3676
|
});
|
|
3626
3677
|
}
|
|
3627
3678
|
patch(e, t) {
|
|
3628
3679
|
return E(this, arguments, function* (s, r, a = {}) {
|
|
3629
|
-
const i = Oe(k(this,
|
|
3630
|
-
return
|
|
3680
|
+
const i = Oe(k(this, F));
|
|
3681
|
+
return N(this, F, {}), ee(this, Y, je).call(this, s, "PATCH", r, a, i);
|
|
3631
3682
|
});
|
|
3632
3683
|
}
|
|
3633
3684
|
}
|
|
3634
|
-
me = /* @__PURE__ */ new WeakMap(),
|
|
3685
|
+
me = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakSet(), xt = function(n, e, t) {
|
|
3635
3686
|
return E(this, null, function* () {
|
|
3636
3687
|
const s = () => E(this, null, function* () {
|
|
3637
3688
|
var c, u;
|
|
3638
3689
|
try {
|
|
3639
|
-
return yield k(this, me).call(this, n,
|
|
3640
|
-
} catch (
|
|
3641
|
-
throw
|
|
3690
|
+
return yield k(this, me).call(this, n, V(V({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
3691
|
+
} catch (f) {
|
|
3692
|
+
throw f instanceof Error && f.name === "AbortError" ? new Ne({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : f;
|
|
3642
3693
|
}
|
|
3643
3694
|
}), { headers: r } = t != null ? t : {}, a = (c, u) => {
|
|
3644
|
-
var
|
|
3645
|
-
return ((
|
|
3695
|
+
var f, _;
|
|
3696
|
+
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(u)) || ((_ = c == null ? void 0 : c.headersObject) == null ? void 0 : _[u]) || "";
|
|
3646
3697
|
}, i = (c) => E(this, null, function* () {
|
|
3647
3698
|
var u;
|
|
3648
3699
|
if (!c.ok) {
|
|
3649
|
-
const
|
|
3650
|
-
throw new
|
|
3700
|
+
const _ = yield c.text().catch();
|
|
3701
|
+
throw new Wt({
|
|
3651
3702
|
url: n,
|
|
3652
3703
|
method: (u = t == null ? void 0 : t.method) != null ? u : "GET",
|
|
3653
3704
|
statusCode: c.status,
|
|
3654
3705
|
requestHeaders: r,
|
|
3655
3706
|
responseHeaders: c.headers,
|
|
3656
|
-
body:
|
|
3707
|
+
body: _
|
|
3657
3708
|
});
|
|
3658
3709
|
}
|
|
3659
3710
|
if (e.requestValidation && process.env.UI_TESTS !== !0)
|
|
3660
3711
|
try {
|
|
3661
|
-
const
|
|
3662
|
-
if (!
|
|
3712
|
+
const _ = a(c, "x-response-nonce"), C = r == null ? void 0 : r["X-Request-Nonce"];
|
|
3713
|
+
if (!_ || _ !== C)
|
|
3663
3714
|
throw new ut("Response nonce mismatch");
|
|
3664
3715
|
const A = Number(a(c, "x-response-timestamp")), O = Number(wt()), R = 60 * 60 * 24;
|
|
3665
3716
|
if (isNaN(A) || Math.abs(O - A) > R)
|
|
3666
3717
|
throw new ut("Invalid response timestamp");
|
|
3667
|
-
} catch (
|
|
3668
|
-
const C =
|
|
3718
|
+
} catch (_) {
|
|
3719
|
+
const C = _ instanceof Error ? _.message : "Request validation failed";
|
|
3669
3720
|
throw new ut(C);
|
|
3670
3721
|
}
|
|
3671
|
-
let
|
|
3722
|
+
let f = yield c.text();
|
|
3672
3723
|
try {
|
|
3673
|
-
|
|
3674
|
-
} catch (
|
|
3724
|
+
f = JSON.parse(f);
|
|
3725
|
+
} catch (_) {
|
|
3675
3726
|
}
|
|
3676
|
-
return
|
|
3727
|
+
return f;
|
|
3677
3728
|
});
|
|
3678
3729
|
if (e.retry) {
|
|
3679
|
-
const c = yield new
|
|
3730
|
+
const c = yield new vr({
|
|
3680
3731
|
maxAttempts: e.retry,
|
|
3681
3732
|
func: s
|
|
3682
3733
|
}).run();
|
|
@@ -3691,27 +3742,27 @@ me = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3691
3742
|
const {
|
|
3692
3743
|
onProgress: a,
|
|
3693
3744
|
abortSignal: i,
|
|
3694
|
-
pollingInterval: o = () =>
|
|
3695
|
-
maxTimeout: c =
|
|
3696
|
-
} = e, u = `${n}/async`,
|
|
3697
|
-
let
|
|
3745
|
+
pollingInterval: o = () => Sr,
|
|
3746
|
+
maxTimeout: c = Tr
|
|
3747
|
+
} = e, u = `${n}/async`, f = `${n}/async/job`;
|
|
3748
|
+
let _;
|
|
3698
3749
|
try {
|
|
3699
|
-
|
|
3750
|
+
_ = yield k(this, me).call(this, u, V(V({}, t), i && { signal: i }));
|
|
3700
3751
|
} catch (O) {
|
|
3701
|
-
throw O instanceof Error && O.name === "AbortError" ? new
|
|
3752
|
+
throw O instanceof Error && O.name === "AbortError" ? new Ne({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : O;
|
|
3702
3753
|
}
|
|
3703
|
-
if (!
|
|
3704
|
-
const O = yield
|
|
3705
|
-
throw new
|
|
3754
|
+
if (!_.ok) {
|
|
3755
|
+
const O = yield _.text().catch();
|
|
3756
|
+
throw new Wt({
|
|
3706
3757
|
url: n,
|
|
3707
3758
|
method: (r = t == null ? void 0 : t.method) != null ? r : "GET",
|
|
3708
|
-
statusCode:
|
|
3759
|
+
statusCode: _.status,
|
|
3709
3760
|
requestHeaders: this.headers,
|
|
3710
|
-
responseHeaders:
|
|
3761
|
+
responseHeaders: _.headers,
|
|
3711
3762
|
body: O
|
|
3712
3763
|
});
|
|
3713
3764
|
}
|
|
3714
|
-
const C = yield
|
|
3765
|
+
const C = yield _.json(), { job_id: A } = C;
|
|
3715
3766
|
if (!A)
|
|
3716
3767
|
throw new Error("Job ID not found in response");
|
|
3717
3768
|
return new Promise((O, R) => E(this, null, function* () {
|
|
@@ -3719,21 +3770,21 @@ me = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3719
3770
|
R(new Error("Job timed out"));
|
|
3720
3771
|
}, c), z = (re = 0) => E(this, null, function* () {
|
|
3721
3772
|
if (i != null && i.aborted) {
|
|
3722
|
-
clearTimeout(q), k(this, me).call(this, `${
|
|
3723
|
-
R(new
|
|
3773
|
+
clearTimeout(q), k(this, me).call(this, `${f}/${A}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
3774
|
+
R(new Ne({ canceled: !0 }));
|
|
3724
3775
|
}).catch((L) => {
|
|
3725
|
-
R(new
|
|
3776
|
+
R(new Ne({ canceled: !1 }));
|
|
3726
3777
|
});
|
|
3727
3778
|
return;
|
|
3728
3779
|
}
|
|
3729
3780
|
try {
|
|
3730
|
-
const L = yield (yield k(this, me).call(this, `${
|
|
3781
|
+
const L = yield (yield k(this, me).call(this, `${f}/${A}`, { headers: this.headers })).json();
|
|
3731
3782
|
if (L.status === "success") {
|
|
3732
3783
|
clearTimeout(q);
|
|
3733
3784
|
const K = L.response_json;
|
|
3734
3785
|
O(K);
|
|
3735
3786
|
} else if (L.status === "failed")
|
|
3736
|
-
clearTimeout(q), R(new
|
|
3787
|
+
clearTimeout(q), R(new kr(L.response_json));
|
|
3737
3788
|
else {
|
|
3738
3789
|
a && a(L.response_json);
|
|
3739
3790
|
const K = o(re);
|
|
@@ -3746,20 +3797,20 @@ me = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
3746
3797
|
z();
|
|
3747
3798
|
}));
|
|
3748
3799
|
});
|
|
3749
|
-
},
|
|
3800
|
+
}, je = function(n, e, t, s, r) {
|
|
3750
3801
|
return E(this, null, function* () {
|
|
3751
3802
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
3752
3803
|
let c = i != null ? i : this.headers;
|
|
3753
|
-
r.extraHeaders && (c =
|
|
3804
|
+
r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c = Et(V({}, c), { "X-Request-Nonce": dn(), "X-Request-Timestamp": wt() }));
|
|
3754
3805
|
let u = s.skipBodyJsonStringify ? t : JSON.stringify(t);
|
|
3755
|
-
return r.compress &&
|
|
3806
|
+
return r.compress && _r() && (c["Content-Encoding"] = "gzip", u = yield br(u)), r.async ? yield ee(this, Y, kt).call(this, `${o}${n}`, r.async, {
|
|
3756
3807
|
method: e,
|
|
3757
3808
|
headers: c,
|
|
3758
3809
|
body: u
|
|
3759
3810
|
}) : yield ee(this, Y, xt).call(this, `${o}${n}`, r, { method: e, headers: c, body: u });
|
|
3760
3811
|
});
|
|
3761
3812
|
};
|
|
3762
|
-
const
|
|
3813
|
+
const Bt = (n, e, t, s) => n instanceof Ne ? n : new xr({ resource: e, api: String(t), args: s, cause: n }), lt = (n, e) => new Proxy(e, {
|
|
3763
3814
|
get(t, s) {
|
|
3764
3815
|
return (...r) => {
|
|
3765
3816
|
var a;
|
|
@@ -3772,22 +3823,22 @@ const Wt = (n, e, t, s) => n instanceof je ? n : new vr({ resource: e, api: Stri
|
|
|
3772
3823
|
try {
|
|
3773
3824
|
i = t[s](...r);
|
|
3774
3825
|
} catch (o) {
|
|
3775
|
-
throw
|
|
3826
|
+
throw Bt(o, t.resourceName, s, r);
|
|
3776
3827
|
}
|
|
3777
3828
|
return i instanceof Promise ? i.catch((o) => {
|
|
3778
|
-
throw
|
|
3829
|
+
throw Bt(o, t.resourceName, s, r);
|
|
3779
3830
|
}) : i;
|
|
3780
3831
|
};
|
|
3781
3832
|
}
|
|
3782
3833
|
});
|
|
3783
3834
|
var Re;
|
|
3784
|
-
class
|
|
3835
|
+
class Ar {
|
|
3785
3836
|
constructor(e) {
|
|
3786
|
-
|
|
3837
|
+
B(this, Re), this.resourceName = "Files", N(this, Re, e);
|
|
3787
3838
|
}
|
|
3788
3839
|
get(e) {
|
|
3789
3840
|
return E(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
3790
|
-
const r = new URLSearchParams(
|
|
3841
|
+
const r = new URLSearchParams(V({
|
|
3791
3842
|
plugin_data: "857346721138427857"
|
|
3792
3843
|
}, s)).toString(), a = `v1/files/${t}?${r}`;
|
|
3793
3844
|
return yield k(this, Re).get(a);
|
|
@@ -3802,14 +3853,14 @@ class Tr {
|
|
|
3802
3853
|
}
|
|
3803
3854
|
}
|
|
3804
3855
|
Re = /* @__PURE__ */ new WeakMap();
|
|
3805
|
-
const
|
|
3856
|
+
const Or = (n, e, t) => {
|
|
3806
3857
|
const s = e.sort();
|
|
3807
3858
|
return `${n}-${s.join("-")}-${t}`;
|
|
3808
|
-
},
|
|
3859
|
+
}, Cr = (n) => n ? n.ts > Date.now() - 1e3 * 30 : !1;
|
|
3809
3860
|
var Q, Tt, un;
|
|
3810
|
-
class
|
|
3861
|
+
class Ir {
|
|
3811
3862
|
constructor(e) {
|
|
3812
|
-
|
|
3863
|
+
B(this, Tt), B(this, Q), this.resourceName = "Images", N(this, Q, e);
|
|
3813
3864
|
}
|
|
3814
3865
|
/**
|
|
3815
3866
|
* Return the URL for the _layer_ images for the given nodes.
|
|
@@ -3817,8 +3868,8 @@ class Ar {
|
|
|
3817
3868
|
*/
|
|
3818
3869
|
get(e) {
|
|
3819
3870
|
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, format: r = "jpg", scale: a }) {
|
|
3820
|
-
const i =
|
|
3821
|
-
if (
|
|
3871
|
+
const i = Or(t, s, r), o = k(this, Q).cache.images.entries.get(i);
|
|
3872
|
+
if (Cr(o))
|
|
3822
3873
|
return o.result;
|
|
3823
3874
|
o && k(this, Q).cache.images.entries.delete(i);
|
|
3824
3875
|
const c = k(this, Q).cache.images.pendingRequests.get(i);
|
|
@@ -3846,15 +3897,15 @@ Q = /* @__PURE__ */ new WeakMap(), Tt = /* @__PURE__ */ new WeakSet(), un = func
|
|
|
3846
3897
|
});
|
|
3847
3898
|
};
|
|
3848
3899
|
var Xe;
|
|
3849
|
-
class
|
|
3900
|
+
class Nr {
|
|
3850
3901
|
constructor(e) {
|
|
3851
|
-
|
|
3902
|
+
B(this, Xe), this.resourceName = "Nodes", N(this, Xe, e);
|
|
3852
3903
|
}
|
|
3853
3904
|
get(e) {
|
|
3854
3905
|
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, params: r = {} }) {
|
|
3855
|
-
const a = Et(
|
|
3906
|
+
const a = Et(V({}, r), {
|
|
3856
3907
|
ids: s.join(",")
|
|
3857
|
-
}), i = new URLSearchParams(
|
|
3908
|
+
}), i = new URLSearchParams(V({
|
|
3858
3909
|
plugin_data: "857346721138427857"
|
|
3859
3910
|
}, a)).toString(), o = `v1/files/${t}/nodes?${i}`;
|
|
3860
3911
|
return yield k(this, Xe).get(o);
|
|
@@ -3863,22 +3914,22 @@ class Or {
|
|
|
3863
3914
|
}
|
|
3864
3915
|
Xe = /* @__PURE__ */ new WeakMap();
|
|
3865
3916
|
var de;
|
|
3866
|
-
class ln extends
|
|
3917
|
+
class ln extends Er {
|
|
3867
3918
|
constructor({
|
|
3868
3919
|
baseAddress: e = "https://api.figma.com/",
|
|
3869
3920
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
3870
3921
|
} = {}) {
|
|
3871
|
-
super({ fetch: t, baseAddress: e }),
|
|
3922
|
+
super({ fetch: t, baseAddress: e }), B(this, de, ""), this.cache = {
|
|
3872
3923
|
images: {
|
|
3873
3924
|
entries: /* @__PURE__ */ new Map(),
|
|
3874
3925
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
3875
3926
|
}
|
|
3876
|
-
}, this.files = lt(this, new
|
|
3927
|
+
}, this.files = lt(this, new Ar(this)), this.nodes = lt(this, new Nr(this)), this.images = lt(this, new Ir(this));
|
|
3877
3928
|
}
|
|
3878
3929
|
set token(e) {
|
|
3879
3930
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
3880
3931
|
throw new Error("Invalid Figma access token");
|
|
3881
|
-
|
|
3932
|
+
N(this, de, e);
|
|
3882
3933
|
}
|
|
3883
3934
|
get token() {
|
|
3884
3935
|
return k(this, de);
|
|
@@ -3891,7 +3942,7 @@ class ln extends kr {
|
|
|
3891
3942
|
}
|
|
3892
3943
|
}
|
|
3893
3944
|
de = /* @__PURE__ */ new WeakMap();
|
|
3894
|
-
const
|
|
3945
|
+
const Vr = (r) => $(void 0, [r], function* ({
|
|
3895
3946
|
fileKey: n,
|
|
3896
3947
|
authToken: e,
|
|
3897
3948
|
figmaRestApi: t = new ln(),
|
|
@@ -3906,7 +3957,7 @@ const $r = (r) => P(void 0, [r], function* ({
|
|
|
3906
3957
|
} catch (a) {
|
|
3907
3958
|
throw console.error(a), a;
|
|
3908
3959
|
}
|
|
3909
|
-
}),
|
|
3960
|
+
}), Ur = (a) => $(void 0, [a], function* ({
|
|
3910
3961
|
fileKey: n,
|
|
3911
3962
|
authToken: e,
|
|
3912
3963
|
nodeIds: t,
|
|
@@ -3921,9 +3972,9 @@ const $r = (r) => P(void 0, [r], function* ({
|
|
|
3921
3972
|
params: d({}, r)
|
|
3922
3973
|
})).nodes;
|
|
3923
3974
|
} catch (i) {
|
|
3924
|
-
return
|
|
3975
|
+
return Ps(i, n);
|
|
3925
3976
|
}
|
|
3926
|
-
}),
|
|
3977
|
+
}), jr = (n, e) => new ReadableStream({
|
|
3927
3978
|
start(t) {
|
|
3928
3979
|
n.generateCode(e, (s) => {
|
|
3929
3980
|
s.type === "error" ? (console.log("NOT SURE IF THIS IS REACHABLE, ALL ERRORS ARE THROWING"), t.enqueue({
|
|
@@ -3931,7 +3982,13 @@ const $r = (r) => P(void 0, [r], function* ({
|
|
|
3931
3982
|
payload: { message: s.payload.reason }
|
|
3932
3983
|
})) : t.enqueue(s), (s.type === "aborted" || s.type === "error") && t.close();
|
|
3933
3984
|
}).then((s) => {
|
|
3934
|
-
t.enqueue({
|
|
3985
|
+
t.enqueue({
|
|
3986
|
+
type: "done",
|
|
3987
|
+
payload: {
|
|
3988
|
+
tokenUsage: s.tokenUsage,
|
|
3989
|
+
sessionId: s.sessionId
|
|
3990
|
+
}
|
|
3991
|
+
}), t.close();
|
|
3935
3992
|
}).catch((s) => {
|
|
3936
3993
|
t.enqueue({
|
|
3937
3994
|
type: "error",
|
|
@@ -3942,12 +3999,12 @@ const $r = (r) => P(void 0, [r], function* ({
|
|
|
3942
3999
|
}), t.close();
|
|
3943
4000
|
});
|
|
3944
4001
|
}
|
|
3945
|
-
}),
|
|
3946
|
-
var c, u,
|
|
3947
|
-
const t =
|
|
3948
|
-
if (a.done || !a.value || ((c = a.value) == null ? void 0 : c.type) === "error" && ((
|
|
4002
|
+
}), zr = (n, e) => $(void 0, null, function* () {
|
|
4003
|
+
var c, u, f, _, C, A, O;
|
|
4004
|
+
const t = jr(n, e), [s, r] = t.tee(), a = yield s.getReader().read();
|
|
4005
|
+
if (a.done || !a.value || ((c = a.value) == null ? void 0 : c.type) === "error" && ((f = (u = a.value) == null ? void 0 : u.payload) != null && f.status))
|
|
3949
4006
|
return new Response(JSON.stringify(a.value), {
|
|
3950
|
-
status: ((
|
|
4007
|
+
status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (O = (A = (C = a.value) == null ? void 0 : C.payload) == null ? void 0 : A.status) != null ? O : 500,
|
|
3951
4008
|
headers: {
|
|
3952
4009
|
"Content-Type": "application/json"
|
|
3953
4010
|
}
|
|
@@ -3975,25 +4032,26 @@ data: ${JSON.stringify(
|
|
|
3975
4032
|
});
|
|
3976
4033
|
});
|
|
3977
4034
|
export {
|
|
3978
|
-
|
|
4035
|
+
Zr as Anima,
|
|
3979
4036
|
Ae as CodegenError,
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
4037
|
+
Is as FigmaTokenIssue,
|
|
4038
|
+
js as NotFound,
|
|
4039
|
+
Ns as RateLimitExceeded,
|
|
4040
|
+
Pr as ResponseError,
|
|
4041
|
+
Zs as UnknownFigmaApiException,
|
|
4042
|
+
zr as createCodegenResponseEventStream,
|
|
4043
|
+
jr as createCodegenStream,
|
|
4044
|
+
$r as formatToFigmaLink,
|
|
4045
|
+
Dr as getFigmaApiErrorType,
|
|
4046
|
+
Vr as getFigmaFile,
|
|
4047
|
+
Ur as getFileNodes,
|
|
4048
|
+
Fr as getRelatedScreenFiles,
|
|
4049
|
+
Ps as handleFigmaApiError,
|
|
4050
|
+
$s as isFigmaTokenIssue,
|
|
4051
|
+
Rs as isNotFound,
|
|
4052
|
+
Ms as isRateLimitExceeded,
|
|
4053
|
+
Lr as isUnknownFigmaApiException,
|
|
4054
|
+
Mr as isValidFigmaUrl,
|
|
3997
4055
|
Es as validateSettings
|
|
3998
4056
|
};
|
|
3999
4057
|
//# sourceMappingURL=index.js.map
|