@animaapp/anima-sdk 0.6.32 → 0.6.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +248 -248
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var Ss = Object.prototype.hasOwnProperty, Es = Object.prototype.propertyIsEnumer
|
|
|
5
5
|
var Lt = (s) => {
|
|
6
6
|
throw TypeError(s);
|
|
7
7
|
};
|
|
8
|
-
var Dt = (s, e, t) => e in s ? xs(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t,
|
|
8
|
+
var Dt = (s, e, t) => e in s ? xs(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, u = (s, e) => {
|
|
9
9
|
for (var t in e || (e = {}))
|
|
10
10
|
Ss.call(e, t) && Dt(s, t, e[t]);
|
|
11
11
|
if (Ft)
|
|
@@ -19,14 +19,14 @@ var I = (s, e, t) => new Promise((r, n) => {
|
|
|
19
19
|
var a = (c) => {
|
|
20
20
|
try {
|
|
21
21
|
o(t.next(c));
|
|
22
|
-
} catch (
|
|
23
|
-
n(
|
|
22
|
+
} catch (d) {
|
|
23
|
+
n(d);
|
|
24
24
|
}
|
|
25
25
|
}, i = (c) => {
|
|
26
26
|
try {
|
|
27
27
|
o(t.throw(c));
|
|
28
|
-
} catch (
|
|
29
|
-
n(
|
|
28
|
+
} catch (d) {
|
|
29
|
+
n(d);
|
|
30
30
|
}
|
|
31
31
|
}, o = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(a, i);
|
|
32
32
|
o((t = t.apply(s, e)).next());
|
|
@@ -112,18 +112,18 @@ var Ps = Object.defineProperty, $s = Object.defineProperties, Fs = Object.getOwn
|
|
|
112
112
|
var a = (c) => {
|
|
113
113
|
try {
|
|
114
114
|
o(t.next(c));
|
|
115
|
-
} catch (
|
|
116
|
-
n(
|
|
115
|
+
} catch (d) {
|
|
116
|
+
n(d);
|
|
117
117
|
}
|
|
118
118
|
}, i = (c) => {
|
|
119
119
|
try {
|
|
120
120
|
o(t.throw(c));
|
|
121
|
-
} catch (
|
|
122
|
-
n(
|
|
121
|
+
} catch (d) {
|
|
122
|
+
n(d);
|
|
123
123
|
}
|
|
124
124
|
}, o = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(a, i);
|
|
125
125
|
o((t = t.apply(s, e)).next());
|
|
126
|
-
}), Vs = (s, e, t) => (e = s[Ut("asyncIterator")]) ? e.call(s) : (s = s[Ut("iterator")](), e = {}, t = (r, n) => (n = s[r]) && (e[r] = (a) => new Promise((i, o, c) => (a = n.call(s, a), c = a.done, Promise.resolve(a.value).then((
|
|
126
|
+
}), Vs = (s, e, t) => (e = s[Ut("asyncIterator")]) ? e.call(s) : (s = s[Ut("iterator")](), e = {}, t = (r, n) => (n = s[r]) && (e[r] = (a) => new Promise((i, o, c) => (a = n.call(s, a), c = a.done, Promise.resolve(a.value).then((d) => i({ value: d, done: c }), o)))), t("next"), t("return"), e), Us = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
127
127
|
function Ws(s) {
|
|
128
128
|
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
|
|
129
129
|
}
|
|
@@ -133,7 +133,7 @@ function Bs() {
|
|
|
133
133
|
(function(t, r) {
|
|
134
134
|
s.exports = r();
|
|
135
135
|
})(zs, function() {
|
|
136
|
-
var t = typeof Promise == "function", r = typeof self == "object" ? self : Us, n = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined",
|
|
136
|
+
var t = typeof Promise == "function", r = typeof self == "object" ? self : Us, n = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = n && typeof Symbol.iterator != "undefined", v = n && typeof Symbol.toStringTag != "undefined", j = i && typeof Set.prototype.entries == "function", M = a && typeof Map.prototype.entries == "function", F = j && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), W = M && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), ee = f && typeof Array.prototype[Symbol.iterator] == "function", he = ee && Object.getPrototypeOf([][Symbol.iterator]()), ie = f && typeof String.prototype[Symbol.iterator] == "function", L = ie && Object.getPrototypeOf(""[Symbol.iterator]()), oe = 8, et = -1;
|
|
137
137
|
function xe(E) {
|
|
138
138
|
var ke = typeof E;
|
|
139
139
|
if (ke !== "object")
|
|
@@ -168,7 +168,7 @@ function Bs() {
|
|
|
168
168
|
if (typeof pe == "string")
|
|
169
169
|
return pe;
|
|
170
170
|
var b = Object.getPrototypeOf(E);
|
|
171
|
-
return b === RegExp.prototype ? "RegExp" : b === Date.prototype ? "Date" : t && b === Promise.prototype ? "Promise" : i && b === Set.prototype ? "Set" : a && b === Map.prototype ? "Map" : c && b === WeakSet.prototype ? "WeakSet" : o && b === WeakMap.prototype ? "WeakMap" :
|
|
171
|
+
return b === RegExp.prototype ? "RegExp" : b === Date.prototype ? "Date" : t && b === Promise.prototype ? "Promise" : i && b === Set.prototype ? "Set" : a && b === Map.prototype ? "Map" : c && b === WeakSet.prototype ? "WeakSet" : o && b === WeakMap.prototype ? "WeakMap" : d && b === DataView.prototype ? "DataView" : a && b === W ? "Map Iterator" : i && b === F ? "Set Iterator" : ee && b === he ? "Array Iterator" : ie && b === L ? "String Iterator" : b === null ? "Object" : Object.prototype.toString.call(E).slice(oe, et);
|
|
172
172
|
}
|
|
173
173
|
return xe;
|
|
174
174
|
});
|
|
@@ -294,7 +294,7 @@ function or(s) {
|
|
|
294
294
|
function cr(s) {
|
|
295
295
|
return new RegExp(s.source, s.flags);
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function dr(s) {
|
|
298
298
|
return new String(s);
|
|
299
299
|
}
|
|
300
300
|
function te(s, e) {
|
|
@@ -306,7 +306,7 @@ function P(s) {
|
|
|
306
306
|
function qt() {
|
|
307
307
|
return [];
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function ur() {
|
|
310
310
|
return /* @__PURE__ */ new Map();
|
|
311
311
|
}
|
|
312
312
|
function lr() {
|
|
@@ -324,7 +324,7 @@ const hr = /* @__PURE__ */ new Map([
|
|
|
324
324
|
["Date", ir],
|
|
325
325
|
["Number", or],
|
|
326
326
|
["RegExp", cr],
|
|
327
|
-
["String",
|
|
327
|
+
["String", dr],
|
|
328
328
|
// typed arrays
|
|
329
329
|
// TODO: pass bound function
|
|
330
330
|
["Float32Array", te],
|
|
@@ -358,7 +358,7 @@ const hr = /* @__PURE__ */ new Map([
|
|
|
358
358
|
// NOTE: return empty value, because recursively copy later.
|
|
359
359
|
["Arguments", qt],
|
|
360
360
|
["Array", qt],
|
|
361
|
-
["Map",
|
|
361
|
+
["Map", ur],
|
|
362
362
|
["Object", lr],
|
|
363
363
|
["Set", fr]
|
|
364
364
|
// NOTE: type-detect returns following types
|
|
@@ -418,16 +418,16 @@ function Tt(s, e, t, r, n) {
|
|
|
418
418
|
break;
|
|
419
419
|
}
|
|
420
420
|
for (let c of o) {
|
|
421
|
-
const
|
|
422
|
-
if (r.has(
|
|
423
|
-
Bt(e, c, t.get(
|
|
421
|
+
const d = Ys(s, c, a);
|
|
422
|
+
if (r.has(d))
|
|
423
|
+
Bt(e, c, t.get(d), a);
|
|
424
424
|
else {
|
|
425
|
-
const f = Ce(
|
|
426
|
-
xt(f) && (t.set(
|
|
425
|
+
const f = Ce(d), v = kt(d, f);
|
|
426
|
+
xt(f) && (t.set(d, v), r.add(d)), Bt(
|
|
427
427
|
e,
|
|
428
428
|
c,
|
|
429
429
|
Tt(
|
|
430
|
-
|
|
430
|
+
d,
|
|
431
431
|
v,
|
|
432
432
|
t,
|
|
433
433
|
r
|
|
@@ -496,8 +496,8 @@ class br extends Error {
|
|
|
496
496
|
for (const [i, o] of Object.entries(n))
|
|
497
497
|
if (typeof Headers != "undefined" && o instanceof Headers) {
|
|
498
498
|
const c = {};
|
|
499
|
-
o.forEach((
|
|
500
|
-
c[f] =
|
|
499
|
+
o.forEach((d, f) => {
|
|
500
|
+
c[f] = d;
|
|
501
501
|
}), this.causeProperties[i] = c;
|
|
502
502
|
} else
|
|
503
503
|
this.causeProperties[i] = o;
|
|
@@ -602,22 +602,22 @@ class Tr {
|
|
|
602
602
|
ye = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakSet(), At = function(s, e, t) {
|
|
603
603
|
return N(this, null, function* () {
|
|
604
604
|
const r = () => N(this, null, function* () {
|
|
605
|
-
var c,
|
|
605
|
+
var c, d;
|
|
606
606
|
try {
|
|
607
607
|
return yield S(this, ye).call(this, s, V(V({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
608
608
|
} catch (f) {
|
|
609
|
-
throw f instanceof Error && f.name === "AbortError" ? new Re({ canceled: (
|
|
609
|
+
throw f instanceof Error && f.name === "AbortError" ? new Re({ canceled: (d = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? d : !1 }) : f;
|
|
610
610
|
}
|
|
611
|
-
}), { headers: n } = t != null ? t : {}, a = (c,
|
|
611
|
+
}), { headers: n } = t != null ? t : {}, a = (c, d) => {
|
|
612
612
|
var f, v;
|
|
613
|
-
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(
|
|
613
|
+
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(d)) || ((v = c == null ? void 0 : c.headersObject) == null ? void 0 : v[d]) || "";
|
|
614
614
|
}, i = (c) => N(this, null, function* () {
|
|
615
|
-
var
|
|
615
|
+
var d;
|
|
616
616
|
if (!c.ok) {
|
|
617
617
|
const v = yield c.text().catch();
|
|
618
618
|
throw new Ht({
|
|
619
619
|
url: s,
|
|
620
|
-
method: (
|
|
620
|
+
method: (d = t == null ? void 0 : t.method) != null ? d : "GET",
|
|
621
621
|
statusCode: c.status,
|
|
622
622
|
requestHeaders: n,
|
|
623
623
|
responseHeaders: c.headers,
|
|
@@ -661,10 +661,10 @@ ye = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), J = /* @_
|
|
|
661
661
|
abortSignal: i,
|
|
662
662
|
pollingInterval: o = () => kr,
|
|
663
663
|
maxTimeout: c = xr
|
|
664
|
-
} = e,
|
|
664
|
+
} = e, d = `${s}/async`, f = `${s}/async/job`;
|
|
665
665
|
let v;
|
|
666
666
|
try {
|
|
667
|
-
v = yield S(this, ye).call(this,
|
|
667
|
+
v = yield S(this, ye).call(this, d, V(V({}, t), i && { signal: i }));
|
|
668
668
|
} catch (F) {
|
|
669
669
|
throw F instanceof Error && F.name === "AbortError" ? new Re({ canceled: (r = i == null ? void 0 : i.aborted) != null ? r : !1 }) : F;
|
|
670
670
|
}
|
|
@@ -719,12 +719,12 @@ ye = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), J = /* @_
|
|
|
719
719
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = r, o = a != null ? a : this.baseAddress;
|
|
720
720
|
let c = i != null ? i : this.headers;
|
|
721
721
|
n.extraHeaders && (c = V(V({}, c), n.extraHeaders)), n.requestValidation && (c = Zt(V({}, c), { "X-Request-Nonce": os(), "X-Request-Timestamp": Et() }));
|
|
722
|
-
let
|
|
723
|
-
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (
|
|
722
|
+
let d = t;
|
|
723
|
+
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (d = r.skipBodyJsonStringify ? t : JSON.stringify(t), n.compress && yr() && (c["Content-Encoding"] = "gzip", d = yield vr(d))), n.async ? yield K(this, J, Ct).call(this, `${o}${s}`, n.async, {
|
|
724
724
|
method: e,
|
|
725
725
|
headers: c,
|
|
726
|
-
body:
|
|
727
|
-
}) : yield K(this, J, At).call(this, `${o}${s}`, n, { method: e, headers: c, body:
|
|
726
|
+
body: d
|
|
727
|
+
}) : yield K(this, J, At).call(this, `${o}${s}`, n, { method: e, headers: c, body: d });
|
|
728
728
|
});
|
|
729
729
|
};
|
|
730
730
|
const Jt = (s, e, t, r) => s instanceof Re ? s : new br({ resource: e, api: String(t), args: r, cause: s }), _t = (s, e) => new Proxy(e, {
|
|
@@ -792,10 +792,10 @@ class Cr {
|
|
|
792
792
|
const c = S(this, G).cache.images.pendingRequests.get(i);
|
|
793
793
|
if (c)
|
|
794
794
|
return c;
|
|
795
|
-
const
|
|
796
|
-
S(this, G).cache.images.pendingRequests.set(i,
|
|
795
|
+
const d = K(this, It, cs).call(this, i, t, r, n, a);
|
|
796
|
+
S(this, G).cache.images.pendingRequests.set(i, d);
|
|
797
797
|
try {
|
|
798
|
-
return yield
|
|
798
|
+
return yield d;
|
|
799
799
|
} finally {
|
|
800
800
|
S(this, G).cache.images.pendingRequests.delete(i);
|
|
801
801
|
}
|
|
@@ -831,7 +831,7 @@ class Ir {
|
|
|
831
831
|
}
|
|
832
832
|
nt = /* @__PURE__ */ new WeakMap();
|
|
833
833
|
var ce;
|
|
834
|
-
class
|
|
834
|
+
class ds extends Tr {
|
|
835
835
|
constructor({
|
|
836
836
|
baseAddress: e = "https://api.figma.com/",
|
|
837
837
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
@@ -862,7 +862,7 @@ ce = /* @__PURE__ */ new WeakMap();
|
|
|
862
862
|
const Or = (a) => I(void 0, [a], function* ({
|
|
863
863
|
fileKey: s,
|
|
864
864
|
authToken: e,
|
|
865
|
-
figmaRestApi: t = new
|
|
865
|
+
figmaRestApi: t = new ds(),
|
|
866
866
|
params: r = {},
|
|
867
867
|
signal: n
|
|
868
868
|
}) {
|
|
@@ -881,7 +881,7 @@ const Or = (a) => I(void 0, [a], function* ({
|
|
|
881
881
|
fileKey: s,
|
|
882
882
|
authToken: e,
|
|
883
883
|
nodeIds: t,
|
|
884
|
-
figmaRestApi: r = new
|
|
884
|
+
figmaRestApi: r = new ds(),
|
|
885
885
|
params: n = {},
|
|
886
886
|
signal: a
|
|
887
887
|
}) {
|
|
@@ -892,17 +892,17 @@ const Or = (a) => I(void 0, [a], function* ({
|
|
|
892
892
|
}).nodes.get({
|
|
893
893
|
fileKey: s,
|
|
894
894
|
nodeIds: t,
|
|
895
|
-
params:
|
|
895
|
+
params: u({}, n)
|
|
896
896
|
})).nodes;
|
|
897
897
|
} catch (o) {
|
|
898
898
|
throw o instanceof Error && o.name === "AbortError" ? o : ns(o, s);
|
|
899
899
|
}
|
|
900
|
-
}),
|
|
900
|
+
}), us = (s, e) => {
|
|
901
901
|
if (s.id === e)
|
|
902
902
|
return s;
|
|
903
903
|
if ("children" in s)
|
|
904
904
|
for (const t of s.children) {
|
|
905
|
-
const r =
|
|
905
|
+
const r = us(t, e);
|
|
906
906
|
if (r)
|
|
907
907
|
return r;
|
|
908
908
|
}
|
|
@@ -946,7 +946,7 @@ var k;
|
|
|
946
946
|
})(k || (k = {}));
|
|
947
947
|
var Ot;
|
|
948
948
|
(function(s) {
|
|
949
|
-
s.mergeShapes = (e, t) =>
|
|
949
|
+
s.mergeShapes = (e, t) => u(u({}, e), t);
|
|
950
950
|
})(Ot || (Ot = {}));
|
|
951
951
|
const p = k.arrayToEnum([
|
|
952
952
|
"string",
|
|
@@ -1037,8 +1037,8 @@ class U extends Error {
|
|
|
1037
1037
|
else {
|
|
1038
1038
|
let o = r, c = 0;
|
|
1039
1039
|
for (; c < i.path.length; ) {
|
|
1040
|
-
const
|
|
1041
|
-
c === i.path.length - 1 ? (o[
|
|
1040
|
+
const d = i.path[c];
|
|
1041
|
+
c === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(t(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], c++;
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
1044
1044
|
};
|
|
@@ -1132,19 +1132,19 @@ function at() {
|
|
|
1132
1132
|
return ls;
|
|
1133
1133
|
}
|
|
1134
1134
|
const it = (s) => {
|
|
1135
|
-
const { data: e, path: t, errorMaps: r, issueData: n } = s, a = [...t, ...n.path || []], i = g(
|
|
1135
|
+
const { data: e, path: t, errorMaps: r, issueData: n } = s, a = [...t, ...n.path || []], i = g(u({}, n), {
|
|
1136
1136
|
path: a
|
|
1137
1137
|
});
|
|
1138
1138
|
if (n.message !== void 0)
|
|
1139
|
-
return g(
|
|
1139
|
+
return g(u({}, n), {
|
|
1140
1140
|
path: a,
|
|
1141
1141
|
message: n.message
|
|
1142
1142
|
});
|
|
1143
1143
|
let o = "";
|
|
1144
|
-
const c = r.filter((
|
|
1145
|
-
for (const
|
|
1146
|
-
o =
|
|
1147
|
-
return g(
|
|
1144
|
+
const c = r.filter((d) => !!d).slice().reverse();
|
|
1145
|
+
for (const d of c)
|
|
1146
|
+
o = d(i, { data: e, defaultError: o }).message;
|
|
1147
|
+
return g(u({}, n), {
|
|
1148
1148
|
path: a,
|
|
1149
1149
|
message: o
|
|
1150
1150
|
});
|
|
@@ -1256,9 +1256,9 @@ function w(s) {
|
|
|
1256
1256
|
if (e && (t || r))
|
|
1257
1257
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
1258
1258
|
return e ? { errorMap: e, description: n } : { errorMap: (i, o) => {
|
|
1259
|
-
var c,
|
|
1259
|
+
var c, d;
|
|
1260
1260
|
const { message: f } = s;
|
|
1261
|
-
return i.code === "invalid_enum_value" ? { message: f != null ? f : o.defaultError } : typeof o.data == "undefined" ? { message: (c = f != null ? f : r) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (
|
|
1261
|
+
return i.code === "invalid_enum_value" ? { message: f != null ? f : o.defaultError } : typeof o.data == "undefined" ? { message: (c = f != null ? f : r) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (d = f != null ? f : t) !== null && d !== void 0 ? d : o.defaultError };
|
|
1262
1262
|
}, description: n };
|
|
1263
1263
|
}
|
|
1264
1264
|
class x {
|
|
@@ -1384,7 +1384,7 @@ class x {
|
|
|
1384
1384
|
refine(e, t) {
|
|
1385
1385
|
const r = (n) => typeof t == "string" || typeof t == "undefined" ? { message: t } : typeof t == "function" ? t(n) : t;
|
|
1386
1386
|
return this._refinement((n, a) => {
|
|
1387
|
-
const i = e(n), o = () => a.addIssue(
|
|
1387
|
+
const i = e(n), o = () => a.addIssue(u({
|
|
1388
1388
|
code: l.custom
|
|
1389
1389
|
}, r(n)));
|
|
1390
1390
|
return typeof Promise != "undefined" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
@@ -1432,7 +1432,7 @@ class x {
|
|
|
1432
1432
|
return ze.create(this, e, this._def);
|
|
1433
1433
|
}
|
|
1434
1434
|
transform(e) {
|
|
1435
|
-
return new H(g(
|
|
1435
|
+
return new H(g(u({}, w(this._def)), {
|
|
1436
1436
|
schema: this,
|
|
1437
1437
|
typeName: y.ZodEffects,
|
|
1438
1438
|
effect: { type: "transform", transform: e }
|
|
@@ -1440,21 +1440,21 @@ class x {
|
|
|
1440
1440
|
}
|
|
1441
1441
|
default(e) {
|
|
1442
1442
|
const t = typeof e == "function" ? e : () => e;
|
|
1443
|
-
return new Ge(g(
|
|
1443
|
+
return new Ge(g(u({}, w(this._def)), {
|
|
1444
1444
|
innerType: this,
|
|
1445
1445
|
defaultValue: t,
|
|
1446
1446
|
typeName: y.ZodDefault
|
|
1447
1447
|
}));
|
|
1448
1448
|
}
|
|
1449
1449
|
brand() {
|
|
1450
|
-
return new $t(
|
|
1450
|
+
return new $t(u({
|
|
1451
1451
|
typeName: y.ZodBranded,
|
|
1452
1452
|
type: this
|
|
1453
1453
|
}, w(this._def)));
|
|
1454
1454
|
}
|
|
1455
1455
|
catch(e) {
|
|
1456
1456
|
const t = typeof e == "function" ? e : () => e;
|
|
1457
|
-
return new Ke(g(
|
|
1457
|
+
return new Ke(g(u({}, w(this._def)), {
|
|
1458
1458
|
innerType: this,
|
|
1459
1459
|
catchValue: t,
|
|
1460
1460
|
typeName: y.ZodCatch
|
|
@@ -1462,7 +1462,7 @@ class x {
|
|
|
1462
1462
|
}
|
|
1463
1463
|
describe(e) {
|
|
1464
1464
|
const t = this.constructor;
|
|
1465
|
-
return new t(g(
|
|
1465
|
+
return new t(g(u({}, this._def), {
|
|
1466
1466
|
description: e
|
|
1467
1467
|
}));
|
|
1468
1468
|
}
|
|
@@ -1666,56 +1666,56 @@ class B extends x {
|
|
|
1666
1666
|
return { status: r.value, value: e.data };
|
|
1667
1667
|
}
|
|
1668
1668
|
_regex(e, t, r) {
|
|
1669
|
-
return this.refinement((n) => e.test(n),
|
|
1669
|
+
return this.refinement((n) => e.test(n), u({
|
|
1670
1670
|
validation: t,
|
|
1671
1671
|
code: l.invalid_string
|
|
1672
1672
|
}, m.errToObj(r)));
|
|
1673
1673
|
}
|
|
1674
1674
|
_addCheck(e) {
|
|
1675
|
-
return new B(g(
|
|
1675
|
+
return new B(g(u({}, this._def), {
|
|
1676
1676
|
checks: [...this._def.checks, e]
|
|
1677
1677
|
}));
|
|
1678
1678
|
}
|
|
1679
1679
|
email(e) {
|
|
1680
|
-
return this._addCheck(
|
|
1680
|
+
return this._addCheck(u({ kind: "email" }, m.errToObj(e)));
|
|
1681
1681
|
}
|
|
1682
1682
|
url(e) {
|
|
1683
|
-
return this._addCheck(
|
|
1683
|
+
return this._addCheck(u({ kind: "url" }, m.errToObj(e)));
|
|
1684
1684
|
}
|
|
1685
1685
|
emoji(e) {
|
|
1686
|
-
return this._addCheck(
|
|
1686
|
+
return this._addCheck(u({ kind: "emoji" }, m.errToObj(e)));
|
|
1687
1687
|
}
|
|
1688
1688
|
uuid(e) {
|
|
1689
|
-
return this._addCheck(
|
|
1689
|
+
return this._addCheck(u({ kind: "uuid" }, m.errToObj(e)));
|
|
1690
1690
|
}
|
|
1691
1691
|
nanoid(e) {
|
|
1692
|
-
return this._addCheck(
|
|
1692
|
+
return this._addCheck(u({ kind: "nanoid" }, m.errToObj(e)));
|
|
1693
1693
|
}
|
|
1694
1694
|
cuid(e) {
|
|
1695
|
-
return this._addCheck(
|
|
1695
|
+
return this._addCheck(u({ kind: "cuid" }, m.errToObj(e)));
|
|
1696
1696
|
}
|
|
1697
1697
|
cuid2(e) {
|
|
1698
|
-
return this._addCheck(
|
|
1698
|
+
return this._addCheck(u({ kind: "cuid2" }, m.errToObj(e)));
|
|
1699
1699
|
}
|
|
1700
1700
|
ulid(e) {
|
|
1701
|
-
return this._addCheck(
|
|
1701
|
+
return this._addCheck(u({ kind: "ulid" }, m.errToObj(e)));
|
|
1702
1702
|
}
|
|
1703
1703
|
base64(e) {
|
|
1704
|
-
return this._addCheck(
|
|
1704
|
+
return this._addCheck(u({ kind: "base64" }, m.errToObj(e)));
|
|
1705
1705
|
}
|
|
1706
1706
|
base64url(e) {
|
|
1707
|
-
return this._addCheck(
|
|
1707
|
+
return this._addCheck(u({
|
|
1708
1708
|
kind: "base64url"
|
|
1709
1709
|
}, m.errToObj(e)));
|
|
1710
1710
|
}
|
|
1711
1711
|
jwt(e) {
|
|
1712
|
-
return this._addCheck(
|
|
1712
|
+
return this._addCheck(u({ kind: "jwt" }, m.errToObj(e)));
|
|
1713
1713
|
}
|
|
1714
1714
|
ip(e) {
|
|
1715
|
-
return this._addCheck(
|
|
1715
|
+
return this._addCheck(u({ kind: "ip" }, m.errToObj(e)));
|
|
1716
1716
|
}
|
|
1717
1717
|
cidr(e) {
|
|
1718
|
-
return this._addCheck(
|
|
1718
|
+
return this._addCheck(u({ kind: "cidr" }, m.errToObj(e)));
|
|
1719
1719
|
}
|
|
1720
1720
|
datetime(e) {
|
|
1721
1721
|
var t, r;
|
|
@@ -1725,7 +1725,7 @@ class B extends x {
|
|
|
1725
1725
|
offset: !1,
|
|
1726
1726
|
local: !1,
|
|
1727
1727
|
message: e
|
|
1728
|
-
}) : this._addCheck(
|
|
1728
|
+
}) : this._addCheck(u({
|
|
1729
1729
|
kind: "datetime",
|
|
1730
1730
|
precision: typeof (e == null ? void 0 : e.precision) == "undefined" ? null : e == null ? void 0 : e.precision,
|
|
1731
1731
|
offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
|
|
@@ -1740,53 +1740,53 @@ class B extends x {
|
|
|
1740
1740
|
kind: "time",
|
|
1741
1741
|
precision: null,
|
|
1742
1742
|
message: e
|
|
1743
|
-
}) : this._addCheck(
|
|
1743
|
+
}) : this._addCheck(u({
|
|
1744
1744
|
kind: "time",
|
|
1745
1745
|
precision: typeof (e == null ? void 0 : e.precision) == "undefined" ? null : e == null ? void 0 : e.precision
|
|
1746
1746
|
}, m.errToObj(e == null ? void 0 : e.message)));
|
|
1747
1747
|
}
|
|
1748
1748
|
duration(e) {
|
|
1749
|
-
return this._addCheck(
|
|
1749
|
+
return this._addCheck(u({ kind: "duration" }, m.errToObj(e)));
|
|
1750
1750
|
}
|
|
1751
1751
|
regex(e, t) {
|
|
1752
|
-
return this._addCheck(
|
|
1752
|
+
return this._addCheck(u({
|
|
1753
1753
|
kind: "regex",
|
|
1754
1754
|
regex: e
|
|
1755
1755
|
}, m.errToObj(t)));
|
|
1756
1756
|
}
|
|
1757
1757
|
includes(e, t) {
|
|
1758
|
-
return this._addCheck(
|
|
1758
|
+
return this._addCheck(u({
|
|
1759
1759
|
kind: "includes",
|
|
1760
1760
|
value: e,
|
|
1761
1761
|
position: t == null ? void 0 : t.position
|
|
1762
1762
|
}, m.errToObj(t == null ? void 0 : t.message)));
|
|
1763
1763
|
}
|
|
1764
1764
|
startsWith(e, t) {
|
|
1765
|
-
return this._addCheck(
|
|
1765
|
+
return this._addCheck(u({
|
|
1766
1766
|
kind: "startsWith",
|
|
1767
1767
|
value: e
|
|
1768
1768
|
}, m.errToObj(t)));
|
|
1769
1769
|
}
|
|
1770
1770
|
endsWith(e, t) {
|
|
1771
|
-
return this._addCheck(
|
|
1771
|
+
return this._addCheck(u({
|
|
1772
1772
|
kind: "endsWith",
|
|
1773
1773
|
value: e
|
|
1774
1774
|
}, m.errToObj(t)));
|
|
1775
1775
|
}
|
|
1776
1776
|
min(e, t) {
|
|
1777
|
-
return this._addCheck(
|
|
1777
|
+
return this._addCheck(u({
|
|
1778
1778
|
kind: "min",
|
|
1779
1779
|
value: e
|
|
1780
1780
|
}, m.errToObj(t)));
|
|
1781
1781
|
}
|
|
1782
1782
|
max(e, t) {
|
|
1783
|
-
return this._addCheck(
|
|
1783
|
+
return this._addCheck(u({
|
|
1784
1784
|
kind: "max",
|
|
1785
1785
|
value: e
|
|
1786
1786
|
}, m.errToObj(t)));
|
|
1787
1787
|
}
|
|
1788
1788
|
length(e, t) {
|
|
1789
|
-
return this._addCheck(
|
|
1789
|
+
return this._addCheck(u({
|
|
1790
1790
|
kind: "length",
|
|
1791
1791
|
value: e
|
|
1792
1792
|
}, m.errToObj(t)));
|
|
@@ -1798,17 +1798,17 @@ class B extends x {
|
|
|
1798
1798
|
return this.min(1, m.errToObj(e));
|
|
1799
1799
|
}
|
|
1800
1800
|
trim() {
|
|
1801
|
-
return new B(g(
|
|
1801
|
+
return new B(g(u({}, this._def), {
|
|
1802
1802
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1803
1803
|
}));
|
|
1804
1804
|
}
|
|
1805
1805
|
toLowerCase() {
|
|
1806
|
-
return new B(g(
|
|
1806
|
+
return new B(g(u({}, this._def), {
|
|
1807
1807
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1808
1808
|
}));
|
|
1809
1809
|
}
|
|
1810
1810
|
toUpperCase() {
|
|
1811
|
-
return new B(g(
|
|
1811
|
+
return new B(g(u({}, this._def), {
|
|
1812
1812
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1813
1813
|
}));
|
|
1814
1814
|
}
|
|
@@ -1875,7 +1875,7 @@ class B extends x {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
B.create = (s) => {
|
|
1877
1877
|
var e;
|
|
1878
|
-
return new B(
|
|
1878
|
+
return new B(u({
|
|
1879
1879
|
checks: [],
|
|
1880
1880
|
typeName: y.ZodString,
|
|
1881
1881
|
coerce: (e = s == null ? void 0 : s.coerce) !== null && e !== void 0 ? e : !1
|
|
@@ -1885,7 +1885,7 @@ function en(s, e) {
|
|
|
1885
1885
|
const t = (s.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, n = t > r ? t : r, a = parseInt(s.toFixed(n).replace(".", "")), i = parseInt(e.toFixed(n).replace(".", ""));
|
|
1886
1886
|
return a % i / Math.pow(10, n);
|
|
1887
1887
|
}
|
|
1888
|
-
class
|
|
1888
|
+
class de extends x {
|
|
1889
1889
|
constructor() {
|
|
1890
1890
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1891
1891
|
}
|
|
@@ -1943,7 +1943,7 @@ class ue extends x {
|
|
|
1943
1943
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1944
1944
|
}
|
|
1945
1945
|
setLimit(e, t, r, n) {
|
|
1946
|
-
return new
|
|
1946
|
+
return new de(g(u({}, this._def), {
|
|
1947
1947
|
checks: [
|
|
1948
1948
|
...this._def.checks,
|
|
1949
1949
|
{
|
|
@@ -1956,7 +1956,7 @@ class ue extends x {
|
|
|
1956
1956
|
}));
|
|
1957
1957
|
}
|
|
1958
1958
|
_addCheck(e) {
|
|
1959
|
-
return new
|
|
1959
|
+
return new de(g(u({}, this._def), {
|
|
1960
1960
|
checks: [...this._def.checks, e]
|
|
1961
1961
|
}));
|
|
1962
1962
|
}
|
|
@@ -2049,12 +2049,12 @@ class ue extends x {
|
|
|
2049
2049
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
2050
2050
|
}
|
|
2051
2051
|
}
|
|
2052
|
-
|
|
2052
|
+
de.create = (s) => new de(u({
|
|
2053
2053
|
checks: [],
|
|
2054
2054
|
typeName: y.ZodNumber,
|
|
2055
2055
|
coerce: (s == null ? void 0 : s.coerce) || !1
|
|
2056
2056
|
}, w(s)));
|
|
2057
|
-
class
|
|
2057
|
+
class ue extends x {
|
|
2058
2058
|
constructor() {
|
|
2059
2059
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
2060
2060
|
}
|
|
@@ -2110,7 +2110,7 @@ class de extends x {
|
|
|
2110
2110
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
2111
2111
|
}
|
|
2112
2112
|
setLimit(e, t, r, n) {
|
|
2113
|
-
return new
|
|
2113
|
+
return new ue(g(u({}, this._def), {
|
|
2114
2114
|
checks: [
|
|
2115
2115
|
...this._def.checks,
|
|
2116
2116
|
{
|
|
@@ -2123,7 +2123,7 @@ class de extends x {
|
|
|
2123
2123
|
}));
|
|
2124
2124
|
}
|
|
2125
2125
|
_addCheck(e) {
|
|
2126
|
-
return new
|
|
2126
|
+
return new ue(g(u({}, this._def), {
|
|
2127
2127
|
checks: [...this._def.checks, e]
|
|
2128
2128
|
}));
|
|
2129
2129
|
}
|
|
@@ -2179,9 +2179,9 @@ class de extends x {
|
|
|
2179
2179
|
return e;
|
|
2180
2180
|
}
|
|
2181
2181
|
}
|
|
2182
|
-
|
|
2182
|
+
ue.create = (s) => {
|
|
2183
2183
|
var e;
|
|
2184
|
-
return new
|
|
2184
|
+
return new ue(u({
|
|
2185
2185
|
checks: [],
|
|
2186
2186
|
typeName: y.ZodBigInt,
|
|
2187
2187
|
coerce: (e = s == null ? void 0 : s.coerce) !== null && e !== void 0 ? e : !1
|
|
@@ -2200,7 +2200,7 @@ class Le extends x {
|
|
|
2200
2200
|
return $(e.data);
|
|
2201
2201
|
}
|
|
2202
2202
|
}
|
|
2203
|
-
Le.create = (s) => new Le(
|
|
2203
|
+
Le.create = (s) => new Le(u({
|
|
2204
2204
|
typeName: y.ZodBoolean,
|
|
2205
2205
|
coerce: (s == null ? void 0 : s.coerce) || !1
|
|
2206
2206
|
}, w(s)));
|
|
@@ -2244,7 +2244,7 @@ class be extends x {
|
|
|
2244
2244
|
};
|
|
2245
2245
|
}
|
|
2246
2246
|
_addCheck(e) {
|
|
2247
|
-
return new be(g(
|
|
2247
|
+
return new be(g(u({}, this._def), {
|
|
2248
2248
|
checks: [...this._def.checks, e]
|
|
2249
2249
|
}));
|
|
2250
2250
|
}
|
|
@@ -2275,7 +2275,7 @@ class be extends x {
|
|
|
2275
2275
|
return e != null ? new Date(e) : null;
|
|
2276
2276
|
}
|
|
2277
2277
|
}
|
|
2278
|
-
be.create = (s) => new be(
|
|
2278
|
+
be.create = (s) => new be(u({
|
|
2279
2279
|
checks: [],
|
|
2280
2280
|
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
2281
2281
|
typeName: y.ZodDate
|
|
@@ -2293,7 +2293,7 @@ class ct extends x {
|
|
|
2293
2293
|
return $(e.data);
|
|
2294
2294
|
}
|
|
2295
2295
|
}
|
|
2296
|
-
ct.create = (s) => new ct(
|
|
2296
|
+
ct.create = (s) => new ct(u({
|
|
2297
2297
|
typeName: y.ZodSymbol
|
|
2298
2298
|
}, w(s)));
|
|
2299
2299
|
class Ve extends x {
|
|
@@ -2309,7 +2309,7 @@ class Ve extends x {
|
|
|
2309
2309
|
return $(e.data);
|
|
2310
2310
|
}
|
|
2311
2311
|
}
|
|
2312
|
-
Ve.create = (s) => new Ve(
|
|
2312
|
+
Ve.create = (s) => new Ve(u({
|
|
2313
2313
|
typeName: y.ZodUndefined
|
|
2314
2314
|
}, w(s)));
|
|
2315
2315
|
class Ue extends x {
|
|
@@ -2325,7 +2325,7 @@ class Ue extends x {
|
|
|
2325
2325
|
return $(e.data);
|
|
2326
2326
|
}
|
|
2327
2327
|
}
|
|
2328
|
-
Ue.create = (s) => new Ue(
|
|
2328
|
+
Ue.create = (s) => new Ue(u({
|
|
2329
2329
|
typeName: y.ZodNull
|
|
2330
2330
|
}, w(s)));
|
|
2331
2331
|
class Oe extends x {
|
|
@@ -2336,7 +2336,7 @@ class Oe extends x {
|
|
|
2336
2336
|
return $(e.data);
|
|
2337
2337
|
}
|
|
2338
2338
|
}
|
|
2339
|
-
Oe.create = (s) => new Oe(
|
|
2339
|
+
Oe.create = (s) => new Oe(u({
|
|
2340
2340
|
typeName: y.ZodAny
|
|
2341
2341
|
}, w(s)));
|
|
2342
2342
|
class ve extends x {
|
|
@@ -2347,7 +2347,7 @@ class ve extends x {
|
|
|
2347
2347
|
return $(e.data);
|
|
2348
2348
|
}
|
|
2349
2349
|
}
|
|
2350
|
-
ve.create = (s) => new ve(
|
|
2350
|
+
ve.create = (s) => new ve(u({
|
|
2351
2351
|
typeName: y.ZodUnknown
|
|
2352
2352
|
}, w(s)));
|
|
2353
2353
|
class ae extends x {
|
|
@@ -2360,10 +2360,10 @@ class ae extends x {
|
|
|
2360
2360
|
}), _;
|
|
2361
2361
|
}
|
|
2362
2362
|
}
|
|
2363
|
-
ae.create = (s) => new ae(
|
|
2363
|
+
ae.create = (s) => new ae(u({
|
|
2364
2364
|
typeName: y.ZodNever
|
|
2365
2365
|
}, w(s)));
|
|
2366
|
-
class
|
|
2366
|
+
class dt extends x {
|
|
2367
2367
|
_parse(e) {
|
|
2368
2368
|
if (this._getType(e) !== p.undefined) {
|
|
2369
2369
|
const r = this._getOrReturnCtx(e);
|
|
@@ -2376,7 +2376,7 @@ class ut extends x {
|
|
|
2376
2376
|
return $(e.data);
|
|
2377
2377
|
}
|
|
2378
2378
|
}
|
|
2379
|
-
|
|
2379
|
+
dt.create = (s) => new dt(u({
|
|
2380
2380
|
typeName: y.ZodVoid
|
|
2381
2381
|
}, w(s)));
|
|
2382
2382
|
class q extends x {
|
|
@@ -2423,17 +2423,17 @@ class q extends x {
|
|
|
2423
2423
|
return this._def.type;
|
|
2424
2424
|
}
|
|
2425
2425
|
min(e, t) {
|
|
2426
|
-
return new q(g(
|
|
2426
|
+
return new q(g(u({}, this._def), {
|
|
2427
2427
|
minLength: { value: e, message: m.toString(t) }
|
|
2428
2428
|
}));
|
|
2429
2429
|
}
|
|
2430
2430
|
max(e, t) {
|
|
2431
|
-
return new q(g(
|
|
2431
|
+
return new q(g(u({}, this._def), {
|
|
2432
2432
|
maxLength: { value: e, message: m.toString(t) }
|
|
2433
2433
|
}));
|
|
2434
2434
|
}
|
|
2435
2435
|
length(e, t) {
|
|
2436
|
-
return new q(g(
|
|
2436
|
+
return new q(g(u({}, this._def), {
|
|
2437
2437
|
exactLength: { value: e, message: m.toString(t) }
|
|
2438
2438
|
}));
|
|
2439
2439
|
}
|
|
@@ -2441,7 +2441,7 @@ class q extends x {
|
|
|
2441
2441
|
return this.min(1, e);
|
|
2442
2442
|
}
|
|
2443
2443
|
}
|
|
2444
|
-
q.create = (s, e) => new q(
|
|
2444
|
+
q.create = (s, e) => new q(u({
|
|
2445
2445
|
type: s,
|
|
2446
2446
|
minLength: null,
|
|
2447
2447
|
maxLength: null,
|
|
@@ -2455,10 +2455,10 @@ function Se(s) {
|
|
|
2455
2455
|
const r = s.shape[t];
|
|
2456
2456
|
e[t] = X.create(Se(r));
|
|
2457
2457
|
}
|
|
2458
|
-
return new O(g(
|
|
2458
|
+
return new O(g(u({}, s._def), {
|
|
2459
2459
|
shape: () => e
|
|
2460
2460
|
}));
|
|
2461
|
-
} else return s instanceof q ? new q(g(
|
|
2461
|
+
} else return s instanceof q ? new q(g(u({}, s._def), {
|
|
2462
2462
|
type: Se(s.element)
|
|
2463
2463
|
})) : s instanceof X ? X.create(Se(s.unwrap())) : s instanceof fe ? fe.create(Se(s.unwrap())) : s instanceof Q ? Q.create(s.items.map((e) => Se(e))) : s;
|
|
2464
2464
|
}
|
|
@@ -2474,47 +2474,47 @@ class O extends x {
|
|
|
2474
2474
|
}
|
|
2475
2475
|
_parse(e) {
|
|
2476
2476
|
if (this._getType(e) !== p.object) {
|
|
2477
|
-
const
|
|
2478
|
-
return h(
|
|
2477
|
+
const d = this._getOrReturnCtx(e);
|
|
2478
|
+
return h(d, {
|
|
2479
2479
|
code: l.invalid_type,
|
|
2480
2480
|
expected: p.object,
|
|
2481
|
-
received:
|
|
2481
|
+
received: d.parsedType
|
|
2482
2482
|
}), _;
|
|
2483
2483
|
}
|
|
2484
2484
|
const { status: r, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
2485
2485
|
if (!(this._def.catchall instanceof ae && this._def.unknownKeys === "strip"))
|
|
2486
|
-
for (const
|
|
2487
|
-
i.includes(
|
|
2486
|
+
for (const d in n.data)
|
|
2487
|
+
i.includes(d) || o.push(d);
|
|
2488
2488
|
const c = [];
|
|
2489
|
-
for (const
|
|
2490
|
-
const f = a[
|
|
2489
|
+
for (const d of i) {
|
|
2490
|
+
const f = a[d], v = n.data[d];
|
|
2491
2491
|
c.push({
|
|
2492
|
-
key: { status: "valid", value:
|
|
2493
|
-
value: f._parse(new Y(n, v, n.path,
|
|
2494
|
-
alwaysSet:
|
|
2492
|
+
key: { status: "valid", value: d },
|
|
2493
|
+
value: f._parse(new Y(n, v, n.path, d)),
|
|
2494
|
+
alwaysSet: d in n.data
|
|
2495
2495
|
});
|
|
2496
2496
|
}
|
|
2497
2497
|
if (this._def.catchall instanceof ae) {
|
|
2498
|
-
const
|
|
2499
|
-
if (
|
|
2498
|
+
const d = this._def.unknownKeys;
|
|
2499
|
+
if (d === "passthrough")
|
|
2500
2500
|
for (const f of o)
|
|
2501
2501
|
c.push({
|
|
2502
2502
|
key: { status: "valid", value: f },
|
|
2503
2503
|
value: { status: "valid", value: n.data[f] }
|
|
2504
2504
|
});
|
|
2505
|
-
else if (
|
|
2505
|
+
else if (d === "strict")
|
|
2506
2506
|
o.length > 0 && (h(n, {
|
|
2507
2507
|
code: l.unrecognized_keys,
|
|
2508
2508
|
keys: o
|
|
2509
2509
|
}), r.dirty());
|
|
2510
|
-
else if (
|
|
2510
|
+
else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2511
2511
|
} else {
|
|
2512
|
-
const
|
|
2512
|
+
const d = this._def.catchall;
|
|
2513
2513
|
for (const f of o) {
|
|
2514
2514
|
const v = n.data[f];
|
|
2515
2515
|
c.push({
|
|
2516
2516
|
key: { status: "valid", value: f },
|
|
2517
|
-
value:
|
|
2517
|
+
value: d._parse(
|
|
2518
2518
|
new Y(n, v, n.path, f)
|
|
2519
2519
|
//, ctx.child(key), value, getParsedType(value)
|
|
2520
2520
|
),
|
|
@@ -2523,23 +2523,23 @@ class O extends x {
|
|
|
2523
2523
|
}
|
|
2524
2524
|
}
|
|
2525
2525
|
return n.common.async ? Promise.resolve().then(() => I(this, null, function* () {
|
|
2526
|
-
const
|
|
2526
|
+
const d = [];
|
|
2527
2527
|
for (const f of c) {
|
|
2528
2528
|
const v = yield f.key, j = yield f.value;
|
|
2529
|
-
|
|
2529
|
+
d.push({
|
|
2530
2530
|
key: v,
|
|
2531
2531
|
value: j,
|
|
2532
2532
|
alwaysSet: f.alwaysSet
|
|
2533
2533
|
});
|
|
2534
2534
|
}
|
|
2535
|
-
return
|
|
2536
|
-
})).then((
|
|
2535
|
+
return d;
|
|
2536
|
+
})).then((d) => Z.mergeObjectSync(r, d)) : Z.mergeObjectSync(r, c);
|
|
2537
2537
|
}
|
|
2538
2538
|
get shape() {
|
|
2539
2539
|
return this._def.shape();
|
|
2540
2540
|
}
|
|
2541
2541
|
strict(e) {
|
|
2542
|
-
return m.errToObj, new O(
|
|
2542
|
+
return m.errToObj, new O(u(g(u({}, this._def), {
|
|
2543
2543
|
unknownKeys: "strict"
|
|
2544
2544
|
}), e !== void 0 ? {
|
|
2545
2545
|
errorMap: (t, r) => {
|
|
@@ -2554,12 +2554,12 @@ class O extends x {
|
|
|
2554
2554
|
} : {}));
|
|
2555
2555
|
}
|
|
2556
2556
|
strip() {
|
|
2557
|
-
return new O(g(
|
|
2557
|
+
return new O(g(u({}, this._def), {
|
|
2558
2558
|
unknownKeys: "strip"
|
|
2559
2559
|
}));
|
|
2560
2560
|
}
|
|
2561
2561
|
passthrough() {
|
|
2562
|
-
return new O(g(
|
|
2562
|
+
return new O(g(u({}, this._def), {
|
|
2563
2563
|
unknownKeys: "passthrough"
|
|
2564
2564
|
}));
|
|
2565
2565
|
}
|
|
@@ -2581,8 +2581,8 @@ class O extends x {
|
|
|
2581
2581
|
// }) as any;
|
|
2582
2582
|
// };
|
|
2583
2583
|
extend(e) {
|
|
2584
|
-
return new O(g(
|
|
2585
|
-
shape: () =>
|
|
2584
|
+
return new O(g(u({}, this._def), {
|
|
2585
|
+
shape: () => u(u({}, this._def.shape()), e)
|
|
2586
2586
|
}));
|
|
2587
2587
|
}
|
|
2588
2588
|
/**
|
|
@@ -2594,7 +2594,7 @@ class O extends x {
|
|
|
2594
2594
|
return new O({
|
|
2595
2595
|
unknownKeys: e._def.unknownKeys,
|
|
2596
2596
|
catchall: e._def.catchall,
|
|
2597
|
-
shape: () =>
|
|
2597
|
+
shape: () => u(u({}, this._def.shape()), e._def.shape()),
|
|
2598
2598
|
typeName: y.ZodObject
|
|
2599
2599
|
});
|
|
2600
2600
|
}
|
|
@@ -2658,7 +2658,7 @@ class O extends x {
|
|
|
2658
2658
|
// return merged;
|
|
2659
2659
|
// }
|
|
2660
2660
|
catchall(e) {
|
|
2661
|
-
return new O(g(
|
|
2661
|
+
return new O(g(u({}, this._def), {
|
|
2662
2662
|
catchall: e
|
|
2663
2663
|
}));
|
|
2664
2664
|
}
|
|
@@ -2666,7 +2666,7 @@ class O extends x {
|
|
|
2666
2666
|
const t = {};
|
|
2667
2667
|
return k.objectKeys(e).forEach((r) => {
|
|
2668
2668
|
e[r] && this.shape[r] && (t[r] = this.shape[r]);
|
|
2669
|
-
}), new O(g(
|
|
2669
|
+
}), new O(g(u({}, this._def), {
|
|
2670
2670
|
shape: () => t
|
|
2671
2671
|
}));
|
|
2672
2672
|
}
|
|
@@ -2674,7 +2674,7 @@ class O extends x {
|
|
|
2674
2674
|
const t = {};
|
|
2675
2675
|
return k.objectKeys(this.shape).forEach((r) => {
|
|
2676
2676
|
e[r] || (t[r] = this.shape[r]);
|
|
2677
|
-
}), new O(g(
|
|
2677
|
+
}), new O(g(u({}, this._def), {
|
|
2678
2678
|
shape: () => t
|
|
2679
2679
|
}));
|
|
2680
2680
|
}
|
|
@@ -2689,7 +2689,7 @@ class O extends x {
|
|
|
2689
2689
|
return k.objectKeys(this.shape).forEach((r) => {
|
|
2690
2690
|
const n = this.shape[r];
|
|
2691
2691
|
e && !e[r] ? t[r] = n : t[r] = n.optional();
|
|
2692
|
-
}), new O(g(
|
|
2692
|
+
}), new O(g(u({}, this._def), {
|
|
2693
2693
|
shape: () => t
|
|
2694
2694
|
}));
|
|
2695
2695
|
}
|
|
@@ -2704,7 +2704,7 @@ class O extends x {
|
|
|
2704
2704
|
a = a._def.innerType;
|
|
2705
2705
|
t[r] = a;
|
|
2706
2706
|
}
|
|
2707
|
-
}), new O(g(
|
|
2707
|
+
}), new O(g(u({}, this._def), {
|
|
2708
2708
|
shape: () => t
|
|
2709
2709
|
}));
|
|
2710
2710
|
}
|
|
@@ -2712,19 +2712,19 @@ class O extends x {
|
|
|
2712
2712
|
return gs(k.objectKeys(this.shape));
|
|
2713
2713
|
}
|
|
2714
2714
|
}
|
|
2715
|
-
O.create = (s, e) => new O(
|
|
2715
|
+
O.create = (s, e) => new O(u({
|
|
2716
2716
|
shape: () => s,
|
|
2717
2717
|
unknownKeys: "strip",
|
|
2718
2718
|
catchall: ae.create(),
|
|
2719
2719
|
typeName: y.ZodObject
|
|
2720
2720
|
}, w(e)));
|
|
2721
|
-
O.strictCreate = (s, e) => new O(
|
|
2721
|
+
O.strictCreate = (s, e) => new O(u({
|
|
2722
2722
|
shape: () => s,
|
|
2723
2723
|
unknownKeys: "strict",
|
|
2724
2724
|
catchall: ae.create(),
|
|
2725
2725
|
typeName: y.ZodObject
|
|
2726
2726
|
}, w(e)));
|
|
2727
|
-
O.lazycreate = (s, e) => new O(
|
|
2727
|
+
O.lazycreate = (s, e) => new O(u({
|
|
2728
2728
|
shape: s,
|
|
2729
2729
|
unknownKeys: "strip",
|
|
2730
2730
|
catchall: ae.create(),
|
|
@@ -2748,8 +2748,8 @@ class We extends x {
|
|
|
2748
2748
|
}
|
|
2749
2749
|
if (t.common.async)
|
|
2750
2750
|
return Promise.all(r.map((a) => I(this, null, function* () {
|
|
2751
|
-
const i = g(
|
|
2752
|
-
common: g(
|
|
2751
|
+
const i = g(u({}, t), {
|
|
2752
|
+
common: g(u({}, t.common), {
|
|
2753
2753
|
issues: []
|
|
2754
2754
|
}),
|
|
2755
2755
|
parent: null
|
|
@@ -2767,19 +2767,19 @@ class We extends x {
|
|
|
2767
2767
|
let a;
|
|
2768
2768
|
const i = [];
|
|
2769
2769
|
for (const c of r) {
|
|
2770
|
-
const
|
|
2771
|
-
common: g(
|
|
2770
|
+
const d = g(u({}, t), {
|
|
2771
|
+
common: g(u({}, t.common), {
|
|
2772
2772
|
issues: []
|
|
2773
2773
|
}),
|
|
2774
2774
|
parent: null
|
|
2775
2775
|
}), f = c._parseSync({
|
|
2776
2776
|
data: t.data,
|
|
2777
2777
|
path: t.path,
|
|
2778
|
-
parent:
|
|
2778
|
+
parent: d
|
|
2779
2779
|
});
|
|
2780
2780
|
if (f.status === "valid")
|
|
2781
2781
|
return f;
|
|
2782
|
-
f.status === "dirty" && !a && (a = { result: f, ctx:
|
|
2782
|
+
f.status === "dirty" && !a && (a = { result: f, ctx: d }), d.common.issues.length && i.push(d.common.issues);
|
|
2783
2783
|
}
|
|
2784
2784
|
if (a)
|
|
2785
2785
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
@@ -2794,7 +2794,7 @@ class We extends x {
|
|
|
2794
2794
|
return this._def.options;
|
|
2795
2795
|
}
|
|
2796
2796
|
}
|
|
2797
|
-
We.create = (s, e) => new We(
|
|
2797
|
+
We.create = (s, e) => new We(u({
|
|
2798
2798
|
options: s,
|
|
2799
2799
|
typeName: y.ZodUnion
|
|
2800
2800
|
}, w(e)));
|
|
@@ -2852,7 +2852,7 @@ class ft extends x {
|
|
|
2852
2852
|
n.set(o, a);
|
|
2853
2853
|
}
|
|
2854
2854
|
}
|
|
2855
|
-
return new ft(
|
|
2855
|
+
return new ft(u({
|
|
2856
2856
|
typeName: y.ZodDiscriminatedUnion,
|
|
2857
2857
|
discriminator: e,
|
|
2858
2858
|
options: t,
|
|
@@ -2865,7 +2865,7 @@ function Rt(s, e) {
|
|
|
2865
2865
|
if (s === e)
|
|
2866
2866
|
return { valid: !0, data: s };
|
|
2867
2867
|
if (t === p.object && r === p.object) {
|
|
2868
|
-
const n = k.objectKeys(e), a = k.objectKeys(s).filter((o) => n.indexOf(o) !== -1), i =
|
|
2868
|
+
const n = k.objectKeys(e), a = k.objectKeys(s).filter((o) => n.indexOf(o) !== -1), i = u(u({}, s), e);
|
|
2869
2869
|
for (const o of a) {
|
|
2870
2870
|
const c = Rt(s[o], e[o]);
|
|
2871
2871
|
if (!c.valid)
|
|
@@ -2918,7 +2918,7 @@ class ze extends x {
|
|
|
2918
2918
|
}));
|
|
2919
2919
|
}
|
|
2920
2920
|
}
|
|
2921
|
-
ze.create = (s, e, t) => new ze(
|
|
2921
|
+
ze.create = (s, e, t) => new ze(u({
|
|
2922
2922
|
left: s,
|
|
2923
2923
|
right: e,
|
|
2924
2924
|
typeName: y.ZodIntersection
|
|
@@ -2957,7 +2957,7 @@ class Q extends x {
|
|
|
2957
2957
|
return this._def.items;
|
|
2958
2958
|
}
|
|
2959
2959
|
rest(e) {
|
|
2960
|
-
return new Q(g(
|
|
2960
|
+
return new Q(g(u({}, this._def), {
|
|
2961
2961
|
rest: e
|
|
2962
2962
|
}));
|
|
2963
2963
|
}
|
|
@@ -2965,7 +2965,7 @@ class Q extends x {
|
|
|
2965
2965
|
Q.create = (s, e) => {
|
|
2966
2966
|
if (!Array.isArray(s))
|
|
2967
2967
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2968
|
-
return new Q(
|
|
2968
|
+
return new Q(u({
|
|
2969
2969
|
items: s,
|
|
2970
2970
|
typeName: y.ZodTuple,
|
|
2971
2971
|
rest: null
|
|
@@ -2999,18 +2999,18 @@ class Be extends x {
|
|
|
2999
2999
|
return this._def.valueType;
|
|
3000
3000
|
}
|
|
3001
3001
|
static create(e, t, r) {
|
|
3002
|
-
return t instanceof x ? new Be(
|
|
3002
|
+
return t instanceof x ? new Be(u({
|
|
3003
3003
|
keyType: e,
|
|
3004
3004
|
valueType: t,
|
|
3005
3005
|
typeName: y.ZodRecord
|
|
3006
|
-
}, w(r))) : new Be(
|
|
3006
|
+
}, w(r))) : new Be(u({
|
|
3007
3007
|
keyType: B.create(),
|
|
3008
3008
|
valueType: e,
|
|
3009
3009
|
typeName: y.ZodRecord
|
|
3010
3010
|
}, w(t)));
|
|
3011
3011
|
}
|
|
3012
3012
|
}
|
|
3013
|
-
class
|
|
3013
|
+
class ut extends x {
|
|
3014
3014
|
get keySchema() {
|
|
3015
3015
|
return this._def.keyType;
|
|
3016
3016
|
}
|
|
@@ -3025,34 +3025,34 @@ class dt extends x {
|
|
|
3025
3025
|
expected: p.map,
|
|
3026
3026
|
received: r.parsedType
|
|
3027
3027
|
}), _;
|
|
3028
|
-
const n = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, c],
|
|
3029
|
-
key: n._parse(new Y(r, o, r.path, [
|
|
3030
|
-
value: a._parse(new Y(r, c, r.path, [
|
|
3028
|
+
const n = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, c], d) => ({
|
|
3029
|
+
key: n._parse(new Y(r, o, r.path, [d, "key"])),
|
|
3030
|
+
value: a._parse(new Y(r, c, r.path, [d, "value"]))
|
|
3031
3031
|
}));
|
|
3032
3032
|
if (r.common.async) {
|
|
3033
3033
|
const o = /* @__PURE__ */ new Map();
|
|
3034
3034
|
return Promise.resolve().then(() => I(this, null, function* () {
|
|
3035
3035
|
for (const c of i) {
|
|
3036
|
-
const
|
|
3037
|
-
if (
|
|
3036
|
+
const d = yield c.key, f = yield c.value;
|
|
3037
|
+
if (d.status === "aborted" || f.status === "aborted")
|
|
3038
3038
|
return _;
|
|
3039
|
-
(
|
|
3039
|
+
(d.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(d.value, f.value);
|
|
3040
3040
|
}
|
|
3041
3041
|
return { status: t.value, value: o };
|
|
3042
3042
|
}));
|
|
3043
3043
|
} else {
|
|
3044
3044
|
const o = /* @__PURE__ */ new Map();
|
|
3045
3045
|
for (const c of i) {
|
|
3046
|
-
const
|
|
3047
|
-
if (
|
|
3046
|
+
const d = c.key, f = c.value;
|
|
3047
|
+
if (d.status === "aborted" || f.status === "aborted")
|
|
3048
3048
|
return _;
|
|
3049
|
-
(
|
|
3049
|
+
(d.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(d.value, f.value);
|
|
3050
3050
|
}
|
|
3051
3051
|
return { status: t.value, value: o };
|
|
3052
3052
|
}
|
|
3053
3053
|
}
|
|
3054
3054
|
}
|
|
3055
|
-
|
|
3055
|
+
ut.create = (s, e, t) => new ut(u({
|
|
3056
3056
|
valueType: e,
|
|
3057
3057
|
keyType: s,
|
|
3058
3058
|
typeName: y.ZodMap
|
|
@@ -3084,24 +3084,24 @@ class we extends x {
|
|
|
3084
3084
|
}), t.dirty());
|
|
3085
3085
|
const a = this._def.valueType;
|
|
3086
3086
|
function i(c) {
|
|
3087
|
-
const
|
|
3087
|
+
const d = /* @__PURE__ */ new Set();
|
|
3088
3088
|
for (const f of c) {
|
|
3089
3089
|
if (f.status === "aborted")
|
|
3090
3090
|
return _;
|
|
3091
|
-
f.status === "dirty" && t.dirty(),
|
|
3091
|
+
f.status === "dirty" && t.dirty(), d.add(f.value);
|
|
3092
3092
|
}
|
|
3093
|
-
return { status: t.value, value:
|
|
3093
|
+
return { status: t.value, value: d };
|
|
3094
3094
|
}
|
|
3095
|
-
const o = [...r.data.values()].map((c,
|
|
3095
|
+
const o = [...r.data.values()].map((c, d) => a._parse(new Y(r, c, r.path, d)));
|
|
3096
3096
|
return r.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
3097
3097
|
}
|
|
3098
3098
|
min(e, t) {
|
|
3099
|
-
return new we(g(
|
|
3099
|
+
return new we(g(u({}, this._def), {
|
|
3100
3100
|
minSize: { value: e, message: m.toString(t) }
|
|
3101
3101
|
}));
|
|
3102
3102
|
}
|
|
3103
3103
|
max(e, t) {
|
|
3104
|
-
return new we(g(
|
|
3104
|
+
return new we(g(u({}, this._def), {
|
|
3105
3105
|
maxSize: { value: e, message: m.toString(t) }
|
|
3106
3106
|
}));
|
|
3107
3107
|
}
|
|
@@ -3112,7 +3112,7 @@ class we extends x {
|
|
|
3112
3112
|
return this.min(1, e);
|
|
3113
3113
|
}
|
|
3114
3114
|
}
|
|
3115
|
-
we.create = (s, e) => new we(
|
|
3115
|
+
we.create = (s, e) => new we(u({
|
|
3116
3116
|
valueType: s,
|
|
3117
3117
|
minSize: null,
|
|
3118
3118
|
maxSize: null,
|
|
@@ -3139,7 +3139,7 @@ class Ae extends x {
|
|
|
3139
3139
|
t.schemaErrorMap,
|
|
3140
3140
|
at(),
|
|
3141
3141
|
Ie
|
|
3142
|
-
].filter((
|
|
3142
|
+
].filter((d) => !!d),
|
|
3143
3143
|
issueData: {
|
|
3144
3144
|
code: l.invalid_arguments,
|
|
3145
3145
|
argumentsError: c
|
|
@@ -3155,7 +3155,7 @@ class Ae extends x {
|
|
|
3155
3155
|
t.schemaErrorMap,
|
|
3156
3156
|
at(),
|
|
3157
3157
|
Ie
|
|
3158
|
-
].filter((
|
|
3158
|
+
].filter((d) => !!d),
|
|
3159
3159
|
issueData: {
|
|
3160
3160
|
code: l.invalid_return_type,
|
|
3161
3161
|
returnTypeError: c
|
|
@@ -3167,21 +3167,21 @@ class Ae extends x {
|
|
|
3167
3167
|
const o = this;
|
|
3168
3168
|
return $(function(...c) {
|
|
3169
3169
|
return I(this, null, function* () {
|
|
3170
|
-
const
|
|
3171
|
-
throw
|
|
3170
|
+
const d = new U([]), f = yield o._def.args.parseAsync(c, a).catch((M) => {
|
|
3171
|
+
throw d.addIssue(r(c, M)), d;
|
|
3172
3172
|
}), v = yield Reflect.apply(i, this, f);
|
|
3173
3173
|
return yield o._def.returns._def.type.parseAsync(v, a).catch((M) => {
|
|
3174
|
-
throw
|
|
3174
|
+
throw d.addIssue(n(v, M)), d;
|
|
3175
3175
|
});
|
|
3176
3176
|
});
|
|
3177
3177
|
});
|
|
3178
3178
|
} else {
|
|
3179
3179
|
const o = this;
|
|
3180
3180
|
return $(function(...c) {
|
|
3181
|
-
const
|
|
3182
|
-
if (!
|
|
3183
|
-
throw new U([r(c,
|
|
3184
|
-
const f = Reflect.apply(i, this,
|
|
3181
|
+
const d = o._def.args.safeParse(c, a);
|
|
3182
|
+
if (!d.success)
|
|
3183
|
+
throw new U([r(c, d.error)]);
|
|
3184
|
+
const f = Reflect.apply(i, this, d.data), v = o._def.returns.safeParse(f, a);
|
|
3185
3185
|
if (!v.success)
|
|
3186
3186
|
throw new U([n(f, v.error)]);
|
|
3187
3187
|
return v.data;
|
|
@@ -3195,12 +3195,12 @@ class Ae extends x {
|
|
|
3195
3195
|
return this._def.returns;
|
|
3196
3196
|
}
|
|
3197
3197
|
args(...e) {
|
|
3198
|
-
return new Ae(g(
|
|
3198
|
+
return new Ae(g(u({}, this._def), {
|
|
3199
3199
|
args: Q.create(e).rest(ve.create())
|
|
3200
3200
|
}));
|
|
3201
3201
|
}
|
|
3202
3202
|
returns(e) {
|
|
3203
|
-
return new Ae(g(
|
|
3203
|
+
return new Ae(g(u({}, this._def), {
|
|
3204
3204
|
returns: e
|
|
3205
3205
|
}));
|
|
3206
3206
|
}
|
|
@@ -3211,7 +3211,7 @@ class Ae extends x {
|
|
|
3211
3211
|
return this.parse(e);
|
|
3212
3212
|
}
|
|
3213
3213
|
static create(e, t, r) {
|
|
3214
|
-
return new Ae(
|
|
3214
|
+
return new Ae(u({
|
|
3215
3215
|
args: e || Q.create([]).rest(ve.create()),
|
|
3216
3216
|
returns: t || ve.create(),
|
|
3217
3217
|
typeName: y.ZodFunction
|
|
@@ -3227,7 +3227,7 @@ class qe extends x {
|
|
|
3227
3227
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
3228
3228
|
}
|
|
3229
3229
|
}
|
|
3230
|
-
qe.create = (s, e) => new qe(
|
|
3230
|
+
qe.create = (s, e) => new qe(u({
|
|
3231
3231
|
getter: s,
|
|
3232
3232
|
typeName: y.ZodLazy
|
|
3233
3233
|
}, w(e)));
|
|
@@ -3247,12 +3247,12 @@ class He extends x {
|
|
|
3247
3247
|
return this._def.value;
|
|
3248
3248
|
}
|
|
3249
3249
|
}
|
|
3250
|
-
He.create = (s, e) => new He(
|
|
3250
|
+
He.create = (s, e) => new He(u({
|
|
3251
3251
|
value: s,
|
|
3252
3252
|
typeName: y.ZodLiteral
|
|
3253
3253
|
}, w(e)));
|
|
3254
3254
|
function gs(s, e) {
|
|
3255
|
-
return new le(
|
|
3255
|
+
return new le(u({
|
|
3256
3256
|
values: s,
|
|
3257
3257
|
typeName: y.ZodEnum
|
|
3258
3258
|
}, w(e)));
|
|
@@ -3302,10 +3302,10 @@ class le extends x {
|
|
|
3302
3302
|
return e;
|
|
3303
3303
|
}
|
|
3304
3304
|
extract(e, t = this._def) {
|
|
3305
|
-
return le.create(e,
|
|
3305
|
+
return le.create(e, u(u({}, this._def), t));
|
|
3306
3306
|
}
|
|
3307
3307
|
exclude(e, t = this._def) {
|
|
3308
|
-
return le.create(this.options.filter((r) => !e.includes(r)),
|
|
3308
|
+
return le.create(this.options.filter((r) => !e.includes(r)), u(u({}, this._def), t));
|
|
3309
3309
|
}
|
|
3310
3310
|
}
|
|
3311
3311
|
Pe = /* @__PURE__ */ new WeakMap();
|
|
@@ -3339,7 +3339,7 @@ class Je extends x {
|
|
|
3339
3339
|
}
|
|
3340
3340
|
}
|
|
3341
3341
|
$e = /* @__PURE__ */ new WeakMap();
|
|
3342
|
-
Je.create = (s, e) => new Je(
|
|
3342
|
+
Je.create = (s, e) => new Je(u({
|
|
3343
3343
|
values: s,
|
|
3344
3344
|
typeName: y.ZodNativeEnum
|
|
3345
3345
|
}, w(e)));
|
|
@@ -3362,7 +3362,7 @@ class Ne extends x {
|
|
|
3362
3362
|
})));
|
|
3363
3363
|
}
|
|
3364
3364
|
}
|
|
3365
|
-
Ne.create = (s, e) => new Ne(
|
|
3365
|
+
Ne.create = (s, e) => new Ne(u({
|
|
3366
3366
|
type: s,
|
|
3367
3367
|
typeName: y.ZodPromise
|
|
3368
3368
|
}, w(e)));
|
|
@@ -3443,12 +3443,12 @@ class H extends x {
|
|
|
3443
3443
|
k.assertNever(n);
|
|
3444
3444
|
}
|
|
3445
3445
|
}
|
|
3446
|
-
H.create = (s, e, t) => new H(
|
|
3446
|
+
H.create = (s, e, t) => new H(u({
|
|
3447
3447
|
schema: s,
|
|
3448
3448
|
typeName: y.ZodEffects,
|
|
3449
3449
|
effect: e
|
|
3450
3450
|
}, w(t)));
|
|
3451
|
-
H.createWithPreprocess = (s, e, t) => new H(
|
|
3451
|
+
H.createWithPreprocess = (s, e, t) => new H(u({
|
|
3452
3452
|
schema: e,
|
|
3453
3453
|
effect: { type: "preprocess", transform: s },
|
|
3454
3454
|
typeName: y.ZodEffects
|
|
@@ -3461,7 +3461,7 @@ class X extends x {
|
|
|
3461
3461
|
return this._def.innerType;
|
|
3462
3462
|
}
|
|
3463
3463
|
}
|
|
3464
|
-
X.create = (s, e) => new X(
|
|
3464
|
+
X.create = (s, e) => new X(u({
|
|
3465
3465
|
innerType: s,
|
|
3466
3466
|
typeName: y.ZodOptional
|
|
3467
3467
|
}, w(e)));
|
|
@@ -3473,7 +3473,7 @@ class fe extends x {
|
|
|
3473
3473
|
return this._def.innerType;
|
|
3474
3474
|
}
|
|
3475
3475
|
}
|
|
3476
|
-
fe.create = (s, e) => new fe(
|
|
3476
|
+
fe.create = (s, e) => new fe(u({
|
|
3477
3477
|
innerType: s,
|
|
3478
3478
|
typeName: y.ZodNullable
|
|
3479
3479
|
}, w(e)));
|
|
@@ -3491,21 +3491,21 @@ class Ge extends x {
|
|
|
3491
3491
|
return this._def.innerType;
|
|
3492
3492
|
}
|
|
3493
3493
|
}
|
|
3494
|
-
Ge.create = (s, e) => new Ge(
|
|
3494
|
+
Ge.create = (s, e) => new Ge(u({
|
|
3495
3495
|
innerType: s,
|
|
3496
3496
|
typeName: y.ZodDefault,
|
|
3497
3497
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
3498
3498
|
}, w(e)));
|
|
3499
3499
|
class Ke extends x {
|
|
3500
3500
|
_parse(e) {
|
|
3501
|
-
const { ctx: t } = this._processInputParams(e), r = g(
|
|
3502
|
-
common: g(
|
|
3501
|
+
const { ctx: t } = this._processInputParams(e), r = g(u({}, t), {
|
|
3502
|
+
common: g(u({}, t.common), {
|
|
3503
3503
|
issues: []
|
|
3504
3504
|
})
|
|
3505
3505
|
}), n = this._def.innerType._parse({
|
|
3506
3506
|
data: r.data,
|
|
3507
3507
|
path: r.path,
|
|
3508
|
-
parent:
|
|
3508
|
+
parent: u({}, r)
|
|
3509
3509
|
});
|
|
3510
3510
|
return De(n) ? n.then((a) => ({
|
|
3511
3511
|
status: "valid",
|
|
@@ -3529,7 +3529,7 @@ class Ke extends x {
|
|
|
3529
3529
|
return this._def.innerType;
|
|
3530
3530
|
}
|
|
3531
3531
|
}
|
|
3532
|
-
Ke.create = (s, e) => new Ke(
|
|
3532
|
+
Ke.create = (s, e) => new Ke(u({
|
|
3533
3533
|
innerType: s,
|
|
3534
3534
|
typeName: y.ZodCatch,
|
|
3535
3535
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
@@ -3547,7 +3547,7 @@ class lt extends x {
|
|
|
3547
3547
|
return { status: "valid", value: e.data };
|
|
3548
3548
|
}
|
|
3549
3549
|
}
|
|
3550
|
-
lt.create = (s) => new lt(
|
|
3550
|
+
lt.create = (s) => new lt(u({
|
|
3551
3551
|
typeName: y.ZodNaN
|
|
3552
3552
|
}, w(s)));
|
|
3553
3553
|
const tn = Symbol("zod_brand");
|
|
@@ -3613,7 +3613,7 @@ class Xe extends x {
|
|
|
3613
3613
|
return this._def.innerType;
|
|
3614
3614
|
}
|
|
3615
3615
|
}
|
|
3616
|
-
Xe.create = (s, e) => new Xe(
|
|
3616
|
+
Xe.create = (s, e) => new Xe(u({
|
|
3617
3617
|
innerType: s,
|
|
3618
3618
|
typeName: y.ZodReadonly
|
|
3619
3619
|
}, w(e)));
|
|
@@ -3627,15 +3627,15 @@ function ys(s, e = {}, t) {
|
|
|
3627
3627
|
const o = s(r);
|
|
3628
3628
|
if (o instanceof Promise)
|
|
3629
3629
|
return o.then((c) => {
|
|
3630
|
-
var
|
|
3630
|
+
var d, f;
|
|
3631
3631
|
if (!c) {
|
|
3632
|
-
const v = Kt(e, r), j = (f = (
|
|
3633
|
-
n.addIssue(g(
|
|
3632
|
+
const v = Kt(e, r), j = (f = (d = v.fatal) !== null && d !== void 0 ? d : t) !== null && f !== void 0 ? f : !0;
|
|
3633
|
+
n.addIssue(g(u({ code: "custom" }, v), { fatal: j }));
|
|
3634
3634
|
}
|
|
3635
3635
|
});
|
|
3636
3636
|
if (!o) {
|
|
3637
|
-
const c = Kt(e, r),
|
|
3638
|
-
n.addIssue(g(
|
|
3637
|
+
const c = Kt(e, r), d = (i = (a = c.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
|
|
3638
|
+
n.addIssue(g(u({ code: "custom" }, c), { fatal: d }));
|
|
3639
3639
|
}
|
|
3640
3640
|
}) : Oe.create();
|
|
3641
3641
|
}
|
|
@@ -3648,14 +3648,14 @@ var y;
|
|
|
3648
3648
|
})(y || (y = {}));
|
|
3649
3649
|
const rn = (s, e = {
|
|
3650
3650
|
message: `Input not instance of ${s.name}`
|
|
3651
|
-
}) => ys((t) => t instanceof s, e), vs = B.create, _s =
|
|
3652
|
-
string: (s) => B.create(g(
|
|
3653
|
-
number: (s) =>
|
|
3654
|
-
boolean: (s) => Le.create(g(
|
|
3651
|
+
}) => ys((t) => t instanceof s, e), vs = B.create, _s = de.create, nn = lt.create, an = ue.create, bs = Le.create, on = be.create, cn = ct.create, dn = Ve.create, un = Ue.create, ln = Oe.create, fn = ve.create, hn = ae.create, pn = dt.create, mn = q.create, gn = O.create, yn = O.strictCreate, vn = We.create, _n = ft.create, bn = ze.create, wn = Q.create, xn = Be.create, kn = ut.create, Tn = we.create, Sn = Ae.create, En = qe.create, An = He.create, Cn = le.create, In = Je.create, On = Ne.create, Xt = H.create, Nn = X.create, jn = fe.create, Rn = H.createWithPreprocess, Zn = Qe.create, Mn = () => vs().optional(), Pn = () => _s().optional(), $n = () => bs().optional(), Fn = {
|
|
3652
|
+
string: (s) => B.create(g(u({}, s), { coerce: !0 })),
|
|
3653
|
+
number: (s) => de.create(g(u({}, s), { coerce: !0 })),
|
|
3654
|
+
boolean: (s) => Le.create(g(u({}, s), {
|
|
3655
3655
|
coerce: !0
|
|
3656
3656
|
})),
|
|
3657
|
-
bigint: (s) =>
|
|
3658
|
-
date: (s) => be.create(g(
|
|
3657
|
+
bigint: (s) => ue.create(g(u({}, s), { coerce: !0 })),
|
|
3658
|
+
date: (s) => be.create(g(u({}, s), { coerce: !0 }))
|
|
3659
3659
|
}, Dn = _;
|
|
3660
3660
|
var T = /* @__PURE__ */ Object.freeze({
|
|
3661
3661
|
__proto__: null,
|
|
@@ -3684,8 +3684,8 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3684
3684
|
ZodType: x,
|
|
3685
3685
|
datetimeRegex: ms,
|
|
3686
3686
|
ZodString: B,
|
|
3687
|
-
ZodNumber:
|
|
3688
|
-
ZodBigInt:
|
|
3687
|
+
ZodNumber: de,
|
|
3688
|
+
ZodBigInt: ue,
|
|
3689
3689
|
ZodBoolean: Le,
|
|
3690
3690
|
ZodDate: be,
|
|
3691
3691
|
ZodSymbol: ct,
|
|
@@ -3694,7 +3694,7 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3694
3694
|
ZodAny: Oe,
|
|
3695
3695
|
ZodUnknown: ve,
|
|
3696
3696
|
ZodNever: ae,
|
|
3697
|
-
ZodVoid:
|
|
3697
|
+
ZodVoid: dt,
|
|
3698
3698
|
ZodArray: q,
|
|
3699
3699
|
ZodObject: O,
|
|
3700
3700
|
ZodUnion: We,
|
|
@@ -3702,7 +3702,7 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3702
3702
|
ZodIntersection: ze,
|
|
3703
3703
|
ZodTuple: Q,
|
|
3704
3704
|
ZodRecord: Be,
|
|
3705
|
-
ZodMap:
|
|
3705
|
+
ZodMap: ut,
|
|
3706
3706
|
ZodSet: we,
|
|
3707
3707
|
ZodFunction: Ae,
|
|
3708
3708
|
ZodLazy: qe,
|
|
@@ -3746,7 +3746,7 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3746
3746
|
nan: nn,
|
|
3747
3747
|
nativeEnum: In,
|
|
3748
3748
|
never: hn,
|
|
3749
|
-
null:
|
|
3749
|
+
null: un,
|
|
3750
3750
|
nullable: jn,
|
|
3751
3751
|
number: _s,
|
|
3752
3752
|
object: gn,
|
|
@@ -3764,7 +3764,7 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3764
3764
|
symbol: cn,
|
|
3765
3765
|
transformer: Xt,
|
|
3766
3766
|
tuple: wn,
|
|
3767
|
-
undefined:
|
|
3767
|
+
undefined: dn,
|
|
3768
3768
|
union: vn,
|
|
3769
3769
|
unknown: fn,
|
|
3770
3770
|
void: pn,
|
|
@@ -3830,7 +3830,7 @@ const Ln = T.object({
|
|
|
3830
3830
|
"COMPONENT_SET",
|
|
3831
3831
|
"GROUP"
|
|
3832
3832
|
]), Un = (s, e, t = { allowAutoSelectFirstNode: !0 }) => {
|
|
3833
|
-
const r =
|
|
3833
|
+
const r = us(s.document, e);
|
|
3834
3834
|
if (!r)
|
|
3835
3835
|
return {
|
|
3836
3836
|
isValid: !1,
|
|
@@ -3999,7 +3999,7 @@ class ta {
|
|
|
3999
3999
|
const i = {
|
|
4000
4000
|
tracking: a,
|
|
4001
4001
|
assetsStorage: e.assetsStorage,
|
|
4002
|
-
params:
|
|
4002
|
+
params: u({
|
|
4003
4003
|
prompt: e.prompt,
|
|
4004
4004
|
images: e.images,
|
|
4005
4005
|
conventions: {
|
|
@@ -4042,15 +4042,15 @@ A = new WeakMap(), Ye = new WeakMap(), ne = new WeakSet(), ws = function(e, t, r
|
|
|
4042
4042
|
},
|
|
4043
4043
|
signal: a
|
|
4044
4044
|
});
|
|
4045
|
-
} catch (
|
|
4046
|
-
if (
|
|
4047
|
-
throw
|
|
4045
|
+
} catch (d) {
|
|
4046
|
+
if (d instanceof Error && d.name === "AbortError")
|
|
4047
|
+
throw d;
|
|
4048
4048
|
return;
|
|
4049
4049
|
}
|
|
4050
4050
|
const c = r.map(
|
|
4051
|
-
(
|
|
4051
|
+
(d) => Un(i, d, n)
|
|
4052
4052
|
).find(
|
|
4053
|
-
(
|
|
4053
|
+
(d) => !d.isValid
|
|
4054
4054
|
);
|
|
4055
4055
|
if (c)
|
|
4056
4056
|
throw new me({
|
|
@@ -4065,7 +4065,7 @@ A = new WeakMap(), Ye = new WeakMap(), ne = new WeakSet(), ws = function(e, t, r
|
|
|
4065
4065
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
4066
4066
|
const i = {}, o = yield fetch(`${C(this, Ye)}${e}`, {
|
|
4067
4067
|
method: "POST",
|
|
4068
|
-
headers: g(
|
|
4068
|
+
headers: g(u({}, this.headers), {
|
|
4069
4069
|
Accept: "text/event-stream"
|
|
4070
4070
|
}),
|
|
4071
4071
|
body: JSON.stringify(t),
|
|
@@ -4102,14 +4102,14 @@ A = new WeakMap(), Ye = new WeakMap(), ne = new WeakSet(), ws = function(e, t, r
|
|
|
4102
4102
|
reason: "Response body is null",
|
|
4103
4103
|
status: o.status
|
|
4104
4104
|
});
|
|
4105
|
-
const c = o.body.getReader(),
|
|
4105
|
+
const c = o.body.getReader(), d = new TextDecoder();
|
|
4106
4106
|
let f = "";
|
|
4107
4107
|
try {
|
|
4108
4108
|
for (; ; ) {
|
|
4109
4109
|
const { done: xe, value: E } = yield c.read();
|
|
4110
4110
|
if (xe)
|
|
4111
4111
|
break;
|
|
4112
|
-
f +=
|
|
4112
|
+
f += d.decode(E, { stream: !0 });
|
|
4113
4113
|
const ke = f.split(`
|
|
4114
4114
|
`);
|
|
4115
4115
|
f = ke.pop() || "";
|
|
@@ -4203,7 +4203,7 @@ const sa = (s) => {
|
|
|
4203
4203
|
return [!1, "", ""];
|
|
4204
4204
|
try {
|
|
4205
4205
|
const t = new URL(s), r = t.pathname;
|
|
4206
|
-
if (t.origin !== "https://www.figma.com")
|
|
4206
|
+
if (t.origin !== "https://www.figma.com" && t.origin !== "https://embed.figma.com")
|
|
4207
4207
|
return [!1, "", ""];
|
|
4208
4208
|
const n = t.toString();
|
|
4209
4209
|
if (s !== n)
|
|
@@ -4238,8 +4238,8 @@ const aa = ({
|
|
|
4238
4238
|
try {
|
|
4239
4239
|
const c = zn(a, o);
|
|
4240
4240
|
if (c.startsWith("src/")) {
|
|
4241
|
-
const
|
|
4242
|
-
Bn(s,
|
|
4241
|
+
const d = c.split("/").slice(0, -1).join("/");
|
|
4242
|
+
Bn(s, d).forEach((v) => {
|
|
4243
4243
|
r.has(v) || n(v);
|
|
4244
4244
|
});
|
|
4245
4245
|
}
|
|
@@ -4306,11 +4306,11 @@ function ht(s, e, t) {
|
|
|
4306
4306
|
const qn = (s, e) => ht(s, e, s.generateCode);
|
|
4307
4307
|
function pt(s) {
|
|
4308
4308
|
return I(this, null, function* () {
|
|
4309
|
-
var i, o, c,
|
|
4309
|
+
var i, o, c, d;
|
|
4310
4310
|
const [e, t] = s.tee(), r = yield e.getReader().read();
|
|
4311
4311
|
if (r.done || !r.value || r.value.type === "error" && ((i = r.value.payload) != null && i.status))
|
|
4312
4312
|
return new Response(JSON.stringify(r.value), {
|
|
4313
|
-
status: ((o = r.value) == null ? void 0 : o.type) === "error" && (
|
|
4313
|
+
status: ((o = r.value) == null ? void 0 : o.type) === "error" && (d = (c = r.value.payload) == null ? void 0 : c.status) != null ? d : 500,
|
|
4314
4314
|
headers: {
|
|
4315
4315
|
"Content-Type": "application/json"
|
|
4316
4316
|
}
|
|
@@ -4347,7 +4347,7 @@ const ia = (s, e) => I(void 0, null, function* () {
|
|
|
4347
4347
|
}), Jn = (s, e) => ht(s, e, s.generateCodeFromPrompt), ca = (s, e) => I(void 0, null, function* () {
|
|
4348
4348
|
const t = Jn(s, e);
|
|
4349
4349
|
return pt(t);
|
|
4350
|
-
}), Gn = (s, e) => ht(s, e, s.generateLink2Code),
|
|
4350
|
+
}), Gn = (s, e) => ht(s, e, s.generateLink2Code), da = (s, e) => I(void 0, null, function* () {
|
|
4351
4351
|
const t = Gn(s, e);
|
|
4352
4352
|
return pt(t);
|
|
4353
4353
|
});
|
|
@@ -4366,9 +4366,9 @@ export {
|
|
|
4366
4366
|
Hn as createCodeFromWebsiteStream,
|
|
4367
4367
|
ia as createCodegenResponseEventStream,
|
|
4368
4368
|
qn as createCodegenStream,
|
|
4369
|
-
|
|
4369
|
+
da as createLink2CodeResponseEventStream,
|
|
4370
4370
|
Gn as createLink2CodeStream,
|
|
4371
|
-
|
|
4371
|
+
us as findChildrenNode,
|
|
4372
4372
|
ra as formatToFigmaLink,
|
|
4373
4373
|
Qn as getFigmaApiErrorType,
|
|
4374
4374
|
Or as getFigmaFile,
|