@animaapp/anima-sdk 0.6.22 → 0.6.23
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 +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +27 -12
- package/dist/index.js +1318 -1312
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,189 +1,189 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var xs = Object.defineProperty, ks = Object.defineProperties;
|
|
2
|
+
var Ts = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Ft = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var Lt = (
|
|
6
|
-
throw TypeError(
|
|
4
|
+
var Ss = Object.prototype.hasOwnProperty, Es = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Lt = (s) => {
|
|
6
|
+
throw TypeError(s);
|
|
7
7
|
};
|
|
8
|
-
var Dt = (
|
|
8
|
+
var Dt = (s, e, t) => e in s ? xs(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, d = (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)
|
|
12
12
|
for (var t of Ft(e))
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
}, g = (
|
|
16
|
-
var mt = (
|
|
17
|
-
var
|
|
18
|
-
var
|
|
13
|
+
Es.call(e, t) && Dt(s, t, e[t]);
|
|
14
|
+
return s;
|
|
15
|
+
}, g = (s, e) => ks(s, Ts(e));
|
|
16
|
+
var mt = (s, e, t) => e.has(s) || Lt("Cannot " + t);
|
|
17
|
+
var C = (s, e, t) => (mt(s, e, "read from private field"), t ? t.call(s) : e.get(s)), tt = (s, e, t) => e.has(s) ? Lt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), gt = (s, e, t, r) => (mt(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t), Te = (s, e, t) => (mt(s, e, "access private method"), t);
|
|
18
|
+
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 (u) {
|
|
23
|
+
n(u);
|
|
24
24
|
}
|
|
25
25
|
}, i = (c) => {
|
|
26
26
|
try {
|
|
27
27
|
o(t.throw(c));
|
|
28
|
-
} catch (
|
|
29
|
-
n(
|
|
28
|
+
} catch (u) {
|
|
29
|
+
n(u);
|
|
30
30
|
}
|
|
31
|
-
}, o = (c) => c.done ?
|
|
32
|
-
o((t = t.apply(
|
|
31
|
+
}, o = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(a, i);
|
|
32
|
+
o((t = t.apply(s, e)).next());
|
|
33
33
|
});
|
|
34
|
-
class
|
|
34
|
+
class me extends Error {
|
|
35
35
|
constructor({
|
|
36
36
|
name: e,
|
|
37
37
|
reason: t,
|
|
38
|
-
status:
|
|
38
|
+
status: r,
|
|
39
39
|
detail: n
|
|
40
40
|
}) {
|
|
41
|
-
super(), this.name = e, this.message = t, this.detail = n, this.status =
|
|
41
|
+
super(), this.name = e, this.message = t, this.detail = n, this.status = r;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
const Qt = "Figma Token Issue";
|
|
45
|
-
class
|
|
45
|
+
class As extends Error {
|
|
46
46
|
constructor({
|
|
47
47
|
fileKey: e,
|
|
48
48
|
reason: t,
|
|
49
|
-
cause:
|
|
49
|
+
cause: r
|
|
50
50
|
}) {
|
|
51
|
-
super(Qt), this.fileKey = e, this.reason = t, this.cause =
|
|
51
|
+
super(Qt), this.fileKey = e, this.reason = t, this.cause = r;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
class
|
|
54
|
+
const es = "Rate Limit Exceeded";
|
|
55
|
+
class Cs extends Error {
|
|
56
56
|
constructor({ fileKey: e, cause: t }) {
|
|
57
|
-
super(
|
|
57
|
+
super(es), this.fileKey = e, this.cause = t;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
const
|
|
61
|
-
class
|
|
60
|
+
const ts = "Request Too Large";
|
|
61
|
+
class Is extends Error {
|
|
62
62
|
constructor({ fileKey: e, cause: t }) {
|
|
63
|
-
super(
|
|
63
|
+
super(ts), this.fileKey = e, this.cause = t;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
class
|
|
66
|
+
const ss = "Not Found";
|
|
67
|
+
class Os extends Error {
|
|
68
68
|
constructor({ fileKey: e, cause: t }) {
|
|
69
|
-
super(
|
|
69
|
+
super(ss), this.fileKey = e, this.cause = t;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
const
|
|
73
|
-
class
|
|
72
|
+
const Ns = (s) => s.message === ss, rs = "Unknown Figma API Exception";
|
|
73
|
+
class js extends Error {
|
|
74
74
|
constructor({ fileKey: e, cause: t }) {
|
|
75
|
-
super(
|
|
75
|
+
super(rs), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = t;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
const
|
|
78
|
+
const Yn = (s) => s.message === rs, Rs = (s) => s.message === es, Zs = (s) => [Qt, ...[
|
|
79
79
|
"Invalid Figma token",
|
|
80
80
|
"Figma token expired"
|
|
81
81
|
]].includes(
|
|
82
|
-
|
|
83
|
-
),
|
|
84
|
-
var
|
|
85
|
-
if (((
|
|
86
|
-
const { err: n, status: a } =
|
|
82
|
+
s.message
|
|
83
|
+
), Ms = (s) => s.message === ts, ns = (s, e) => {
|
|
84
|
+
var r;
|
|
85
|
+
if (((r = s == null ? void 0 : s.cause) == null ? void 0 : r.message) === "Fetch Error") {
|
|
86
|
+
const { err: n, status: a } = s.cause.body;
|
|
87
87
|
if (a === 403)
|
|
88
|
-
return new
|
|
88
|
+
return new As({
|
|
89
89
|
fileKey: e,
|
|
90
90
|
reason: n,
|
|
91
|
-
cause:
|
|
91
|
+
cause: s
|
|
92
92
|
});
|
|
93
93
|
if (a === 429)
|
|
94
|
-
return new
|
|
94
|
+
return new Cs({ fileKey: e, cause: s });
|
|
95
95
|
if (a === 404)
|
|
96
|
-
return new
|
|
96
|
+
return new Os({ fileKey: e, cause: s });
|
|
97
97
|
if (a === 400 && n.includes("Request too large"))
|
|
98
|
-
return new
|
|
98
|
+
return new Is({ fileKey: e, cause: s });
|
|
99
99
|
}
|
|
100
|
-
return new
|
|
101
|
-
},
|
|
102
|
-
var
|
|
103
|
-
throw TypeError(
|
|
104
|
-
}, Wt = (
|
|
100
|
+
return new js({ fileKey: e, cause: s });
|
|
101
|
+
}, Qn = (s) => Ns(s) ? "NotFound" : Rs(s) ? "RateLimitExceeded" : Zs(s) ? "FigmaTokenIssue" : Ms(s) ? "RequestTooLarge" : "UnknownFigmaApiException";
|
|
102
|
+
var Ps = Object.defineProperty, $s = Object.defineProperties, Fs = Object.getOwnPropertyDescriptors, Vt = Object.getOwnPropertySymbols, Ds = Object.prototype.hasOwnProperty, Ls = Object.prototype.propertyIsEnumerable, Ut = (s, e) => (e = Symbol[s]) ? e : Symbol.for("Symbol." + s), as = (s) => {
|
|
103
|
+
throw TypeError(s);
|
|
104
|
+
}, Wt = (s, e, t) => e in s ? Ps(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, V = (s, e) => {
|
|
105
105
|
for (var t in e || (e = {}))
|
|
106
|
-
|
|
106
|
+
Ds.call(e, t) && Wt(s, t, e[t]);
|
|
107
107
|
if (Vt)
|
|
108
108
|
for (var t of Vt(e))
|
|
109
|
-
|
|
110
|
-
return
|
|
111
|
-
}, Zt = (
|
|
109
|
+
Ls.call(e, t) && Wt(s, t, e[t]);
|
|
110
|
+
return s;
|
|
111
|
+
}, Zt = (s, e) => $s(s, Fs(e)), Mt = (s, e, t) => e.has(s) || as("Cannot " + t), S = (s, e, t) => (Mt(s, e, "read from private field"), t ? t.call(s) : e.get(s)), z = (s, e, t) => e.has(s) ? as("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), R = (s, e, t, r) => (Mt(s, e, "write to private field"), e.set(s, t), t), K = (s, e, t) => (Mt(s, e, "access private method"), t), N = (s, e, t) => new Promise((r, n) => {
|
|
112
112
|
var a = (c) => {
|
|
113
113
|
try {
|
|
114
114
|
o(t.next(c));
|
|
115
|
-
} catch (
|
|
116
|
-
n(
|
|
115
|
+
} catch (u) {
|
|
116
|
+
n(u);
|
|
117
117
|
}
|
|
118
118
|
}, i = (c) => {
|
|
119
119
|
try {
|
|
120
120
|
o(t.throw(c));
|
|
121
|
-
} catch (
|
|
122
|
-
n(
|
|
121
|
+
} catch (u) {
|
|
122
|
+
n(u);
|
|
123
123
|
}
|
|
124
|
-
}, o = (c) => c.done ?
|
|
125
|
-
o((t = t.apply(
|
|
126
|
-
}),
|
|
127
|
-
function
|
|
128
|
-
return
|
|
124
|
+
}, o = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(a, i);
|
|
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((u) => i({ value: u, 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
|
+
function Ws(s) {
|
|
128
|
+
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
|
|
129
129
|
}
|
|
130
|
-
var wt = { exports: {} },
|
|
131
|
-
function
|
|
132
|
-
return zt || (zt = 1, function(
|
|
133
|
-
(function(t,
|
|
134
|
-
|
|
135
|
-
})(
|
|
136
|
-
var t = typeof Promise == "function",
|
|
137
|
-
function
|
|
138
|
-
var
|
|
139
|
-
if (
|
|
140
|
-
return
|
|
141
|
-
if (
|
|
130
|
+
var wt = { exports: {} }, zs = wt.exports, zt;
|
|
131
|
+
function Bs() {
|
|
132
|
+
return zt || (zt = 1, function(s, e) {
|
|
133
|
+
(function(t, r) {
|
|
134
|
+
s.exports = r();
|
|
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", u = 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
|
+
function xe(E) {
|
|
138
|
+
var ke = typeof E;
|
|
139
|
+
if (ke !== "object")
|
|
140
|
+
return ke;
|
|
141
|
+
if (E === null)
|
|
142
142
|
return "null";
|
|
143
|
-
if (
|
|
143
|
+
if (E === r)
|
|
144
144
|
return "global";
|
|
145
|
-
if (Array.isArray(
|
|
145
|
+
if (Array.isArray(E) && (v === !1 || !(Symbol.toStringTag in E)))
|
|
146
146
|
return "Array";
|
|
147
147
|
if (typeof window == "object" && window !== null) {
|
|
148
|
-
if (typeof window.location == "object" &&
|
|
148
|
+
if (typeof window.location == "object" && E === window.location)
|
|
149
149
|
return "Location";
|
|
150
|
-
if (typeof window.document == "object" &&
|
|
150
|
+
if (typeof window.document == "object" && E === window.document)
|
|
151
151
|
return "Document";
|
|
152
152
|
if (typeof window.navigator == "object") {
|
|
153
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
153
|
+
if (typeof window.navigator.mimeTypes == "object" && E === window.navigator.mimeTypes)
|
|
154
154
|
return "MimeTypeArray";
|
|
155
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
155
|
+
if (typeof window.navigator.plugins == "object" && E === window.navigator.plugins)
|
|
156
156
|
return "PluginArray";
|
|
157
157
|
}
|
|
158
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
159
|
-
if (
|
|
158
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && E instanceof window.HTMLElement) {
|
|
159
|
+
if (E.tagName === "BLOCKQUOTE")
|
|
160
160
|
return "HTMLQuoteElement";
|
|
161
|
-
if (
|
|
161
|
+
if (E.tagName === "TD")
|
|
162
162
|
return "HTMLTableDataCellElement";
|
|
163
|
-
if (
|
|
163
|
+
if (E.tagName === "TH")
|
|
164
164
|
return "HTMLTableHeaderCellElement";
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
var
|
|
168
|
-
if (typeof
|
|
169
|
-
return
|
|
170
|
-
var
|
|
171
|
-
return
|
|
167
|
+
var pe = v && E[Symbol.toStringTag];
|
|
168
|
+
if (typeof pe == "string")
|
|
169
|
+
return pe;
|
|
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" : u && 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
|
-
return
|
|
173
|
+
return xe;
|
|
174
174
|
});
|
|
175
175
|
}(wt)), wt.exports;
|
|
176
176
|
}
|
|
177
|
-
var
|
|
178
|
-
const
|
|
177
|
+
var qs = Bs();
|
|
178
|
+
const Hs = /* @__PURE__ */ Ws(qs), Pt = typeof Buffer != "undefined", Js = Pt && typeof Buffer.from != "undefined", Gs = Pt ? (
|
|
179
179
|
/**
|
|
180
180
|
* is value is Buffer?
|
|
181
181
|
*
|
|
182
182
|
* @param {*} value
|
|
183
183
|
* @return {boolean}
|
|
184
184
|
*/
|
|
185
|
-
function(
|
|
186
|
-
return Buffer.isBuffer(
|
|
185
|
+
function(s) {
|
|
186
|
+
return Buffer.isBuffer(s);
|
|
187
187
|
}
|
|
188
188
|
) : (
|
|
189
189
|
/**
|
|
@@ -196,15 +196,15 @@ const Hr = /* @__PURE__ */ Wr(qr), Pt = typeof Buffer != "undefined", Jr = Pt &&
|
|
|
196
196
|
function() {
|
|
197
197
|
return !1;
|
|
198
198
|
}
|
|
199
|
-
),
|
|
199
|
+
), Ks = Js ? (
|
|
200
200
|
/**
|
|
201
201
|
* copy Buffer
|
|
202
202
|
*
|
|
203
203
|
* @param {Buffer} value
|
|
204
204
|
* @return {Buffer}
|
|
205
205
|
*/
|
|
206
|
-
function(
|
|
207
|
-
return Buffer.from(
|
|
206
|
+
function(s) {
|
|
207
|
+
return Buffer.from(s);
|
|
208
208
|
}
|
|
209
209
|
) : Pt ? (
|
|
210
210
|
/**
|
|
@@ -215,8 +215,8 @@ const Hr = /* @__PURE__ */ Wr(qr), Pt = typeof Buffer != "undefined", Jr = Pt &&
|
|
|
215
215
|
* @param {Buffer} value
|
|
216
216
|
* @return {Buffer}
|
|
217
217
|
*/
|
|
218
|
-
function(
|
|
219
|
-
return new Buffer(
|
|
218
|
+
function(s) {
|
|
219
|
+
return new Buffer(s);
|
|
220
220
|
}
|
|
221
221
|
) : (
|
|
222
222
|
/**
|
|
@@ -227,115 +227,115 @@ const Hr = /* @__PURE__ */ Wr(qr), Pt = typeof Buffer != "undefined", Jr = Pt &&
|
|
|
227
227
|
* @param {*}
|
|
228
228
|
* @return {*}
|
|
229
229
|
*/
|
|
230
|
-
function(
|
|
231
|
-
return
|
|
230
|
+
function(s) {
|
|
231
|
+
return s;
|
|
232
232
|
}
|
|
233
233
|
);
|
|
234
|
-
function
|
|
235
|
-
return
|
|
234
|
+
function Ce(s) {
|
|
235
|
+
return Gs(s) ? "Buffer" : Hs(s);
|
|
236
236
|
}
|
|
237
|
-
const
|
|
237
|
+
const Xs = /* @__PURE__ */ new Set([
|
|
238
238
|
"Arguments",
|
|
239
239
|
"Array",
|
|
240
240
|
"Map",
|
|
241
241
|
"Object",
|
|
242
242
|
"Set"
|
|
243
243
|
]);
|
|
244
|
-
function
|
|
245
|
-
switch (t ||
|
|
244
|
+
function Ys(s, e, t = null) {
|
|
245
|
+
switch (t || Ce(s)) {
|
|
246
246
|
case "Arguments":
|
|
247
247
|
case "Array":
|
|
248
248
|
case "Object":
|
|
249
|
-
return
|
|
249
|
+
return s[e];
|
|
250
250
|
case "Map":
|
|
251
|
-
return
|
|
251
|
+
return s.get(e);
|
|
252
252
|
case "Set":
|
|
253
253
|
return e;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
function xt(
|
|
257
|
-
return
|
|
256
|
+
function xt(s) {
|
|
257
|
+
return Xs.has(s);
|
|
258
258
|
}
|
|
259
|
-
function Bt(
|
|
260
|
-
switch (
|
|
259
|
+
function Bt(s, e, t, r = null) {
|
|
260
|
+
switch (r || Ce(s)) {
|
|
261
261
|
case "Arguments":
|
|
262
262
|
case "Array":
|
|
263
263
|
case "Object":
|
|
264
|
-
|
|
264
|
+
s[e] = t;
|
|
265
265
|
break;
|
|
266
266
|
case "Map":
|
|
267
|
-
|
|
267
|
+
s.set(e, t);
|
|
268
268
|
break;
|
|
269
269
|
case "Set":
|
|
270
|
-
|
|
270
|
+
s.add(t);
|
|
271
271
|
break;
|
|
272
272
|
}
|
|
273
|
-
return
|
|
273
|
+
return s;
|
|
274
274
|
}
|
|
275
|
-
const
|
|
276
|
-
function
|
|
277
|
-
return
|
|
275
|
+
const Qs = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, er = typeof global != "undefined" && global !== null && global.Object === Object && global, tr = typeof self != "undefined" && self !== null && self.Object === Object && self, yt = Qs || er || tr || Function("return this")();
|
|
276
|
+
function sr(s) {
|
|
277
|
+
return s.slice(0);
|
|
278
278
|
}
|
|
279
|
-
function
|
|
280
|
-
return new Boolean(
|
|
279
|
+
function rr(s) {
|
|
280
|
+
return new Boolean(s.valueOf());
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
return new DataView(
|
|
282
|
+
function nr(s) {
|
|
283
|
+
return new DataView(s.buffer);
|
|
284
284
|
}
|
|
285
|
-
function
|
|
286
|
-
return
|
|
285
|
+
function ar(s) {
|
|
286
|
+
return Ks(s);
|
|
287
287
|
}
|
|
288
|
-
function
|
|
289
|
-
return new Date(
|
|
288
|
+
function ir(s) {
|
|
289
|
+
return new Date(s.getTime());
|
|
290
290
|
}
|
|
291
|
-
function
|
|
292
|
-
return new Number(
|
|
291
|
+
function or(s) {
|
|
292
|
+
return new Number(s);
|
|
293
293
|
}
|
|
294
|
-
function
|
|
295
|
-
return new RegExp(
|
|
294
|
+
function cr(s) {
|
|
295
|
+
return new RegExp(s.source, s.flags);
|
|
296
296
|
}
|
|
297
|
-
function
|
|
298
|
-
return new String(
|
|
297
|
+
function ur(s) {
|
|
298
|
+
return new String(s);
|
|
299
299
|
}
|
|
300
|
-
function
|
|
301
|
-
return yt[e].from ? yt[e].from(
|
|
300
|
+
function te(s, e) {
|
|
301
|
+
return yt[e].from ? yt[e].from(s) : new yt[e](s);
|
|
302
302
|
}
|
|
303
|
-
function P(
|
|
304
|
-
return
|
|
303
|
+
function P(s) {
|
|
304
|
+
return s;
|
|
305
305
|
}
|
|
306
306
|
function qt() {
|
|
307
307
|
return [];
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function dr() {
|
|
310
310
|
return /* @__PURE__ */ new Map();
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function lr() {
|
|
313
313
|
return {};
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function fr() {
|
|
316
316
|
return /* @__PURE__ */ new Set();
|
|
317
317
|
}
|
|
318
|
-
const
|
|
318
|
+
const hr = /* @__PURE__ */ new Map([
|
|
319
319
|
// deep copy
|
|
320
|
-
["ArrayBuffer",
|
|
321
|
-
["Boolean",
|
|
322
|
-
["Buffer",
|
|
323
|
-
["DataView",
|
|
324
|
-
["Date",
|
|
325
|
-
["Number",
|
|
326
|
-
["RegExp",
|
|
327
|
-
["String",
|
|
320
|
+
["ArrayBuffer", sr],
|
|
321
|
+
["Boolean", rr],
|
|
322
|
+
["Buffer", ar],
|
|
323
|
+
["DataView", nr],
|
|
324
|
+
["Date", ir],
|
|
325
|
+
["Number", or],
|
|
326
|
+
["RegExp", cr],
|
|
327
|
+
["String", ur],
|
|
328
328
|
// typed arrays
|
|
329
329
|
// TODO: pass bound function
|
|
330
|
-
["Float32Array",
|
|
331
|
-
["Float64Array",
|
|
332
|
-
["Int16Array",
|
|
333
|
-
["Int32Array",
|
|
334
|
-
["Int8Array",
|
|
335
|
-
["Uint16Array",
|
|
336
|
-
["Uint32Array",
|
|
337
|
-
["Uint8Array",
|
|
338
|
-
["Uint8ClampedArray",
|
|
330
|
+
["Float32Array", te],
|
|
331
|
+
["Float64Array", te],
|
|
332
|
+
["Int16Array", te],
|
|
333
|
+
["Int32Array", te],
|
|
334
|
+
["Int8Array", te],
|
|
335
|
+
["Uint16Array", te],
|
|
336
|
+
["Uint32Array", te],
|
|
337
|
+
["Uint8Array", te],
|
|
338
|
+
["Uint8ClampedArray", te],
|
|
339
339
|
// shallow copy
|
|
340
340
|
["Array Iterator", P],
|
|
341
341
|
["Map Iterator", P],
|
|
@@ -358,9 +358,9 @@ const hs = /* @__PURE__ */ new Map([
|
|
|
358
358
|
// NOTE: return empty value, because recursively copy later.
|
|
359
359
|
["Arguments", qt],
|
|
360
360
|
["Array", qt],
|
|
361
|
-
["Map",
|
|
362
|
-
["Object",
|
|
363
|
-
["Set",
|
|
361
|
+
["Map", dr],
|
|
362
|
+
["Object", lr],
|
|
363
|
+
["Set", fr]
|
|
364
364
|
// NOTE: type-detect returns following types
|
|
365
365
|
// 'Location'
|
|
366
366
|
// 'Document'
|
|
@@ -372,19 +372,19 @@ const hs = /* @__PURE__ */ new Map([
|
|
|
372
372
|
// TODO: is type-detect never return 'object'?
|
|
373
373
|
// 'object'
|
|
374
374
|
]);
|
|
375
|
-
function
|
|
375
|
+
function pr() {
|
|
376
376
|
}
|
|
377
|
-
function kt(
|
|
377
|
+
function kt(s, e = null, t = pr) {
|
|
378
378
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
379
|
-
const
|
|
380
|
-
if (
|
|
381
|
-
const a = t(
|
|
379
|
+
const r = e || Ce(s), n = hr.get(r);
|
|
380
|
+
if (r === "Object") {
|
|
381
|
+
const a = t(s, r);
|
|
382
382
|
if (a !== void 0)
|
|
383
383
|
return a;
|
|
384
384
|
}
|
|
385
|
-
return n ? n(
|
|
385
|
+
return n ? n(s, r) : s;
|
|
386
386
|
}
|
|
387
|
-
function
|
|
387
|
+
function je(s, e = {}) {
|
|
388
388
|
typeof e == "function" && (e = {
|
|
389
389
|
customizer: e
|
|
390
390
|
});
|
|
@@ -393,44 +393,44 @@ function Re(r, e = {}) {
|
|
|
393
393
|
customizer: t
|
|
394
394
|
// TODO: max depth
|
|
395
395
|
// depth = Infinity,
|
|
396
|
-
} = e,
|
|
397
|
-
if (!xt(
|
|
398
|
-
return Tt(
|
|
399
|
-
const n = kt(
|
|
400
|
-
return Tt(
|
|
396
|
+
} = e, r = Ce(s);
|
|
397
|
+
if (!xt(r))
|
|
398
|
+
return Tt(s, null, null, null);
|
|
399
|
+
const n = kt(s, r, t), a = new WeakMap([[s, n]]), i = new WeakSet([s]);
|
|
400
|
+
return Tt(s, n, a, i);
|
|
401
401
|
}
|
|
402
|
-
function Tt(
|
|
403
|
-
const a =
|
|
402
|
+
function Tt(s, e, t, r, n) {
|
|
403
|
+
const a = Ce(s), i = kt(s, a);
|
|
404
404
|
if (!xt(a))
|
|
405
405
|
return i;
|
|
406
406
|
let o;
|
|
407
407
|
switch (a) {
|
|
408
408
|
case "Arguments":
|
|
409
409
|
case "Array":
|
|
410
|
-
o = Object.keys(
|
|
410
|
+
o = Object.keys(s);
|
|
411
411
|
break;
|
|
412
412
|
case "Object":
|
|
413
|
-
o = Object.keys(
|
|
413
|
+
o = Object.keys(s), o.push(...Object.getOwnPropertySymbols(s));
|
|
414
414
|
break;
|
|
415
415
|
case "Map":
|
|
416
416
|
case "Set":
|
|
417
|
-
o =
|
|
417
|
+
o = s.keys();
|
|
418
418
|
break;
|
|
419
419
|
}
|
|
420
420
|
for (let c of o) {
|
|
421
|
-
const
|
|
422
|
-
if (
|
|
423
|
-
Bt(e, c, t.get(
|
|
421
|
+
const u = Ys(s, c, a);
|
|
422
|
+
if (r.has(u))
|
|
423
|
+
Bt(e, c, t.get(u), a);
|
|
424
424
|
else {
|
|
425
|
-
const f =
|
|
426
|
-
xt(f) && (t.set(
|
|
425
|
+
const f = Ce(u), v = kt(u, f);
|
|
426
|
+
xt(f) && (t.set(u, v), r.add(u)), Bt(
|
|
427
427
|
e,
|
|
428
428
|
c,
|
|
429
429
|
Tt(
|
|
430
|
-
|
|
430
|
+
u,
|
|
431
431
|
v,
|
|
432
432
|
t,
|
|
433
|
-
|
|
433
|
+
r
|
|
434
434
|
),
|
|
435
435
|
a
|
|
436
436
|
);
|
|
@@ -438,36 +438,36 @@ function Tt(r, e, t, s, n) {
|
|
|
438
438
|
}
|
|
439
439
|
return e;
|
|
440
440
|
}
|
|
441
|
-
const
|
|
442
|
-
var
|
|
443
|
-
class
|
|
441
|
+
const mr = (s) => new Promise((e) => setTimeout(e, s));
|
|
442
|
+
var st, ge, rt, St, is;
|
|
443
|
+
class gr {
|
|
444
444
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
445
|
-
|
|
445
|
+
z(this, St), z(this, st), z(this, ge), z(this, rt), R(this, st, e), R(this, rt, t), R(this, ge, 0);
|
|
446
446
|
}
|
|
447
447
|
run() {
|
|
448
448
|
return N(this, null, function* () {
|
|
449
449
|
try {
|
|
450
|
-
return yield S(this,
|
|
450
|
+
return yield S(this, rt).call(this);
|
|
451
451
|
} catch (e) {
|
|
452
|
-
if (R(this,
|
|
452
|
+
if (R(this, ge, S(this, ge) + 1), S(this, ge) > S(this, st))
|
|
453
453
|
throw console.error("Max attempts reached"), e;
|
|
454
|
-
const t =
|
|
455
|
-
return yield
|
|
454
|
+
const t = K(this, St, is).call(this);
|
|
455
|
+
return yield mr(t), yield this.run();
|
|
456
456
|
}
|
|
457
457
|
});
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
|
|
461
|
-
return S(this,
|
|
460
|
+
st = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), is = function() {
|
|
461
|
+
return S(this, ge) * 1e3 * 1.5;
|
|
462
462
|
};
|
|
463
|
-
function
|
|
463
|
+
function yr() {
|
|
464
464
|
return typeof CompressionStream != "undefined";
|
|
465
465
|
}
|
|
466
|
-
function
|
|
466
|
+
function vr(s) {
|
|
467
467
|
return N(this, null, function* () {
|
|
468
|
-
const e = new Blob([
|
|
468
|
+
const e = new Blob([s]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
469
469
|
try {
|
|
470
|
-
for (var
|
|
470
|
+
for (var r = Vs(e), n, a, i; n = !(a = yield r.next()).done; n = !1) {
|
|
471
471
|
const o = a.value;
|
|
472
472
|
t.push(o);
|
|
473
473
|
}
|
|
@@ -475,29 +475,29 @@ function vs(r) {
|
|
|
475
475
|
i = [o];
|
|
476
476
|
} finally {
|
|
477
477
|
try {
|
|
478
|
-
n && (a =
|
|
478
|
+
n && (a = r.return) && (yield a.call(r));
|
|
479
479
|
} finally {
|
|
480
480
|
if (i)
|
|
481
481
|
throw i[0];
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
|
-
return yield
|
|
484
|
+
return yield _r(t);
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function _r(s) {
|
|
488
488
|
return N(this, null, function* () {
|
|
489
|
-
const e = yield new Blob(
|
|
489
|
+
const e = yield new Blob(s).arrayBuffer();
|
|
490
490
|
return new Uint8Array(e);
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
|
-
class
|
|
494
|
-
constructor({ resource: e, api: t, args:
|
|
495
|
-
if (super(`API Error on resource "${e}" at api "${t}"`), this.causeProperties = {}, this.name = "API Error", this.resource = e, this.api = t, this.cause = n, this.args =
|
|
493
|
+
class br extends Error {
|
|
494
|
+
constructor({ resource: e, api: t, args: r, cause: n }) {
|
|
495
|
+
if (super(`API Error on resource "${e}" at api "${t}"`), this.causeProperties = {}, this.name = "API Error", this.resource = e, this.api = t, this.cause = n, this.args = r, n instanceof 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((u, f) => {
|
|
500
|
+
c[f] = u;
|
|
501
501
|
}), this.causeProperties[i] = c;
|
|
502
502
|
} else
|
|
503
503
|
this.causeProperties[i] = o;
|
|
@@ -509,12 +509,12 @@ class Ht extends Error {
|
|
|
509
509
|
constructor({
|
|
510
510
|
url: e,
|
|
511
511
|
method: t,
|
|
512
|
-
statusCode:
|
|
512
|
+
statusCode: r,
|
|
513
513
|
requestHeaders: n,
|
|
514
514
|
responseHeaders: a,
|
|
515
515
|
body: i
|
|
516
516
|
}) {
|
|
517
|
-
if (super("Fetch Error"), this.name = "Fetch Error", this.url = e, this.method = t, this.statusNumber =
|
|
517
|
+
if (super("Fetch Error"), this.name = "Fetch Error", this.url = e, this.method = t, this.statusNumber = r, this.requestHeaders = n, this.responseHeaders = a, i)
|
|
518
518
|
try {
|
|
519
519
|
const o = JSON.parse(i);
|
|
520
520
|
this.body = o;
|
|
@@ -523,13 +523,13 @@ class Ht extends Error {
|
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
class
|
|
526
|
+
class Re extends Error {
|
|
527
527
|
constructor(e = {}) {
|
|
528
528
|
const { canceled: t = !1 } = e;
|
|
529
529
|
super("Abort Error"), this.name = "Abort Error", this.canceled = t;
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
|
-
class
|
|
532
|
+
class wr extends Error {
|
|
533
533
|
constructor(e) {
|
|
534
534
|
super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
|
|
535
535
|
}
|
|
@@ -539,7 +539,7 @@ class vt extends Error {
|
|
|
539
539
|
super(e), this.name = "Request Validation Error";
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function os() {
|
|
543
543
|
return Array.from(
|
|
544
544
|
{ length: 32 },
|
|
545
545
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
@@ -548,11 +548,11 @@ function or() {
|
|
|
548
548
|
function Et() {
|
|
549
549
|
return Math.floor(Date.now() / 1e3).toString();
|
|
550
550
|
}
|
|
551
|
-
const
|
|
552
|
-
var
|
|
553
|
-
class
|
|
551
|
+
const xr = 5 * 60 * 1e3, kr = 1 * 1e3;
|
|
552
|
+
var ye, D, J, At, Ct, Ze;
|
|
553
|
+
class Tr {
|
|
554
554
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
555
|
-
|
|
555
|
+
z(this, J), z(this, ye), z(this, D), this.baseAddress = t, R(this, ye, e), R(this, D, {}), this.plugins = [];
|
|
556
556
|
}
|
|
557
557
|
get headers() {
|
|
558
558
|
throw new Error("Missing implementation");
|
|
@@ -564,60 +564,60 @@ class Ts {
|
|
|
564
564
|
this.plugins = this.plugins.filter((t) => t.name !== e);
|
|
565
565
|
}
|
|
566
566
|
withOptions(e = {}) {
|
|
567
|
-
return R(this,
|
|
567
|
+
return R(this, D, e), this;
|
|
568
568
|
}
|
|
569
569
|
get(e) {
|
|
570
|
-
return N(this, arguments, function* (t,
|
|
571
|
-
const { overrideBaseAddress: n, overrideDefaultHeaders: a } =
|
|
570
|
+
return N(this, arguments, function* (t, r = {}) {
|
|
571
|
+
const { overrideBaseAddress: n, overrideDefaultHeaders: a } = r, i = n != null ? n : this.baseAddress;
|
|
572
572
|
let o = a != null ? a : this.headers;
|
|
573
|
-
const c =
|
|
574
|
-
return R(this,
|
|
573
|
+
const c = je(S(this, D));
|
|
574
|
+
return R(this, D, {}), c.extraHeaders && (o = V(V({}, o), c.extraHeaders)), c.requestValidation && (o = Zt(V({}, o), { "X-Request-Nonce": os(), "X-Request-Timestamp": Et() })), c.async ? yield K(this, J, Ct).call(this, `${i}${t}`, c.async, { headers: o }) : yield K(this, J, At).call(this, `${i}${t}`, c, { headers: o });
|
|
575
575
|
});
|
|
576
576
|
}
|
|
577
577
|
post(e, t) {
|
|
578
|
-
return N(this, arguments, function* (
|
|
579
|
-
const i =
|
|
580
|
-
return R(this,
|
|
578
|
+
return N(this, arguments, function* (r, n, a = {}) {
|
|
579
|
+
const i = je(S(this, D));
|
|
580
|
+
return R(this, D, {}), K(this, J, Ze).call(this, r, "POST", n, a, i);
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
583
|
put(e, t) {
|
|
584
|
-
return N(this, arguments, function* (
|
|
585
|
-
const i =
|
|
586
|
-
return R(this,
|
|
584
|
+
return N(this, arguments, function* (r, n, a = {}) {
|
|
585
|
+
const i = je(S(this, D));
|
|
586
|
+
return R(this, D, {}), K(this, J, Ze).call(this, r, "PUT", n, a, i);
|
|
587
587
|
});
|
|
588
588
|
}
|
|
589
589
|
delete(e, t) {
|
|
590
|
-
return N(this, arguments, function* (
|
|
591
|
-
const i =
|
|
592
|
-
return R(this,
|
|
590
|
+
return N(this, arguments, function* (r, n, a = {}) {
|
|
591
|
+
const i = je(S(this, D));
|
|
592
|
+
return R(this, D, {}), K(this, J, Ze).call(this, r, "DELETE", n, a, i);
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
595
|
patch(e, t) {
|
|
596
|
-
return N(this, arguments, function* (
|
|
597
|
-
const i =
|
|
598
|
-
return R(this,
|
|
596
|
+
return N(this, arguments, function* (r, n, a = {}) {
|
|
597
|
+
const i = je(S(this, D));
|
|
598
|
+
return R(this, D, {}), K(this, J, Ze).call(this, r, "PATCH", n, a, i);
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
601
|
}
|
|
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
|
-
const
|
|
605
|
-
var c,
|
|
604
|
+
const r = () => N(this, null, function* () {
|
|
605
|
+
var c, u;
|
|
606
606
|
try {
|
|
607
|
-
return yield S(this,
|
|
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
|
|
609
|
+
throw f instanceof Error && f.name === "AbortError" ? new Re({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : f;
|
|
610
610
|
}
|
|
611
|
-
}), { headers: n } = t != null ? t : {}, a = (c,
|
|
611
|
+
}), { headers: n } = t != null ? t : {}, a = (c, u) => {
|
|
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(u)) || ((v = c == null ? void 0 : c.headersObject) == null ? void 0 : v[u]) || "";
|
|
614
614
|
}, i = (c) => N(this, null, function* () {
|
|
615
|
-
var
|
|
615
|
+
var u;
|
|
616
616
|
if (!c.ok) {
|
|
617
617
|
const v = yield c.text().catch();
|
|
618
618
|
throw new Ht({
|
|
619
|
-
url:
|
|
620
|
-
method: (
|
|
619
|
+
url: s,
|
|
620
|
+
method: (u = t == null ? void 0 : t.method) != null ? u : "GET",
|
|
621
621
|
statusCode: c.status,
|
|
622
622
|
requestHeaders: n,
|
|
623
623
|
responseHeaders: c.headers,
|
|
@@ -629,8 +629,8 @@ _e = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), K = /* @_
|
|
|
629
629
|
const v = a(c, "x-response-nonce"), j = n == null ? void 0 : n["X-Request-Nonce"];
|
|
630
630
|
if (!v || v !== j)
|
|
631
631
|
throw new vt("Response nonce mismatch");
|
|
632
|
-
const M = Number(a(c, "x-response-timestamp")), F = Number(Et()),
|
|
633
|
-
if (isNaN(M) || Math.abs(F - M) >
|
|
632
|
+
const M = Number(a(c, "x-response-timestamp")), F = Number(Et()), W = 60 * 60 * 24;
|
|
633
|
+
if (isNaN(M) || Math.abs(F - M) > W)
|
|
634
634
|
throw new vt("Invalid response timestamp");
|
|
635
635
|
} catch (v) {
|
|
636
636
|
const j = v instanceof Error ? v.message : "Request validation failed";
|
|
@@ -644,34 +644,34 @@ _e = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), K = /* @_
|
|
|
644
644
|
return f;
|
|
645
645
|
});
|
|
646
646
|
if (e.retry) {
|
|
647
|
-
const c = yield new
|
|
647
|
+
const c = yield new gr({
|
|
648
648
|
maxAttempts: e.retry,
|
|
649
|
-
func:
|
|
649
|
+
func: r
|
|
650
650
|
}).run();
|
|
651
651
|
return yield i(c);
|
|
652
652
|
}
|
|
653
|
-
const o = yield
|
|
653
|
+
const o = yield r();
|
|
654
654
|
return yield i(o);
|
|
655
655
|
});
|
|
656
|
-
}, Ct = function(
|
|
656
|
+
}, Ct = function(s, e, t) {
|
|
657
657
|
return N(this, null, function* () {
|
|
658
|
-
var
|
|
658
|
+
var r, n;
|
|
659
659
|
const {
|
|
660
660
|
onProgress: a,
|
|
661
661
|
abortSignal: i,
|
|
662
|
-
pollingInterval: o = () =>
|
|
663
|
-
maxTimeout: c =
|
|
664
|
-
} = e,
|
|
662
|
+
pollingInterval: o = () => kr,
|
|
663
|
+
maxTimeout: c = xr
|
|
664
|
+
} = e, u = `${s}/async`, f = `${s}/async/job`;
|
|
665
665
|
let v;
|
|
666
666
|
try {
|
|
667
|
-
v = yield S(this,
|
|
667
|
+
v = yield S(this, ye).call(this, u, V(V({}, t), i && { signal: i }));
|
|
668
668
|
} catch (F) {
|
|
669
|
-
throw F instanceof Error && F.name === "AbortError" ? new
|
|
669
|
+
throw F instanceof Error && F.name === "AbortError" ? new Re({ canceled: (r = i == null ? void 0 : i.aborted) != null ? r : !1 }) : F;
|
|
670
670
|
}
|
|
671
671
|
if (!v.ok) {
|
|
672
672
|
const F = yield v.text().catch();
|
|
673
673
|
throw new Ht({
|
|
674
|
-
url:
|
|
674
|
+
url: s,
|
|
675
675
|
method: (n = t == null ? void 0 : t.method) != null ? n : "GET",
|
|
676
676
|
statusCode: v.status,
|
|
677
677
|
requestHeaders: this.headers,
|
|
@@ -682,147 +682,147 @@ _e = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), K = /* @_
|
|
|
682
682
|
const j = yield v.json(), { job_id: M } = j;
|
|
683
683
|
if (!M)
|
|
684
684
|
throw new Error("Job ID not found in response");
|
|
685
|
-
return new Promise((F,
|
|
686
|
-
const
|
|
687
|
-
|
|
688
|
-
}, c),
|
|
685
|
+
return new Promise((F, W) => N(this, null, function* () {
|
|
686
|
+
const ee = setTimeout(() => {
|
|
687
|
+
W(new Error("Job timed out"));
|
|
688
|
+
}, c), he = (ie = 0) => N(this, null, function* () {
|
|
689
689
|
if (i != null && i.aborted) {
|
|
690
|
-
clearTimeout(
|
|
691
|
-
|
|
692
|
-
}).catch((
|
|
693
|
-
|
|
690
|
+
clearTimeout(ee), S(this, ye).call(this, `${f}/${M}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
691
|
+
W(new Re({ canceled: !0 }));
|
|
692
|
+
}).catch((L) => {
|
|
693
|
+
W(new Re({ canceled: !1 }));
|
|
694
694
|
});
|
|
695
695
|
return;
|
|
696
696
|
}
|
|
697
697
|
try {
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
700
|
-
clearTimeout(
|
|
701
|
-
const
|
|
702
|
-
F(
|
|
703
|
-
} else if (
|
|
704
|
-
clearTimeout(
|
|
698
|
+
const L = yield (yield S(this, ye).call(this, `${f}/${M}`, { headers: this.headers })).json();
|
|
699
|
+
if (L.status === "success") {
|
|
700
|
+
clearTimeout(ee);
|
|
701
|
+
const oe = L.response_json;
|
|
702
|
+
F(oe);
|
|
703
|
+
} else if (L.status === "failed")
|
|
704
|
+
clearTimeout(ee), W(new wr(L.response_json));
|
|
705
705
|
else {
|
|
706
|
-
a && a(
|
|
707
|
-
const
|
|
708
|
-
setTimeout(() =>
|
|
706
|
+
a && a(L.response_json);
|
|
707
|
+
const oe = o(ie);
|
|
708
|
+
setTimeout(() => he(ie + 1), oe);
|
|
709
709
|
}
|
|
710
|
-
} catch (
|
|
711
|
-
|
|
710
|
+
} catch (L) {
|
|
711
|
+
W(L);
|
|
712
712
|
}
|
|
713
713
|
});
|
|
714
|
-
|
|
714
|
+
he();
|
|
715
715
|
}));
|
|
716
716
|
});
|
|
717
|
-
},
|
|
717
|
+
}, Ze = function(s, e, t, r, n) {
|
|
718
718
|
return N(this, null, function* () {
|
|
719
|
-
const { overrideBaseAddress: a, overrideDefaultHeaders: i } =
|
|
719
|
+
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = r, o = a != null ? a : this.baseAddress;
|
|
720
720
|
let c = i != null ? i : this.headers;
|
|
721
|
-
n.extraHeaders && (c =
|
|
722
|
-
let
|
|
723
|
-
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (
|
|
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 u = t;
|
|
723
|
+
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (u = r.skipBodyJsonStringify ? t : JSON.stringify(t), n.compress && yr() && (c["Content-Encoding"] = "gzip", u = yield vr(u))), 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
|
|
726
|
+
body: u
|
|
727
|
+
}) : yield K(this, J, At).call(this, `${o}${s}`, n, { method: e, headers: c, body: u });
|
|
728
728
|
});
|
|
729
729
|
};
|
|
730
|
-
const Jt = (
|
|
731
|
-
get(t,
|
|
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, {
|
|
731
|
+
get(t, r) {
|
|
732
732
|
return (...n) => {
|
|
733
733
|
var a;
|
|
734
|
-
for (const o of
|
|
735
|
-
const c = (a = o.beforeApi) == null ? void 0 : a.call(o, { resource: t.resourceName, api:
|
|
734
|
+
for (const o of s.plugins) {
|
|
735
|
+
const c = (a = o.beforeApi) == null ? void 0 : a.call(o, { resource: t.resourceName, api: r, args: n });
|
|
736
736
|
if (c !== void 0)
|
|
737
737
|
return c;
|
|
738
738
|
}
|
|
739
739
|
let i;
|
|
740
740
|
try {
|
|
741
|
-
i = t[
|
|
741
|
+
i = t[r](...n);
|
|
742
742
|
} catch (o) {
|
|
743
|
-
throw Jt(o, t.resourceName,
|
|
743
|
+
throw Jt(o, t.resourceName, r, n);
|
|
744
744
|
}
|
|
745
745
|
return i instanceof Promise ? i.catch((o) => {
|
|
746
|
-
throw Jt(o, t.resourceName,
|
|
746
|
+
throw Jt(o, t.resourceName, r, n);
|
|
747
747
|
}) : i;
|
|
748
748
|
};
|
|
749
749
|
}
|
|
750
750
|
});
|
|
751
|
-
var
|
|
752
|
-
class
|
|
751
|
+
var Me;
|
|
752
|
+
class Sr {
|
|
753
753
|
constructor(e) {
|
|
754
|
-
|
|
754
|
+
z(this, Me), this.resourceName = "Files", R(this, Me, e);
|
|
755
755
|
}
|
|
756
756
|
get(e) {
|
|
757
|
-
return N(this, arguments, function* ({ fileKey: t, params:
|
|
758
|
-
const n = new URLSearchParams(
|
|
757
|
+
return N(this, arguments, function* ({ fileKey: t, params: r = {} }) {
|
|
758
|
+
const n = new URLSearchParams(V({
|
|
759
759
|
plugin_data: "857346721138427857"
|
|
760
|
-
},
|
|
761
|
-
return yield S(this,
|
|
760
|
+
}, r)).toString(), a = `v1/files/${t}?${n}`;
|
|
761
|
+
return yield S(this, Me).get(a);
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
getImageFills(e) {
|
|
765
765
|
return N(this, arguments, function* ({ fileKey: t }) {
|
|
766
|
-
var
|
|
766
|
+
var r, n;
|
|
767
767
|
const a = `v1/files/${t}/images`;
|
|
768
|
-
return (n = (
|
|
768
|
+
return (n = (r = (yield S(this, Me).get(a)).meta) == null ? void 0 : r.images) != null ? n : {};
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
|
-
|
|
773
|
-
const
|
|
774
|
-
const
|
|
775
|
-
return `${
|
|
776
|
-
},
|
|
777
|
-
var
|
|
778
|
-
class
|
|
772
|
+
Me = /* @__PURE__ */ new WeakMap();
|
|
773
|
+
const Er = (s, e, t) => {
|
|
774
|
+
const r = e.sort();
|
|
775
|
+
return `${s}-${r.join("-")}-${t}`;
|
|
776
|
+
}, Ar = (s) => s ? s.ts > Date.now() - 1e3 * 30 : !1;
|
|
777
|
+
var G, It, cs;
|
|
778
|
+
class Cr {
|
|
779
779
|
constructor(e) {
|
|
780
|
-
|
|
780
|
+
z(this, It), z(this, G), this.resourceName = "Images", R(this, G, e);
|
|
781
781
|
}
|
|
782
782
|
/**
|
|
783
783
|
* Return the URL for the _layer_ images for the given nodes.
|
|
784
784
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
785
785
|
*/
|
|
786
786
|
get(e) {
|
|
787
|
-
return N(this, arguments, function* ({ fileKey: t, nodeIds:
|
|
788
|
-
const i =
|
|
789
|
-
if (
|
|
787
|
+
return N(this, arguments, function* ({ fileKey: t, nodeIds: r, format: n = "jpg", scale: a }) {
|
|
788
|
+
const i = Er(t, r, n), o = S(this, G).cache.images.entries.get(i);
|
|
789
|
+
if (Ar(o))
|
|
790
790
|
return o.result;
|
|
791
|
-
o && S(this,
|
|
792
|
-
const c = S(this,
|
|
791
|
+
o && S(this, G).cache.images.entries.delete(i);
|
|
792
|
+
const c = S(this, G).cache.images.pendingRequests.get(i);
|
|
793
793
|
if (c)
|
|
794
794
|
return c;
|
|
795
|
-
const
|
|
796
|
-
S(this,
|
|
795
|
+
const u = K(this, It, cs).call(this, i, t, r, n, a);
|
|
796
|
+
S(this, G).cache.images.pendingRequests.set(i, u);
|
|
797
797
|
try {
|
|
798
|
-
return yield
|
|
798
|
+
return yield u;
|
|
799
799
|
} finally {
|
|
800
|
-
S(this,
|
|
800
|
+
S(this, G).cache.images.pendingRequests.delete(i);
|
|
801
801
|
}
|
|
802
802
|
});
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
|
-
|
|
805
|
+
G = /* @__PURE__ */ new WeakMap(), It = /* @__PURE__ */ new WeakSet(), cs = function(s, e, t, r, n) {
|
|
806
806
|
return N(this, null, function* () {
|
|
807
|
-
const a = yield S(this,
|
|
808
|
-
`v1/images/${e}?ids=${t}&format=${
|
|
807
|
+
const a = yield S(this, G).get(
|
|
808
|
+
`v1/images/${e}?ids=${t}&format=${r}${n ? `&scale=${n}` : ""}`
|
|
809
809
|
);
|
|
810
|
-
return S(this,
|
|
810
|
+
return S(this, G).cache.images.entries.set(s, {
|
|
811
811
|
result: a,
|
|
812
812
|
ts: Date.now()
|
|
813
813
|
}), a;
|
|
814
814
|
});
|
|
815
815
|
};
|
|
816
816
|
var nt;
|
|
817
|
-
class
|
|
817
|
+
class Ir {
|
|
818
818
|
constructor(e) {
|
|
819
|
-
|
|
819
|
+
z(this, nt), this.resourceName = "Nodes", R(this, nt, e);
|
|
820
820
|
}
|
|
821
821
|
get(e) {
|
|
822
|
-
return N(this, arguments, function* ({ fileKey: t, nodeIds:
|
|
823
|
-
const a = Zt(
|
|
824
|
-
ids:
|
|
825
|
-
}), i = new URLSearchParams(
|
|
822
|
+
return N(this, arguments, function* ({ fileKey: t, nodeIds: r, params: n = {} }) {
|
|
823
|
+
const a = Zt(V({}, n), {
|
|
824
|
+
ids: r.join(",")
|
|
825
|
+
}), i = new URLSearchParams(V({
|
|
826
826
|
plugin_data: "857346721138427857"
|
|
827
827
|
}, a)).toString(), o = `v1/files/${t}/nodes?${i}`;
|
|
828
828
|
return yield S(this, nt).get(o);
|
|
@@ -830,40 +830,40 @@ class Is {
|
|
|
830
830
|
}
|
|
831
831
|
}
|
|
832
832
|
nt = /* @__PURE__ */ new WeakMap();
|
|
833
|
-
var
|
|
834
|
-
class
|
|
833
|
+
var ce;
|
|
834
|
+
class us extends Tr {
|
|
835
835
|
constructor({
|
|
836
836
|
baseAddress: e = "https://api.figma.com/",
|
|
837
837
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
838
838
|
} = {}) {
|
|
839
|
-
super({ fetch: t, baseAddress: e }),
|
|
839
|
+
super({ fetch: t, baseAddress: e }), z(this, ce, ""), this.cache = {
|
|
840
840
|
images: {
|
|
841
841
|
entries: /* @__PURE__ */ new Map(),
|
|
842
842
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
843
843
|
}
|
|
844
|
-
}, this.files = _t(this, new
|
|
844
|
+
}, this.files = _t(this, new Sr(this)), this.nodes = _t(this, new Ir(this)), this.images = _t(this, new Cr(this));
|
|
845
845
|
}
|
|
846
846
|
set token(e) {
|
|
847
847
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
848
848
|
throw new Error("Invalid Figma access token");
|
|
849
|
-
R(this,
|
|
849
|
+
R(this, ce, e);
|
|
850
850
|
}
|
|
851
851
|
get token() {
|
|
852
|
-
return S(this,
|
|
852
|
+
return S(this, ce);
|
|
853
853
|
}
|
|
854
854
|
get headers() {
|
|
855
855
|
const e = {
|
|
856
856
|
"Content-Type": "application/json"
|
|
857
857
|
};
|
|
858
|
-
return S(this,
|
|
858
|
+
return S(this, ce).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = S(this, ce) : S(this, ce).startsWith("figu_") && (e.Authorization = `Bearer ${S(this, ce)}`), e;
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
|
-
|
|
862
|
-
const
|
|
863
|
-
fileKey:
|
|
861
|
+
ce = /* @__PURE__ */ new WeakMap();
|
|
862
|
+
const Or = (a) => I(void 0, [a], function* ({
|
|
863
|
+
fileKey: s,
|
|
864
864
|
authToken: e,
|
|
865
|
-
figmaRestApi: t = new
|
|
866
|
-
params:
|
|
865
|
+
figmaRestApi: t = new us(),
|
|
866
|
+
params: r = {},
|
|
867
867
|
signal: n
|
|
868
868
|
}) {
|
|
869
869
|
e && (t.token = e);
|
|
@@ -871,84 +871,84 @@ const Os = (a) => C(void 0, [a], function* ({
|
|
|
871
871
|
return yield t.withOptions({
|
|
872
872
|
abortSignal: n
|
|
873
873
|
}).files.get({
|
|
874
|
-
fileKey:
|
|
875
|
-
params:
|
|
874
|
+
fileKey: s,
|
|
875
|
+
params: r
|
|
876
876
|
});
|
|
877
877
|
} catch (i) {
|
|
878
|
-
throw i instanceof Error && i.name === "AbortError" ? i : (console.error(i),
|
|
878
|
+
throw i instanceof Error && i.name === "AbortError" ? i : (console.error(i), ns(i, s));
|
|
879
879
|
}
|
|
880
|
-
}),
|
|
881
|
-
fileKey:
|
|
880
|
+
}), ea = (i) => I(void 0, [i], function* ({
|
|
881
|
+
fileKey: s,
|
|
882
882
|
authToken: e,
|
|
883
883
|
nodeIds: t,
|
|
884
|
-
figmaRestApi:
|
|
884
|
+
figmaRestApi: r = new us(),
|
|
885
885
|
params: n = {},
|
|
886
886
|
signal: a
|
|
887
887
|
}) {
|
|
888
|
-
e && (
|
|
888
|
+
e && (r.token = e);
|
|
889
889
|
try {
|
|
890
|
-
return (yield
|
|
890
|
+
return (yield r.withOptions({
|
|
891
891
|
abortSignal: a
|
|
892
892
|
}).nodes.get({
|
|
893
|
-
fileKey:
|
|
893
|
+
fileKey: s,
|
|
894
894
|
nodeIds: t,
|
|
895
|
-
params:
|
|
895
|
+
params: d({}, n)
|
|
896
896
|
})).nodes;
|
|
897
897
|
} catch (o) {
|
|
898
|
-
throw o instanceof Error && o.name === "AbortError" ? o :
|
|
899
|
-
}
|
|
900
|
-
}),
|
|
901
|
-
if (
|
|
902
|
-
return
|
|
903
|
-
if ("children" in
|
|
904
|
-
for (const t of
|
|
905
|
-
const
|
|
906
|
-
if (
|
|
907
|
-
return
|
|
898
|
+
throw o instanceof Error && o.name === "AbortError" ? o : ns(o, s);
|
|
899
|
+
}
|
|
900
|
+
}), ds = (s, e) => {
|
|
901
|
+
if (s.id === e)
|
|
902
|
+
return s;
|
|
903
|
+
if ("children" in s)
|
|
904
|
+
for (const t of s.children) {
|
|
905
|
+
const r = ds(t, e);
|
|
906
|
+
if (r)
|
|
907
|
+
return r;
|
|
908
908
|
}
|
|
909
909
|
return null;
|
|
910
910
|
};
|
|
911
|
-
var
|
|
912
|
-
(function(
|
|
913
|
-
|
|
911
|
+
var k;
|
|
912
|
+
(function(s) {
|
|
913
|
+
s.assertEqual = (n) => n;
|
|
914
914
|
function e(n) {
|
|
915
915
|
}
|
|
916
|
-
|
|
916
|
+
s.assertIs = e;
|
|
917
917
|
function t(n) {
|
|
918
918
|
throw new Error();
|
|
919
919
|
}
|
|
920
|
-
|
|
920
|
+
s.assertNever = t, s.arrayToEnum = (n) => {
|
|
921
921
|
const a = {};
|
|
922
922
|
for (const i of n)
|
|
923
923
|
a[i] = i;
|
|
924
924
|
return a;
|
|
925
|
-
},
|
|
926
|
-
const a =
|
|
925
|
+
}, s.getValidEnumValues = (n) => {
|
|
926
|
+
const a = s.objectKeys(n).filter((o) => typeof n[n[o]] != "number"), i = {};
|
|
927
927
|
for (const o of a)
|
|
928
928
|
i[o] = n[o];
|
|
929
|
-
return
|
|
930
|
-
},
|
|
929
|
+
return s.objectValues(i);
|
|
930
|
+
}, s.objectValues = (n) => s.objectKeys(n).map(function(a) {
|
|
931
931
|
return n[a];
|
|
932
|
-
}),
|
|
932
|
+
}), s.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
|
|
933
933
|
const a = [];
|
|
934
934
|
for (const i in n)
|
|
935
935
|
Object.prototype.hasOwnProperty.call(n, i) && a.push(i);
|
|
936
936
|
return a;
|
|
937
|
-
},
|
|
937
|
+
}, s.find = (n, a) => {
|
|
938
938
|
for (const i of n)
|
|
939
939
|
if (a(i))
|
|
940
940
|
return i;
|
|
941
|
-
},
|
|
942
|
-
function
|
|
941
|
+
}, s.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && isFinite(n) && Math.floor(n) === n;
|
|
942
|
+
function r(n, a = " | ") {
|
|
943
943
|
return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
944
944
|
}
|
|
945
|
-
|
|
946
|
-
})(
|
|
945
|
+
s.joinValues = r, s.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
|
|
946
|
+
})(k || (k = {}));
|
|
947
947
|
var Ot;
|
|
948
|
-
(function(
|
|
949
|
-
|
|
948
|
+
(function(s) {
|
|
949
|
+
s.mergeShapes = (e, t) => d(d({}, e), t);
|
|
950
950
|
})(Ot || (Ot = {}));
|
|
951
|
-
const p =
|
|
951
|
+
const p = k.arrayToEnum([
|
|
952
952
|
"string",
|
|
953
953
|
"nan",
|
|
954
954
|
"number",
|
|
@@ -969,14 +969,14 @@ const p = x.arrayToEnum([
|
|
|
969
969
|
"never",
|
|
970
970
|
"map",
|
|
971
971
|
"set"
|
|
972
|
-
]),
|
|
973
|
-
switch (typeof
|
|
972
|
+
]), re = (s) => {
|
|
973
|
+
switch (typeof s) {
|
|
974
974
|
case "undefined":
|
|
975
975
|
return p.undefined;
|
|
976
976
|
case "string":
|
|
977
977
|
return p.string;
|
|
978
978
|
case "number":
|
|
979
|
-
return isNaN(
|
|
979
|
+
return isNaN(s) ? p.nan : p.number;
|
|
980
980
|
case "boolean":
|
|
981
981
|
return p.boolean;
|
|
982
982
|
case "function":
|
|
@@ -986,11 +986,11 @@ const p = x.arrayToEnum([
|
|
|
986
986
|
case "symbol":
|
|
987
987
|
return p.symbol;
|
|
988
988
|
case "object":
|
|
989
|
-
return Array.isArray(
|
|
989
|
+
return Array.isArray(s) ? p.array : s === null ? p.null : s.then && typeof s.then == "function" && s.catch && typeof s.catch == "function" ? p.promise : typeof Map != "undefined" && s instanceof Map ? p.map : typeof Set != "undefined" && s instanceof Set ? p.set : typeof Date != "undefined" && s instanceof Date ? p.date : p.object;
|
|
990
990
|
default:
|
|
991
991
|
return p.unknown;
|
|
992
992
|
}
|
|
993
|
-
}, l =
|
|
993
|
+
}, l = k.arrayToEnum([
|
|
994
994
|
"invalid_type",
|
|
995
995
|
"invalid_literal",
|
|
996
996
|
"custom",
|
|
@@ -1007,16 +1007,16 @@ const p = x.arrayToEnum([
|
|
|
1007
1007
|
"invalid_intersection_types",
|
|
1008
1008
|
"not_multiple_of",
|
|
1009
1009
|
"not_finite"
|
|
1010
|
-
]),
|
|
1011
|
-
class
|
|
1010
|
+
]), Nr = (s) => JSON.stringify(s, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
1011
|
+
class U extends Error {
|
|
1012
1012
|
get errors() {
|
|
1013
1013
|
return this.issues;
|
|
1014
1014
|
}
|
|
1015
1015
|
constructor(e) {
|
|
1016
|
-
super(), this.issues = [], this.addIssue = (
|
|
1017
|
-
this.issues = [...this.issues,
|
|
1018
|
-
}, this.addIssues = (
|
|
1019
|
-
this.issues = [...this.issues, ...
|
|
1016
|
+
super(), this.issues = [], this.addIssue = (r) => {
|
|
1017
|
+
this.issues = [...this.issues, r];
|
|
1018
|
+
}, this.addIssues = (r = []) => {
|
|
1019
|
+
this.issues = [...this.issues, ...r];
|
|
1020
1020
|
};
|
|
1021
1021
|
const t = new.target.prototype;
|
|
1022
1022
|
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
@@ -1024,7 +1024,7 @@ class W extends Error {
|
|
|
1024
1024
|
format(e) {
|
|
1025
1025
|
const t = e || function(a) {
|
|
1026
1026
|
return a.message;
|
|
1027
|
-
},
|
|
1027
|
+
}, r = { _errors: [] }, n = (a) => {
|
|
1028
1028
|
for (const i of a.issues)
|
|
1029
1029
|
if (i.code === "invalid_union")
|
|
1030
1030
|
i.unionErrors.map(n);
|
|
@@ -1033,61 +1033,61 @@ class W extends Error {
|
|
|
1033
1033
|
else if (i.code === "invalid_arguments")
|
|
1034
1034
|
n(i.argumentsError);
|
|
1035
1035
|
else if (i.path.length === 0)
|
|
1036
|
-
|
|
1036
|
+
r._errors.push(t(i));
|
|
1037
1037
|
else {
|
|
1038
|
-
let o =
|
|
1038
|
+
let o = r, c = 0;
|
|
1039
1039
|
for (; c < i.path.length; ) {
|
|
1040
|
-
const
|
|
1041
|
-
c === i.path.length - 1 ? (o[
|
|
1040
|
+
const u = i.path[c];
|
|
1041
|
+
c === i.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(t(i))) : o[u] = o[u] || { _errors: [] }, o = o[u], c++;
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
1044
1044
|
};
|
|
1045
|
-
return n(this),
|
|
1045
|
+
return n(this), r;
|
|
1046
1046
|
}
|
|
1047
1047
|
static assert(e) {
|
|
1048
|
-
if (!(e instanceof
|
|
1048
|
+
if (!(e instanceof U))
|
|
1049
1049
|
throw new Error(`Not a ZodError: ${e}`);
|
|
1050
1050
|
}
|
|
1051
1051
|
toString() {
|
|
1052
1052
|
return this.message;
|
|
1053
1053
|
}
|
|
1054
1054
|
get message() {
|
|
1055
|
-
return JSON.stringify(this.issues,
|
|
1055
|
+
return JSON.stringify(this.issues, k.jsonStringifyReplacer, 2);
|
|
1056
1056
|
}
|
|
1057
1057
|
get isEmpty() {
|
|
1058
1058
|
return this.issues.length === 0;
|
|
1059
1059
|
}
|
|
1060
1060
|
flatten(e = (t) => t.message) {
|
|
1061
|
-
const t = {},
|
|
1061
|
+
const t = {}, r = [];
|
|
1062
1062
|
for (const n of this.issues)
|
|
1063
|
-
n.path.length > 0 ? (t[n.path[0]] = t[n.path[0]] || [], t[n.path[0]].push(e(n))) :
|
|
1064
|
-
return { formErrors:
|
|
1063
|
+
n.path.length > 0 ? (t[n.path[0]] = t[n.path[0]] || [], t[n.path[0]].push(e(n))) : r.push(e(n));
|
|
1064
|
+
return { formErrors: r, fieldErrors: t };
|
|
1065
1065
|
}
|
|
1066
1066
|
get formErrors() {
|
|
1067
1067
|
return this.flatten();
|
|
1068
1068
|
}
|
|
1069
1069
|
}
|
|
1070
|
-
|
|
1071
|
-
const
|
|
1070
|
+
U.create = (s) => new U(s);
|
|
1071
|
+
const Ie = (s, e) => {
|
|
1072
1072
|
let t;
|
|
1073
|
-
switch (
|
|
1073
|
+
switch (s.code) {
|
|
1074
1074
|
case l.invalid_type:
|
|
1075
|
-
|
|
1075
|
+
s.received === p.undefined ? t = "Required" : t = `Expected ${s.expected}, received ${s.received}`;
|
|
1076
1076
|
break;
|
|
1077
1077
|
case l.invalid_literal:
|
|
1078
|
-
t = `Invalid literal value, expected ${JSON.stringify(
|
|
1078
|
+
t = `Invalid literal value, expected ${JSON.stringify(s.expected, k.jsonStringifyReplacer)}`;
|
|
1079
1079
|
break;
|
|
1080
1080
|
case l.unrecognized_keys:
|
|
1081
|
-
t = `Unrecognized key(s) in object: ${
|
|
1081
|
+
t = `Unrecognized key(s) in object: ${k.joinValues(s.keys, ", ")}`;
|
|
1082
1082
|
break;
|
|
1083
1083
|
case l.invalid_union:
|
|
1084
1084
|
t = "Invalid input";
|
|
1085
1085
|
break;
|
|
1086
1086
|
case l.invalid_union_discriminator:
|
|
1087
|
-
t = `Invalid discriminator value. Expected ${
|
|
1087
|
+
t = `Invalid discriminator value. Expected ${k.joinValues(s.options)}`;
|
|
1088
1088
|
break;
|
|
1089
1089
|
case l.invalid_enum_value:
|
|
1090
|
-
t = `Invalid enum value. Expected ${
|
|
1090
|
+
t = `Invalid enum value. Expected ${k.joinValues(s.options)}, received '${s.received}'`;
|
|
1091
1091
|
break;
|
|
1092
1092
|
case l.invalid_arguments:
|
|
1093
1093
|
t = "Invalid function arguments";
|
|
@@ -1099,13 +1099,13 @@ const Oe = (r, e) => {
|
|
|
1099
1099
|
t = "Invalid date";
|
|
1100
1100
|
break;
|
|
1101
1101
|
case l.invalid_string:
|
|
1102
|
-
typeof
|
|
1102
|
+
typeof s.validation == "object" ? "includes" in s.validation ? (t = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? t = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? t = `Invalid input: must end with "${s.validation.endsWith}"` : k.assertNever(s.validation) : s.validation !== "regex" ? t = `Invalid ${s.validation}` : t = "Invalid";
|
|
1103
1103
|
break;
|
|
1104
1104
|
case l.too_small:
|
|
1105
|
-
|
|
1105
|
+
s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "more than"} ${s.minimum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "over"} ${s.minimum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(s.minimum))}` : t = "Invalid input";
|
|
1106
1106
|
break;
|
|
1107
1107
|
case l.too_big:
|
|
1108
|
-
|
|
1108
|
+
s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "less than"} ${s.maximum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "under"} ${s.maximum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "bigint" ? t = `BigInt must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly" : s.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(s.maximum))}` : t = "Invalid input";
|
|
1109
1109
|
break;
|
|
1110
1110
|
case l.custom:
|
|
1111
1111
|
t = "Invalid input";
|
|
@@ -1114,58 +1114,58 @@ const Oe = (r, e) => {
|
|
|
1114
1114
|
t = "Intersection results could not be merged";
|
|
1115
1115
|
break;
|
|
1116
1116
|
case l.not_multiple_of:
|
|
1117
|
-
t = `Number must be a multiple of ${
|
|
1117
|
+
t = `Number must be a multiple of ${s.multipleOf}`;
|
|
1118
1118
|
break;
|
|
1119
1119
|
case l.not_finite:
|
|
1120
1120
|
t = "Number must be finite";
|
|
1121
1121
|
break;
|
|
1122
1122
|
default:
|
|
1123
|
-
t = e.defaultError,
|
|
1123
|
+
t = e.defaultError, k.assertNever(s);
|
|
1124
1124
|
}
|
|
1125
1125
|
return { message: t };
|
|
1126
1126
|
};
|
|
1127
|
-
let
|
|
1128
|
-
function
|
|
1129
|
-
|
|
1127
|
+
let ls = Ie;
|
|
1128
|
+
function jr(s) {
|
|
1129
|
+
ls = s;
|
|
1130
1130
|
}
|
|
1131
1131
|
function at() {
|
|
1132
|
-
return
|
|
1132
|
+
return ls;
|
|
1133
1133
|
}
|
|
1134
|
-
const it = (
|
|
1135
|
-
const { data: e, path: t, errorMaps:
|
|
1134
|
+
const it = (s) => {
|
|
1135
|
+
const { data: e, path: t, errorMaps: r, issueData: n } = s, a = [...t, ...n.path || []], i = g(d({}, n), {
|
|
1136
1136
|
path: a
|
|
1137
1137
|
});
|
|
1138
1138
|
if (n.message !== void 0)
|
|
1139
|
-
return g(
|
|
1139
|
+
return g(d({}, n), {
|
|
1140
1140
|
path: a,
|
|
1141
1141
|
message: n.message
|
|
1142
1142
|
});
|
|
1143
1143
|
let o = "";
|
|
1144
|
-
const c =
|
|
1145
|
-
for (const
|
|
1146
|
-
o =
|
|
1147
|
-
return g(
|
|
1144
|
+
const c = r.filter((u) => !!u).slice().reverse();
|
|
1145
|
+
for (const u of c)
|
|
1146
|
+
o = u(i, { data: e, defaultError: o }).message;
|
|
1147
|
+
return g(d({}, n), {
|
|
1148
1148
|
path: a,
|
|
1149
1149
|
message: o
|
|
1150
1150
|
});
|
|
1151
|
-
},
|
|
1152
|
-
function h(
|
|
1153
|
-
const t = at(),
|
|
1151
|
+
}, Rr = [];
|
|
1152
|
+
function h(s, e) {
|
|
1153
|
+
const t = at(), r = it({
|
|
1154
1154
|
issueData: e,
|
|
1155
|
-
data:
|
|
1156
|
-
path:
|
|
1155
|
+
data: s.data,
|
|
1156
|
+
path: s.path,
|
|
1157
1157
|
errorMaps: [
|
|
1158
|
-
|
|
1158
|
+
s.common.contextualErrorMap,
|
|
1159
1159
|
// contextual error map is first priority
|
|
1160
|
-
|
|
1160
|
+
s.schemaErrorMap,
|
|
1161
1161
|
// then schema-bound map if available
|
|
1162
1162
|
t,
|
|
1163
1163
|
// then global override map
|
|
1164
|
-
t ===
|
|
1164
|
+
t === Ie ? void 0 : Ie
|
|
1165
1165
|
// then global default map
|
|
1166
1166
|
].filter((n) => !!n)
|
|
1167
1167
|
});
|
|
1168
|
-
|
|
1168
|
+
s.common.issues.push(r);
|
|
1169
1169
|
}
|
|
1170
1170
|
class Z {
|
|
1171
1171
|
constructor() {
|
|
@@ -1178,101 +1178,101 @@ class Z {
|
|
|
1178
1178
|
this.value !== "aborted" && (this.value = "aborted");
|
|
1179
1179
|
}
|
|
1180
1180
|
static mergeArray(e, t) {
|
|
1181
|
-
const
|
|
1181
|
+
const r = [];
|
|
1182
1182
|
for (const n of t) {
|
|
1183
1183
|
if (n.status === "aborted")
|
|
1184
1184
|
return _;
|
|
1185
|
-
n.status === "dirty" && e.dirty(),
|
|
1185
|
+
n.status === "dirty" && e.dirty(), r.push(n.value);
|
|
1186
1186
|
}
|
|
1187
|
-
return { status: e.value, value:
|
|
1187
|
+
return { status: e.value, value: r };
|
|
1188
1188
|
}
|
|
1189
1189
|
static mergeObjectAsync(e, t) {
|
|
1190
|
-
return
|
|
1191
|
-
const
|
|
1190
|
+
return I(this, null, function* () {
|
|
1191
|
+
const r = [];
|
|
1192
1192
|
for (const n of t) {
|
|
1193
1193
|
const a = yield n.key, i = yield n.value;
|
|
1194
|
-
|
|
1194
|
+
r.push({
|
|
1195
1195
|
key: a,
|
|
1196
1196
|
value: i
|
|
1197
1197
|
});
|
|
1198
1198
|
}
|
|
1199
|
-
return Z.mergeObjectSync(e,
|
|
1199
|
+
return Z.mergeObjectSync(e, r);
|
|
1200
1200
|
});
|
|
1201
1201
|
}
|
|
1202
1202
|
static mergeObjectSync(e, t) {
|
|
1203
|
-
const
|
|
1203
|
+
const r = {};
|
|
1204
1204
|
for (const n of t) {
|
|
1205
1205
|
const { key: a, value: i } = n;
|
|
1206
1206
|
if (a.status === "aborted" || i.status === "aborted")
|
|
1207
1207
|
return _;
|
|
1208
|
-
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value != "undefined" || n.alwaysSet) && (
|
|
1208
|
+
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value != "undefined" || n.alwaysSet) && (r[a.value] = i.value);
|
|
1209
1209
|
}
|
|
1210
|
-
return { status: e.value, value:
|
|
1210
|
+
return { status: e.value, value: r };
|
|
1211
1211
|
}
|
|
1212
1212
|
}
|
|
1213
1213
|
const _ = Object.freeze({
|
|
1214
1214
|
status: "aborted"
|
|
1215
|
-
}),
|
|
1216
|
-
function ot(
|
|
1217
|
-
if (typeof e == "function" ?
|
|
1218
|
-
return e.get(
|
|
1215
|
+
}), Ee = (s) => ({ status: "dirty", value: s }), $ = (s) => ({ status: "valid", value: s }), Nt = (s) => s.status === "aborted", jt = (s) => s.status === "dirty", _e = (s) => s.status === "valid", De = (s) => typeof Promise != "undefined" && s instanceof Promise;
|
|
1216
|
+
function ot(s, e, t, r) {
|
|
1217
|
+
if (typeof e == "function" ? s !== e || !0 : !e.has(s)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1218
|
+
return e.get(s);
|
|
1219
1219
|
}
|
|
1220
|
-
function
|
|
1221
|
-
if (typeof e == "function" ?
|
|
1222
|
-
return e.set(
|
|
1220
|
+
function fs(s, e, t, r, n) {
|
|
1221
|
+
if (typeof e == "function" ? s !== e || !0 : !e.has(s)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1222
|
+
return e.set(s, t), t;
|
|
1223
1223
|
}
|
|
1224
1224
|
var m;
|
|
1225
|
-
(function(
|
|
1226
|
-
|
|
1225
|
+
(function(s) {
|
|
1226
|
+
s.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, s.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
1227
1227
|
})(m || (m = {}));
|
|
1228
|
-
var $e
|
|
1229
|
-
class
|
|
1230
|
-
constructor(e, t,
|
|
1231
|
-
this._cachedPath = [], this.parent = e, this.data = t, this._path =
|
|
1228
|
+
var Pe, $e;
|
|
1229
|
+
class Y {
|
|
1230
|
+
constructor(e, t, r, n) {
|
|
1231
|
+
this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = n;
|
|
1232
1232
|
}
|
|
1233
1233
|
get path() {
|
|
1234
1234
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
|
-
const Gt = (
|
|
1238
|
-
if (
|
|
1237
|
+
const Gt = (s, e) => {
|
|
1238
|
+
if (_e(e))
|
|
1239
1239
|
return { success: !0, data: e.value };
|
|
1240
|
-
if (!
|
|
1240
|
+
if (!s.common.issues.length)
|
|
1241
1241
|
throw new Error("Validation failed but no issues detected.");
|
|
1242
1242
|
return {
|
|
1243
1243
|
success: !1,
|
|
1244
1244
|
get error() {
|
|
1245
1245
|
if (this._error)
|
|
1246
1246
|
return this._error;
|
|
1247
|
-
const t = new
|
|
1247
|
+
const t = new U(s.common.issues);
|
|
1248
1248
|
return this._error = t, this._error;
|
|
1249
1249
|
}
|
|
1250
1250
|
};
|
|
1251
1251
|
};
|
|
1252
|
-
function
|
|
1253
|
-
if (!
|
|
1252
|
+
function w(s) {
|
|
1253
|
+
if (!s)
|
|
1254
1254
|
return {};
|
|
1255
|
-
const { errorMap: e, invalid_type_error: t, required_error:
|
|
1256
|
-
if (e && (t ||
|
|
1255
|
+
const { errorMap: e, invalid_type_error: t, required_error: r, description: n } = s;
|
|
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,
|
|
1260
|
-
const { message: f } =
|
|
1261
|
-
return i.code === "invalid_enum_value" ? { message: f != null ? f : o.defaultError } : typeof o.data == "undefined" ? { message: (c = f != null ? f :
|
|
1259
|
+
var c, u;
|
|
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: (u = f != null ? f : t) !== null && u !== void 0 ? u : o.defaultError };
|
|
1262
1262
|
}, description: n };
|
|
1263
1263
|
}
|
|
1264
|
-
class
|
|
1264
|
+
class x {
|
|
1265
1265
|
get description() {
|
|
1266
1266
|
return this._def.description;
|
|
1267
1267
|
}
|
|
1268
1268
|
_getType(e) {
|
|
1269
|
-
return
|
|
1269
|
+
return re(e.data);
|
|
1270
1270
|
}
|
|
1271
1271
|
_getOrReturnCtx(e, t) {
|
|
1272
1272
|
return t || {
|
|
1273
1273
|
common: e.parent.common,
|
|
1274
1274
|
data: e.data,
|
|
1275
|
-
parsedType:
|
|
1275
|
+
parsedType: re(e.data),
|
|
1276
1276
|
schemaErrorMap: this._def.errorMap,
|
|
1277
1277
|
path: e.path,
|
|
1278
1278
|
parent: e.parent
|
|
@@ -1284,7 +1284,7 @@ class w {
|
|
|
1284
1284
|
ctx: {
|
|
1285
1285
|
common: e.parent.common,
|
|
1286
1286
|
data: e.data,
|
|
1287
|
-
parsedType:
|
|
1287
|
+
parsedType: re(e.data),
|
|
1288
1288
|
schemaErrorMap: this._def.errorMap,
|
|
1289
1289
|
path: e.path,
|
|
1290
1290
|
parent: e.parent
|
|
@@ -1293,7 +1293,7 @@ class w {
|
|
|
1293
1293
|
}
|
|
1294
1294
|
_parseSync(e) {
|
|
1295
1295
|
const t = this._parse(e);
|
|
1296
|
-
if (
|
|
1296
|
+
if (De(t))
|
|
1297
1297
|
throw new Error("Synchronous parse encountered promise.");
|
|
1298
1298
|
return t;
|
|
1299
1299
|
}
|
|
@@ -1302,29 +1302,29 @@ class w {
|
|
|
1302
1302
|
return Promise.resolve(t);
|
|
1303
1303
|
}
|
|
1304
1304
|
parse(e, t) {
|
|
1305
|
-
const
|
|
1306
|
-
if (
|
|
1307
|
-
return
|
|
1308
|
-
throw
|
|
1305
|
+
const r = this.safeParse(e, t);
|
|
1306
|
+
if (r.success)
|
|
1307
|
+
return r.data;
|
|
1308
|
+
throw r.error;
|
|
1309
1309
|
}
|
|
1310
1310
|
safeParse(e, t) {
|
|
1311
|
-
var
|
|
1311
|
+
var r;
|
|
1312
1312
|
const n = {
|
|
1313
1313
|
common: {
|
|
1314
1314
|
issues: [],
|
|
1315
|
-
async: (
|
|
1315
|
+
async: (r = t == null ? void 0 : t.async) !== null && r !== void 0 ? r : !1,
|
|
1316
1316
|
contextualErrorMap: t == null ? void 0 : t.errorMap
|
|
1317
1317
|
},
|
|
1318
1318
|
path: (t == null ? void 0 : t.path) || [],
|
|
1319
1319
|
schemaErrorMap: this._def.errorMap,
|
|
1320
1320
|
parent: null,
|
|
1321
1321
|
data: e,
|
|
1322
|
-
parsedType:
|
|
1322
|
+
parsedType: re(e)
|
|
1323
1323
|
}, a = this._parseSync({ data: e, path: n.path, parent: n });
|
|
1324
1324
|
return Gt(n, a);
|
|
1325
1325
|
}
|
|
1326
1326
|
"~validate"(e) {
|
|
1327
|
-
var t,
|
|
1327
|
+
var t, r;
|
|
1328
1328
|
const n = {
|
|
1329
1329
|
common: {
|
|
1330
1330
|
issues: [],
|
|
@@ -1334,39 +1334,39 @@ class w {
|
|
|
1334
1334
|
schemaErrorMap: this._def.errorMap,
|
|
1335
1335
|
parent: null,
|
|
1336
1336
|
data: e,
|
|
1337
|
-
parsedType:
|
|
1337
|
+
parsedType: re(e)
|
|
1338
1338
|
};
|
|
1339
1339
|
if (!this["~standard"].async)
|
|
1340
1340
|
try {
|
|
1341
1341
|
const a = this._parseSync({ data: e, path: [], parent: n });
|
|
1342
|
-
return
|
|
1342
|
+
return _e(a) ? {
|
|
1343
1343
|
value: a.value
|
|
1344
1344
|
} : {
|
|
1345
1345
|
issues: n.common.issues
|
|
1346
1346
|
};
|
|
1347
1347
|
} catch (a) {
|
|
1348
|
-
!((
|
|
1348
|
+
!((r = (t = a == null ? void 0 : a.message) === null || t === void 0 ? void 0 : t.toLowerCase()) === null || r === void 0) && r.includes("encountered") && (this["~standard"].async = !0), n.common = {
|
|
1349
1349
|
issues: [],
|
|
1350
1350
|
async: !0
|
|
1351
1351
|
};
|
|
1352
1352
|
}
|
|
1353
|
-
return this._parseAsync({ data: e, path: [], parent: n }).then((a) =>
|
|
1353
|
+
return this._parseAsync({ data: e, path: [], parent: n }).then((a) => _e(a) ? {
|
|
1354
1354
|
value: a.value
|
|
1355
1355
|
} : {
|
|
1356
1356
|
issues: n.common.issues
|
|
1357
1357
|
});
|
|
1358
1358
|
}
|
|
1359
1359
|
parseAsync(e, t) {
|
|
1360
|
-
return
|
|
1361
|
-
const
|
|
1362
|
-
if (
|
|
1363
|
-
return
|
|
1364
|
-
throw
|
|
1360
|
+
return I(this, null, function* () {
|
|
1361
|
+
const r = yield this.safeParseAsync(e, t);
|
|
1362
|
+
if (r.success)
|
|
1363
|
+
return r.data;
|
|
1364
|
+
throw r.error;
|
|
1365
1365
|
});
|
|
1366
1366
|
}
|
|
1367
1367
|
safeParseAsync(e, t) {
|
|
1368
|
-
return
|
|
1369
|
-
const
|
|
1368
|
+
return I(this, null, function* () {
|
|
1369
|
+
const r = {
|
|
1370
1370
|
common: {
|
|
1371
1371
|
issues: [],
|
|
1372
1372
|
contextualErrorMap: t == null ? void 0 : t.errorMap,
|
|
@@ -1376,25 +1376,25 @@ class w {
|
|
|
1376
1376
|
schemaErrorMap: this._def.errorMap,
|
|
1377
1377
|
parent: null,
|
|
1378
1378
|
data: e,
|
|
1379
|
-
parsedType:
|
|
1380
|
-
}, n = this._parse({ data: e, path:
|
|
1381
|
-
return Gt(
|
|
1379
|
+
parsedType: re(e)
|
|
1380
|
+
}, n = this._parse({ data: e, path: r.path, parent: r }), a = yield De(n) ? n : Promise.resolve(n);
|
|
1381
|
+
return Gt(r, a);
|
|
1382
1382
|
});
|
|
1383
1383
|
}
|
|
1384
1384
|
refine(e, t) {
|
|
1385
|
-
const
|
|
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(d({
|
|
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);
|
|
1391
1391
|
});
|
|
1392
1392
|
}
|
|
1393
1393
|
refinement(e, t) {
|
|
1394
|
-
return this._refinement((
|
|
1394
|
+
return this._refinement((r, n) => e(r) ? !0 : (n.addIssue(typeof t == "function" ? t(r, n) : t), !1));
|
|
1395
1395
|
}
|
|
1396
1396
|
_refinement(e) {
|
|
1397
|
-
return new
|
|
1397
|
+
return new H({
|
|
1398
1398
|
schema: this,
|
|
1399
1399
|
typeName: y.ZodEffects,
|
|
1400
1400
|
effect: { type: "refinement", refinement: e }
|
|
@@ -1411,28 +1411,28 @@ class w {
|
|
|
1411
1411
|
};
|
|
1412
1412
|
}
|
|
1413
1413
|
optional() {
|
|
1414
|
-
return
|
|
1414
|
+
return X.create(this, this._def);
|
|
1415
1415
|
}
|
|
1416
1416
|
nullable() {
|
|
1417
|
-
return
|
|
1417
|
+
return fe.create(this, this._def);
|
|
1418
1418
|
}
|
|
1419
1419
|
nullish() {
|
|
1420
1420
|
return this.nullable().optional();
|
|
1421
1421
|
}
|
|
1422
1422
|
array() {
|
|
1423
|
-
return
|
|
1423
|
+
return q.create(this);
|
|
1424
1424
|
}
|
|
1425
1425
|
promise() {
|
|
1426
|
-
return
|
|
1426
|
+
return Ne.create(this, this._def);
|
|
1427
1427
|
}
|
|
1428
1428
|
or(e) {
|
|
1429
|
-
return
|
|
1429
|
+
return We.create([this, e], this._def);
|
|
1430
1430
|
}
|
|
1431
1431
|
and(e) {
|
|
1432
|
-
return
|
|
1432
|
+
return ze.create(this, e, this._def);
|
|
1433
1433
|
}
|
|
1434
1434
|
transform(e) {
|
|
1435
|
-
return new
|
|
1435
|
+
return new H(g(d({}, w(this._def)), {
|
|
1436
1436
|
schema: this,
|
|
1437
1437
|
typeName: y.ZodEffects,
|
|
1438
1438
|
effect: { type: "transform", transform: e }
|
|
@@ -1440,21 +1440,21 @@ class w {
|
|
|
1440
1440
|
}
|
|
1441
1441
|
default(e) {
|
|
1442
1442
|
const t = typeof e == "function" ? e : () => e;
|
|
1443
|
-
return new
|
|
1443
|
+
return new Ge(g(d({}, 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(d({
|
|
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
|
|
1457
|
+
return new Ke(g(d({}, w(this._def)), {
|
|
1458
1458
|
innerType: this,
|
|
1459
1459
|
catchValue: t,
|
|
1460
1460
|
typeName: y.ZodCatch
|
|
@@ -1462,15 +1462,15 @@ class w {
|
|
|
1462
1462
|
}
|
|
1463
1463
|
describe(e) {
|
|
1464
1464
|
const t = this.constructor;
|
|
1465
|
-
return new t(g(
|
|
1465
|
+
return new t(g(d({}, this._def), {
|
|
1466
1466
|
description: e
|
|
1467
1467
|
}));
|
|
1468
1468
|
}
|
|
1469
1469
|
pipe(e) {
|
|
1470
|
-
return
|
|
1470
|
+
return Qe.create(this, e);
|
|
1471
1471
|
}
|
|
1472
1472
|
readonly() {
|
|
1473
|
-
return
|
|
1473
|
+
return Xe.create(this);
|
|
1474
1474
|
}
|
|
1475
1475
|
isOptional() {
|
|
1476
1476
|
return this.safeParse(void 0).success;
|
|
@@ -1479,38 +1479,38 @@ class w {
|
|
|
1479
1479
|
return this.safeParse(null).success;
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
|
-
const
|
|
1482
|
+
const Zr = /^c[^\s-]{8,}$/i, Mr = /^[0-9a-z]+$/, Pr = /^[0-9A-HJKMNP-TV-Z]{26}$/i, $r = /^[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, Fr = /^[a-z0-9_-]{21}$/i, Dr = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Lr = /^[-+]?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)?)??$/, Vr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ur = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1483
1483
|
let bt;
|
|
1484
|
-
const
|
|
1485
|
-
function
|
|
1484
|
+
const Wr = /^(?:(?: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])$/, zr = /^(?:(?: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])$/, Br = /^(([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]))$/, qr = /^(([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])$/, Hr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Jr = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, hs = "((\\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])))", Gr = new RegExp(`^${hs}$`);
|
|
1485
|
+
function ps(s) {
|
|
1486
1486
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
1487
|
-
return
|
|
1487
|
+
return s.precision ? e = `${e}\\.\\d{${s.precision}}` : s.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
1488
1488
|
}
|
|
1489
|
-
function
|
|
1490
|
-
return new RegExp(`^${
|
|
1489
|
+
function Kr(s) {
|
|
1490
|
+
return new RegExp(`^${ps(s)}$`);
|
|
1491
1491
|
}
|
|
1492
|
-
function
|
|
1493
|
-
let e = `${
|
|
1492
|
+
function ms(s) {
|
|
1493
|
+
let e = `${hs}T${ps(s)}`;
|
|
1494
1494
|
const t = [];
|
|
1495
|
-
return t.push(
|
|
1495
|
+
return t.push(s.local ? "Z?" : "Z"), s.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
1496
1496
|
}
|
|
1497
|
-
function
|
|
1498
|
-
return !!((e === "v4" || !e) &&
|
|
1497
|
+
function Xr(s, e) {
|
|
1498
|
+
return !!((e === "v4" || !e) && Wr.test(s) || (e === "v6" || !e) && Br.test(s));
|
|
1499
1499
|
}
|
|
1500
|
-
function
|
|
1501
|
-
if (!
|
|
1500
|
+
function Yr(s, e) {
|
|
1501
|
+
if (!Dr.test(s))
|
|
1502
1502
|
return !1;
|
|
1503
1503
|
try {
|
|
1504
|
-
const [t] =
|
|
1504
|
+
const [t] = s.split("."), r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), n = JSON.parse(atob(r));
|
|
1505
1505
|
return !(typeof n != "object" || n === null || !n.typ || !n.alg || e && n.alg !== e);
|
|
1506
1506
|
} catch (t) {
|
|
1507
1507
|
return !1;
|
|
1508
1508
|
}
|
|
1509
1509
|
}
|
|
1510
|
-
function
|
|
1511
|
-
return !!((e === "v4" || !e) &&
|
|
1510
|
+
function Qr(s, e) {
|
|
1511
|
+
return !!((e === "v4" || !e) && zr.test(s) || (e === "v6" || !e) && qr.test(s));
|
|
1512
1512
|
}
|
|
1513
|
-
class
|
|
1513
|
+
class B extends x {
|
|
1514
1514
|
_parse(e) {
|
|
1515
1515
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
|
|
1516
1516
|
const a = this._getOrReturnCtx(e);
|
|
@@ -1520,7 +1520,7 @@ class H extends w {
|
|
|
1520
1520
|
received: a.parsedType
|
|
1521
1521
|
}), _;
|
|
1522
1522
|
}
|
|
1523
|
-
const
|
|
1523
|
+
const r = new Z();
|
|
1524
1524
|
let n;
|
|
1525
1525
|
for (const a of this._def.checks)
|
|
1526
1526
|
if (a.kind === "min")
|
|
@@ -1531,7 +1531,7 @@ class H extends w {
|
|
|
1531
1531
|
inclusive: !0,
|
|
1532
1532
|
exact: !1,
|
|
1533
1533
|
message: a.message
|
|
1534
|
-
}),
|
|
1534
|
+
}), r.dirty());
|
|
1535
1535
|
else if (a.kind === "max")
|
|
1536
1536
|
e.data.length > a.value && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1537
1537
|
code: l.too_big,
|
|
@@ -1540,7 +1540,7 @@ class H extends w {
|
|
|
1540
1540
|
inclusive: !0,
|
|
1541
1541
|
exact: !1,
|
|
1542
1542
|
message: a.message
|
|
1543
|
-
}),
|
|
1543
|
+
}), r.dirty());
|
|
1544
1544
|
else if (a.kind === "length") {
|
|
1545
1545
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
1546
1546
|
(i || o) && (n = this._getOrReturnCtx(e, n), i ? h(n, {
|
|
@@ -1557,49 +1557,49 @@ class H extends w {
|
|
|
1557
1557
|
inclusive: !0,
|
|
1558
1558
|
exact: !0,
|
|
1559
1559
|
message: a.message
|
|
1560
|
-
}),
|
|
1560
|
+
}), r.dirty());
|
|
1561
1561
|
} else if (a.kind === "email")
|
|
1562
|
-
|
|
1562
|
+
Vr.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1563
1563
|
validation: "email",
|
|
1564
1564
|
code: l.invalid_string,
|
|
1565
1565
|
message: a.message
|
|
1566
|
-
}),
|
|
1566
|
+
}), r.dirty());
|
|
1567
1567
|
else if (a.kind === "emoji")
|
|
1568
|
-
bt || (bt = new RegExp(
|
|
1568
|
+
bt || (bt = new RegExp(Ur, "u")), bt.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1569
1569
|
validation: "emoji",
|
|
1570
1570
|
code: l.invalid_string,
|
|
1571
1571
|
message: a.message
|
|
1572
|
-
}),
|
|
1572
|
+
}), r.dirty());
|
|
1573
1573
|
else if (a.kind === "uuid")
|
|
1574
|
-
$
|
|
1574
|
+
$r.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1575
1575
|
validation: "uuid",
|
|
1576
1576
|
code: l.invalid_string,
|
|
1577
1577
|
message: a.message
|
|
1578
|
-
}),
|
|
1578
|
+
}), r.dirty());
|
|
1579
1579
|
else if (a.kind === "nanoid")
|
|
1580
|
-
|
|
1580
|
+
Fr.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1581
1581
|
validation: "nanoid",
|
|
1582
1582
|
code: l.invalid_string,
|
|
1583
1583
|
message: a.message
|
|
1584
|
-
}),
|
|
1584
|
+
}), r.dirty());
|
|
1585
1585
|
else if (a.kind === "cuid")
|
|
1586
|
-
|
|
1586
|
+
Zr.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1587
1587
|
validation: "cuid",
|
|
1588
1588
|
code: l.invalid_string,
|
|
1589
1589
|
message: a.message
|
|
1590
|
-
}),
|
|
1590
|
+
}), r.dirty());
|
|
1591
1591
|
else if (a.kind === "cuid2")
|
|
1592
|
-
|
|
1592
|
+
Mr.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1593
1593
|
validation: "cuid2",
|
|
1594
1594
|
code: l.invalid_string,
|
|
1595
1595
|
message: a.message
|
|
1596
|
-
}),
|
|
1596
|
+
}), r.dirty());
|
|
1597
1597
|
else if (a.kind === "ulid")
|
|
1598
|
-
|
|
1598
|
+
Pr.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1599
1599
|
validation: "ulid",
|
|
1600
1600
|
code: l.invalid_string,
|
|
1601
1601
|
message: a.message
|
|
1602
|
-
}),
|
|
1602
|
+
}), r.dirty());
|
|
1603
1603
|
else if (a.kind === "url")
|
|
1604
1604
|
try {
|
|
1605
1605
|
new URL(e.data);
|
|
@@ -1608,128 +1608,128 @@ class H extends w {
|
|
|
1608
1608
|
validation: "url",
|
|
1609
1609
|
code: l.invalid_string,
|
|
1610
1610
|
message: a.message
|
|
1611
|
-
}),
|
|
1611
|
+
}), r.dirty();
|
|
1612
1612
|
}
|
|
1613
1613
|
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1614
1614
|
validation: "regex",
|
|
1615
1615
|
code: l.invalid_string,
|
|
1616
1616
|
message: a.message
|
|
1617
|
-
}),
|
|
1617
|
+
}), r.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1618
1618
|
code: l.invalid_string,
|
|
1619
1619
|
validation: { includes: a.value, position: a.position },
|
|
1620
1620
|
message: a.message
|
|
1621
|
-
}),
|
|
1621
|
+
}), r.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) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1622
1622
|
code: l.invalid_string,
|
|
1623
1623
|
validation: { startsWith: a.value },
|
|
1624
1624
|
message: a.message
|
|
1625
|
-
}),
|
|
1625
|
+
}), r.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1626
1626
|
code: l.invalid_string,
|
|
1627
1627
|
validation: { endsWith: a.value },
|
|
1628
1628
|
message: a.message
|
|
1629
|
-
}),
|
|
1629
|
+
}), r.dirty()) : a.kind === "datetime" ? ms(a).test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1630
1630
|
code: l.invalid_string,
|
|
1631
1631
|
validation: "datetime",
|
|
1632
1632
|
message: a.message
|
|
1633
|
-
}),
|
|
1633
|
+
}), r.dirty()) : a.kind === "date" ? Gr.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1634
1634
|
code: l.invalid_string,
|
|
1635
1635
|
validation: "date",
|
|
1636
1636
|
message: a.message
|
|
1637
|
-
}),
|
|
1637
|
+
}), r.dirty()) : a.kind === "time" ? Kr(a).test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1638
1638
|
code: l.invalid_string,
|
|
1639
1639
|
validation: "time",
|
|
1640
1640
|
message: a.message
|
|
1641
|
-
}),
|
|
1641
|
+
}), r.dirty()) : a.kind === "duration" ? Lr.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1642
1642
|
validation: "duration",
|
|
1643
1643
|
code: l.invalid_string,
|
|
1644
1644
|
message: a.message
|
|
1645
|
-
}),
|
|
1645
|
+
}), r.dirty()) : a.kind === "ip" ? Xr(e.data, a.version) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1646
1646
|
validation: "ip",
|
|
1647
1647
|
code: l.invalid_string,
|
|
1648
1648
|
message: a.message
|
|
1649
|
-
}),
|
|
1649
|
+
}), r.dirty()) : a.kind === "jwt" ? Yr(e.data, a.alg) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1650
1650
|
validation: "jwt",
|
|
1651
1651
|
code: l.invalid_string,
|
|
1652
1652
|
message: a.message
|
|
1653
|
-
}),
|
|
1653
|
+
}), r.dirty()) : a.kind === "cidr" ? Qr(e.data, a.version) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1654
1654
|
validation: "cidr",
|
|
1655
1655
|
code: l.invalid_string,
|
|
1656
1656
|
message: a.message
|
|
1657
|
-
}),
|
|
1657
|
+
}), r.dirty()) : a.kind === "base64" ? Hr.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1658
1658
|
validation: "base64",
|
|
1659
1659
|
code: l.invalid_string,
|
|
1660
1660
|
message: a.message
|
|
1661
|
-
}),
|
|
1661
|
+
}), r.dirty()) : a.kind === "base64url" ? Jr.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1662
1662
|
validation: "base64url",
|
|
1663
1663
|
code: l.invalid_string,
|
|
1664
1664
|
message: a.message
|
|
1665
|
-
}),
|
|
1666
|
-
return { status:
|
|
1665
|
+
}), r.dirty()) : k.assertNever(a);
|
|
1666
|
+
return { status: r.value, value: e.data };
|
|
1667
1667
|
}
|
|
1668
|
-
_regex(e, t,
|
|
1669
|
-
return this.refinement((n) => e.test(n),
|
|
1668
|
+
_regex(e, t, r) {
|
|
1669
|
+
return this.refinement((n) => e.test(n), d({
|
|
1670
1670
|
validation: t,
|
|
1671
1671
|
code: l.invalid_string
|
|
1672
|
-
}, m.errToObj(
|
|
1672
|
+
}, m.errToObj(r)));
|
|
1673
1673
|
}
|
|
1674
1674
|
_addCheck(e) {
|
|
1675
|
-
return new
|
|
1675
|
+
return new B(g(d({}, 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(d({ kind: "email" }, m.errToObj(e)));
|
|
1681
1681
|
}
|
|
1682
1682
|
url(e) {
|
|
1683
|
-
return this._addCheck(
|
|
1683
|
+
return this._addCheck(d({ kind: "url" }, m.errToObj(e)));
|
|
1684
1684
|
}
|
|
1685
1685
|
emoji(e) {
|
|
1686
|
-
return this._addCheck(
|
|
1686
|
+
return this._addCheck(d({ kind: "emoji" }, m.errToObj(e)));
|
|
1687
1687
|
}
|
|
1688
1688
|
uuid(e) {
|
|
1689
|
-
return this._addCheck(
|
|
1689
|
+
return this._addCheck(d({ kind: "uuid" }, m.errToObj(e)));
|
|
1690
1690
|
}
|
|
1691
1691
|
nanoid(e) {
|
|
1692
|
-
return this._addCheck(
|
|
1692
|
+
return this._addCheck(d({ kind: "nanoid" }, m.errToObj(e)));
|
|
1693
1693
|
}
|
|
1694
1694
|
cuid(e) {
|
|
1695
|
-
return this._addCheck(
|
|
1695
|
+
return this._addCheck(d({ kind: "cuid" }, m.errToObj(e)));
|
|
1696
1696
|
}
|
|
1697
1697
|
cuid2(e) {
|
|
1698
|
-
return this._addCheck(
|
|
1698
|
+
return this._addCheck(d({ kind: "cuid2" }, m.errToObj(e)));
|
|
1699
1699
|
}
|
|
1700
1700
|
ulid(e) {
|
|
1701
|
-
return this._addCheck(
|
|
1701
|
+
return this._addCheck(d({ kind: "ulid" }, m.errToObj(e)));
|
|
1702
1702
|
}
|
|
1703
1703
|
base64(e) {
|
|
1704
|
-
return this._addCheck(
|
|
1704
|
+
return this._addCheck(d({ kind: "base64" }, m.errToObj(e)));
|
|
1705
1705
|
}
|
|
1706
1706
|
base64url(e) {
|
|
1707
|
-
return this._addCheck(
|
|
1707
|
+
return this._addCheck(d({
|
|
1708
1708
|
kind: "base64url"
|
|
1709
1709
|
}, m.errToObj(e)));
|
|
1710
1710
|
}
|
|
1711
1711
|
jwt(e) {
|
|
1712
|
-
return this._addCheck(
|
|
1712
|
+
return this._addCheck(d({ kind: "jwt" }, m.errToObj(e)));
|
|
1713
1713
|
}
|
|
1714
1714
|
ip(e) {
|
|
1715
|
-
return this._addCheck(
|
|
1715
|
+
return this._addCheck(d({ kind: "ip" }, m.errToObj(e)));
|
|
1716
1716
|
}
|
|
1717
1717
|
cidr(e) {
|
|
1718
|
-
return this._addCheck(
|
|
1718
|
+
return this._addCheck(d({ kind: "cidr" }, m.errToObj(e)));
|
|
1719
1719
|
}
|
|
1720
1720
|
datetime(e) {
|
|
1721
|
-
var t,
|
|
1721
|
+
var t, r;
|
|
1722
1722
|
return typeof e == "string" ? this._addCheck({
|
|
1723
1723
|
kind: "datetime",
|
|
1724
1724
|
precision: null,
|
|
1725
1725
|
offset: !1,
|
|
1726
1726
|
local: !1,
|
|
1727
1727
|
message: e
|
|
1728
|
-
}) : this._addCheck(
|
|
1728
|
+
}) : this._addCheck(d({
|
|
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,
|
|
1732
|
-
local: (
|
|
1732
|
+
local: (r = e == null ? void 0 : e.local) !== null && r !== void 0 ? r : !1
|
|
1733
1733
|
}, m.errToObj(e == null ? void 0 : e.message)));
|
|
1734
1734
|
}
|
|
1735
1735
|
date(e) {
|
|
@@ -1740,53 +1740,53 @@ class H extends w {
|
|
|
1740
1740
|
kind: "time",
|
|
1741
1741
|
precision: null,
|
|
1742
1742
|
message: e
|
|
1743
|
-
}) : this._addCheck(
|
|
1743
|
+
}) : this._addCheck(d({
|
|
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(d({ kind: "duration" }, m.errToObj(e)));
|
|
1750
1750
|
}
|
|
1751
1751
|
regex(e, t) {
|
|
1752
|
-
return this._addCheck(
|
|
1752
|
+
return this._addCheck(d({
|
|
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(d({
|
|
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(d({
|
|
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(d({
|
|
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(d({
|
|
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(d({
|
|
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(d({
|
|
1790
1790
|
kind: "length",
|
|
1791
1791
|
value: e
|
|
1792
1792
|
}, m.errToObj(t)));
|
|
@@ -1798,17 +1798,17 @@ class H extends w {
|
|
|
1798
1798
|
return this.min(1, m.errToObj(e));
|
|
1799
1799
|
}
|
|
1800
1800
|
trim() {
|
|
1801
|
-
return new
|
|
1801
|
+
return new B(g(d({}, this._def), {
|
|
1802
1802
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1803
1803
|
}));
|
|
1804
1804
|
}
|
|
1805
1805
|
toLowerCase() {
|
|
1806
|
-
return new
|
|
1806
|
+
return new B(g(d({}, this._def), {
|
|
1807
1807
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1808
1808
|
}));
|
|
1809
1809
|
}
|
|
1810
1810
|
toUpperCase() {
|
|
1811
|
-
return new
|
|
1811
|
+
return new B(g(d({}, this._def), {
|
|
1812
1812
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1813
1813
|
}));
|
|
1814
1814
|
}
|
|
@@ -1873,19 +1873,19 @@ class H extends w {
|
|
|
1873
1873
|
return e;
|
|
1874
1874
|
}
|
|
1875
1875
|
}
|
|
1876
|
-
|
|
1876
|
+
B.create = (s) => {
|
|
1877
1877
|
var e;
|
|
1878
|
-
return new
|
|
1878
|
+
return new B(d({
|
|
1879
1879
|
checks: [],
|
|
1880
1880
|
typeName: y.ZodString,
|
|
1881
|
-
coerce: (e =
|
|
1882
|
-
},
|
|
1881
|
+
coerce: (e = s == null ? void 0 : s.coerce) !== null && e !== void 0 ? e : !1
|
|
1882
|
+
}, w(s)));
|
|
1883
1883
|
};
|
|
1884
|
-
function en(
|
|
1885
|
-
const t = (
|
|
1884
|
+
function en(s, e) {
|
|
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 ue extends x {
|
|
1889
1889
|
constructor() {
|
|
1890
1890
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1891
1891
|
}
|
|
@@ -1898,36 +1898,36 @@ class le extends w {
|
|
|
1898
1898
|
received: a.parsedType
|
|
1899
1899
|
}), _;
|
|
1900
1900
|
}
|
|
1901
|
-
let
|
|
1901
|
+
let r;
|
|
1902
1902
|
const n = new Z();
|
|
1903
1903
|
for (const a of this._def.checks)
|
|
1904
|
-
a.kind === "int" ?
|
|
1904
|
+
a.kind === "int" ? k.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1905
1905
|
code: l.invalid_type,
|
|
1906
1906
|
expected: "integer",
|
|
1907
1907
|
received: "float",
|
|
1908
1908
|
message: a.message
|
|
1909
|
-
}), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (
|
|
1909
|
+
}), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1910
1910
|
code: l.too_small,
|
|
1911
1911
|
minimum: a.value,
|
|
1912
1912
|
type: "number",
|
|
1913
1913
|
inclusive: a.inclusive,
|
|
1914
1914
|
exact: !1,
|
|
1915
1915
|
message: a.message
|
|
1916
|
-
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (
|
|
1916
|
+
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1917
1917
|
code: l.too_big,
|
|
1918
1918
|
maximum: a.value,
|
|
1919
1919
|
type: "number",
|
|
1920
1920
|
inclusive: a.inclusive,
|
|
1921
1921
|
exact: !1,
|
|
1922
1922
|
message: a.message
|
|
1923
|
-
}), n.dirty()) : a.kind === "multipleOf" ? en(e.data, a.value) !== 0 && (
|
|
1923
|
+
}), n.dirty()) : a.kind === "multipleOf" ? en(e.data, a.value) !== 0 && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1924
1924
|
code: l.not_multiple_of,
|
|
1925
1925
|
multipleOf: a.value,
|
|
1926
1926
|
message: a.message
|
|
1927
|
-
}), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (
|
|
1927
|
+
}), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1928
1928
|
code: l.not_finite,
|
|
1929
1929
|
message: a.message
|
|
1930
|
-
}), n.dirty()) :
|
|
1930
|
+
}), n.dirty()) : k.assertNever(a);
|
|
1931
1931
|
return { status: n.value, value: e.data };
|
|
1932
1932
|
}
|
|
1933
1933
|
gte(e, t) {
|
|
@@ -1942,21 +1942,21 @@ class le extends w {
|
|
|
1942
1942
|
lt(e, t) {
|
|
1943
1943
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1944
1944
|
}
|
|
1945
|
-
setLimit(e, t,
|
|
1946
|
-
return new
|
|
1945
|
+
setLimit(e, t, r, n) {
|
|
1946
|
+
return new ue(g(d({}, this._def), {
|
|
1947
1947
|
checks: [
|
|
1948
1948
|
...this._def.checks,
|
|
1949
1949
|
{
|
|
1950
1950
|
kind: e,
|
|
1951
1951
|
value: t,
|
|
1952
|
-
inclusive:
|
|
1952
|
+
inclusive: r,
|
|
1953
1953
|
message: m.toString(n)
|
|
1954
1954
|
}
|
|
1955
1955
|
]
|
|
1956
1956
|
}));
|
|
1957
1957
|
}
|
|
1958
1958
|
_addCheck(e) {
|
|
1959
|
-
return new
|
|
1959
|
+
return new ue(g(d({}, this._def), {
|
|
1960
1960
|
checks: [...this._def.checks, e]
|
|
1961
1961
|
}));
|
|
1962
1962
|
}
|
|
@@ -2037,24 +2037,24 @@ class le extends w {
|
|
|
2037
2037
|
return e;
|
|
2038
2038
|
}
|
|
2039
2039
|
get isInt() {
|
|
2040
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
2040
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && k.isInteger(e.value));
|
|
2041
2041
|
}
|
|
2042
2042
|
get isFinite() {
|
|
2043
2043
|
let e = null, t = null;
|
|
2044
|
-
for (const
|
|
2045
|
-
if (
|
|
2044
|
+
for (const r of this._def.checks) {
|
|
2045
|
+
if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf")
|
|
2046
2046
|
return !0;
|
|
2047
|
-
|
|
2047
|
+
r.kind === "min" ? (t === null || r.value > t) && (t = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
|
|
2048
2048
|
}
|
|
2049
2049
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
2050
2050
|
}
|
|
2051
2051
|
}
|
|
2052
|
-
|
|
2052
|
+
ue.create = (s) => new ue(d({
|
|
2053
2053
|
checks: [],
|
|
2054
2054
|
typeName: y.ZodNumber,
|
|
2055
|
-
coerce: (
|
|
2056
|
-
},
|
|
2057
|
-
class
|
|
2055
|
+
coerce: (s == null ? void 0 : s.coerce) || !1
|
|
2056
|
+
}, w(s)));
|
|
2057
|
+
class de extends x {
|
|
2058
2058
|
constructor() {
|
|
2059
2059
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
2060
2060
|
}
|
|
@@ -2067,26 +2067,26 @@ class fe extends w {
|
|
|
2067
2067
|
}
|
|
2068
2068
|
if (this._getType(e) !== p.bigint)
|
|
2069
2069
|
return this._getInvalidInput(e);
|
|
2070
|
-
let
|
|
2070
|
+
let r;
|
|
2071
2071
|
const n = new Z();
|
|
2072
2072
|
for (const a of this._def.checks)
|
|
2073
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (
|
|
2073
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
2074
2074
|
code: l.too_small,
|
|
2075
2075
|
type: "bigint",
|
|
2076
2076
|
minimum: a.value,
|
|
2077
2077
|
inclusive: a.inclusive,
|
|
2078
2078
|
message: a.message
|
|
2079
|
-
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (
|
|
2079
|
+
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
2080
2080
|
code: l.too_big,
|
|
2081
2081
|
type: "bigint",
|
|
2082
2082
|
maximum: a.value,
|
|
2083
2083
|
inclusive: a.inclusive,
|
|
2084
2084
|
message: a.message
|
|
2085
|
-
}), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (
|
|
2085
|
+
}), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
2086
2086
|
code: l.not_multiple_of,
|
|
2087
2087
|
multipleOf: a.value,
|
|
2088
2088
|
message: a.message
|
|
2089
|
-
}), n.dirty()) :
|
|
2089
|
+
}), n.dirty()) : k.assertNever(a);
|
|
2090
2090
|
return { status: n.value, value: e.data };
|
|
2091
2091
|
}
|
|
2092
2092
|
_getInvalidInput(e) {
|
|
@@ -2109,21 +2109,21 @@ class fe extends w {
|
|
|
2109
2109
|
lt(e, t) {
|
|
2110
2110
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
2111
2111
|
}
|
|
2112
|
-
setLimit(e, t,
|
|
2113
|
-
return new
|
|
2112
|
+
setLimit(e, t, r, n) {
|
|
2113
|
+
return new de(g(d({}, this._def), {
|
|
2114
2114
|
checks: [
|
|
2115
2115
|
...this._def.checks,
|
|
2116
2116
|
{
|
|
2117
2117
|
kind: e,
|
|
2118
2118
|
value: t,
|
|
2119
|
-
inclusive:
|
|
2119
|
+
inclusive: r,
|
|
2120
2120
|
message: m.toString(n)
|
|
2121
2121
|
}
|
|
2122
2122
|
]
|
|
2123
2123
|
}));
|
|
2124
2124
|
}
|
|
2125
2125
|
_addCheck(e) {
|
|
2126
|
-
return new
|
|
2126
|
+
return new de(g(d({}, this._def), {
|
|
2127
2127
|
checks: [...this._def.checks, e]
|
|
2128
2128
|
}));
|
|
2129
2129
|
}
|
|
@@ -2179,32 +2179,32 @@ class fe extends w {
|
|
|
2179
2179
|
return e;
|
|
2180
2180
|
}
|
|
2181
2181
|
}
|
|
2182
|
-
|
|
2182
|
+
de.create = (s) => {
|
|
2183
2183
|
var e;
|
|
2184
|
-
return new
|
|
2184
|
+
return new de(d({
|
|
2185
2185
|
checks: [],
|
|
2186
2186
|
typeName: y.ZodBigInt,
|
|
2187
|
-
coerce: (e =
|
|
2188
|
-
},
|
|
2187
|
+
coerce: (e = s == null ? void 0 : s.coerce) !== null && e !== void 0 ? e : !1
|
|
2188
|
+
}, w(s)));
|
|
2189
2189
|
};
|
|
2190
|
-
class
|
|
2190
|
+
class Le extends x {
|
|
2191
2191
|
_parse(e) {
|
|
2192
2192
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
|
|
2193
|
-
const
|
|
2194
|
-
return h(
|
|
2193
|
+
const r = this._getOrReturnCtx(e);
|
|
2194
|
+
return h(r, {
|
|
2195
2195
|
code: l.invalid_type,
|
|
2196
2196
|
expected: p.boolean,
|
|
2197
|
-
received:
|
|
2197
|
+
received: r.parsedType
|
|
2198
2198
|
}), _;
|
|
2199
2199
|
}
|
|
2200
2200
|
return $(e.data);
|
|
2201
2201
|
}
|
|
2202
2202
|
}
|
|
2203
|
-
|
|
2203
|
+
Le.create = (s) => new Le(d({
|
|
2204
2204
|
typeName: y.ZodBoolean,
|
|
2205
|
-
coerce: (
|
|
2206
|
-
},
|
|
2207
|
-
class
|
|
2205
|
+
coerce: (s == null ? void 0 : s.coerce) || !1
|
|
2206
|
+
}, w(s)));
|
|
2207
|
+
class be extends x {
|
|
2208
2208
|
_parse(e) {
|
|
2209
2209
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
2210
2210
|
const a = this._getOrReturnCtx(e);
|
|
@@ -2220,7 +2220,7 @@ class xe extends w {
|
|
|
2220
2220
|
code: l.invalid_date
|
|
2221
2221
|
}), _;
|
|
2222
2222
|
}
|
|
2223
|
-
const
|
|
2223
|
+
const r = new Z();
|
|
2224
2224
|
let n;
|
|
2225
2225
|
for (const a of this._def.checks)
|
|
2226
2226
|
a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
@@ -2230,21 +2230,21 @@ class xe extends w {
|
|
|
2230
2230
|
exact: !1,
|
|
2231
2231
|
minimum: a.value,
|
|
2232
2232
|
type: "date"
|
|
2233
|
-
}),
|
|
2233
|
+
}), r.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
2234
2234
|
code: l.too_big,
|
|
2235
2235
|
message: a.message,
|
|
2236
2236
|
inclusive: !0,
|
|
2237
2237
|
exact: !1,
|
|
2238
2238
|
maximum: a.value,
|
|
2239
2239
|
type: "date"
|
|
2240
|
-
}),
|
|
2240
|
+
}), r.dirty()) : k.assertNever(a);
|
|
2241
2241
|
return {
|
|
2242
|
-
status:
|
|
2242
|
+
status: r.value,
|
|
2243
2243
|
value: new Date(e.data.getTime())
|
|
2244
2244
|
};
|
|
2245
2245
|
}
|
|
2246
2246
|
_addCheck(e) {
|
|
2247
|
-
return new
|
|
2247
|
+
return new be(g(d({}, this._def), {
|
|
2248
2248
|
checks: [...this._def.checks, e]
|
|
2249
2249
|
}));
|
|
2250
2250
|
}
|
|
@@ -2275,60 +2275,60 @@ class xe extends w {
|
|
|
2275
2275
|
return e != null ? new Date(e) : null;
|
|
2276
2276
|
}
|
|
2277
2277
|
}
|
|
2278
|
-
|
|
2278
|
+
be.create = (s) => new be(d({
|
|
2279
2279
|
checks: [],
|
|
2280
|
-
coerce: (
|
|
2280
|
+
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
2281
2281
|
typeName: y.ZodDate
|
|
2282
|
-
},
|
|
2283
|
-
class ct extends
|
|
2282
|
+
}, w(s)));
|
|
2283
|
+
class ct extends x {
|
|
2284
2284
|
_parse(e) {
|
|
2285
2285
|
if (this._getType(e) !== p.symbol) {
|
|
2286
|
-
const
|
|
2287
|
-
return h(
|
|
2286
|
+
const r = this._getOrReturnCtx(e);
|
|
2287
|
+
return h(r, {
|
|
2288
2288
|
code: l.invalid_type,
|
|
2289
2289
|
expected: p.symbol,
|
|
2290
|
-
received:
|
|
2290
|
+
received: r.parsedType
|
|
2291
2291
|
}), _;
|
|
2292
2292
|
}
|
|
2293
2293
|
return $(e.data);
|
|
2294
2294
|
}
|
|
2295
2295
|
}
|
|
2296
|
-
ct.create = (
|
|
2296
|
+
ct.create = (s) => new ct(d({
|
|
2297
2297
|
typeName: y.ZodSymbol
|
|
2298
|
-
},
|
|
2299
|
-
class
|
|
2298
|
+
}, w(s)));
|
|
2299
|
+
class Ve extends x {
|
|
2300
2300
|
_parse(e) {
|
|
2301
2301
|
if (this._getType(e) !== p.undefined) {
|
|
2302
|
-
const
|
|
2303
|
-
return h(
|
|
2302
|
+
const r = this._getOrReturnCtx(e);
|
|
2303
|
+
return h(r, {
|
|
2304
2304
|
code: l.invalid_type,
|
|
2305
2305
|
expected: p.undefined,
|
|
2306
|
-
received:
|
|
2306
|
+
received: r.parsedType
|
|
2307
2307
|
}), _;
|
|
2308
2308
|
}
|
|
2309
2309
|
return $(e.data);
|
|
2310
2310
|
}
|
|
2311
2311
|
}
|
|
2312
|
-
|
|
2312
|
+
Ve.create = (s) => new Ve(d({
|
|
2313
2313
|
typeName: y.ZodUndefined
|
|
2314
|
-
},
|
|
2315
|
-
class
|
|
2314
|
+
}, w(s)));
|
|
2315
|
+
class Ue extends x {
|
|
2316
2316
|
_parse(e) {
|
|
2317
2317
|
if (this._getType(e) !== p.null) {
|
|
2318
|
-
const
|
|
2319
|
-
return h(
|
|
2318
|
+
const r = this._getOrReturnCtx(e);
|
|
2319
|
+
return h(r, {
|
|
2320
2320
|
code: l.invalid_type,
|
|
2321
2321
|
expected: p.null,
|
|
2322
|
-
received:
|
|
2322
|
+
received: r.parsedType
|
|
2323
2323
|
}), _;
|
|
2324
2324
|
}
|
|
2325
2325
|
return $(e.data);
|
|
2326
2326
|
}
|
|
2327
2327
|
}
|
|
2328
|
-
|
|
2328
|
+
Ue.create = (s) => new Ue(d({
|
|
2329
2329
|
typeName: y.ZodNull
|
|
2330
|
-
},
|
|
2331
|
-
class
|
|
2330
|
+
}, w(s)));
|
|
2331
|
+
class Oe extends x {
|
|
2332
2332
|
constructor() {
|
|
2333
2333
|
super(...arguments), this._any = !0;
|
|
2334
2334
|
}
|
|
@@ -2336,10 +2336,10 @@ class Ne extends w {
|
|
|
2336
2336
|
return $(e.data);
|
|
2337
2337
|
}
|
|
2338
2338
|
}
|
|
2339
|
-
|
|
2339
|
+
Oe.create = (s) => new Oe(d({
|
|
2340
2340
|
typeName: y.ZodAny
|
|
2341
|
-
},
|
|
2342
|
-
class
|
|
2341
|
+
}, w(s)));
|
|
2342
|
+
class ve extends x {
|
|
2343
2343
|
constructor() {
|
|
2344
2344
|
super(...arguments), this._unknown = !0;
|
|
2345
2345
|
}
|
|
@@ -2347,10 +2347,10 @@ class be extends w {
|
|
|
2347
2347
|
return $(e.data);
|
|
2348
2348
|
}
|
|
2349
2349
|
}
|
|
2350
|
-
|
|
2350
|
+
ve.create = (s) => new ve(d({
|
|
2351
2351
|
typeName: y.ZodUnknown
|
|
2352
|
-
},
|
|
2353
|
-
class
|
|
2352
|
+
}, w(s)));
|
|
2353
|
+
class ae extends x {
|
|
2354
2354
|
_parse(e) {
|
|
2355
2355
|
const t = this._getOrReturnCtx(e);
|
|
2356
2356
|
return h(t, {
|
|
@@ -2360,28 +2360,28 @@ class oe extends w {
|
|
|
2360
2360
|
}), _;
|
|
2361
2361
|
}
|
|
2362
2362
|
}
|
|
2363
|
-
|
|
2363
|
+
ae.create = (s) => new ae(d({
|
|
2364
2364
|
typeName: y.ZodNever
|
|
2365
|
-
},
|
|
2366
|
-
class
|
|
2365
|
+
}, w(s)));
|
|
2366
|
+
class ut extends x {
|
|
2367
2367
|
_parse(e) {
|
|
2368
2368
|
if (this._getType(e) !== p.undefined) {
|
|
2369
|
-
const
|
|
2370
|
-
return h(
|
|
2369
|
+
const r = this._getOrReturnCtx(e);
|
|
2370
|
+
return h(r, {
|
|
2371
2371
|
code: l.invalid_type,
|
|
2372
2372
|
expected: p.void,
|
|
2373
|
-
received:
|
|
2373
|
+
received: r.parsedType
|
|
2374
2374
|
}), _;
|
|
2375
2375
|
}
|
|
2376
2376
|
return $(e.data);
|
|
2377
2377
|
}
|
|
2378
2378
|
}
|
|
2379
|
-
|
|
2379
|
+
ut.create = (s) => new ut(d({
|
|
2380
2380
|
typeName: y.ZodVoid
|
|
2381
|
-
},
|
|
2382
|
-
class
|
|
2381
|
+
}, w(s)));
|
|
2382
|
+
class q extends x {
|
|
2383
2383
|
_parse(e) {
|
|
2384
|
-
const { ctx: t, status:
|
|
2384
|
+
const { ctx: t, status: r } = this._processInputParams(e), n = this._def;
|
|
2385
2385
|
if (t.parsedType !== p.array)
|
|
2386
2386
|
return h(t, {
|
|
2387
2387
|
code: l.invalid_type,
|
|
@@ -2398,7 +2398,7 @@ class J extends w {
|
|
|
2398
2398
|
inclusive: !0,
|
|
2399
2399
|
exact: !0,
|
|
2400
2400
|
message: n.exactLength.message
|
|
2401
|
-
}),
|
|
2401
|
+
}), r.dirty());
|
|
2402
2402
|
}
|
|
2403
2403
|
if (n.minLength !== null && t.data.length < n.minLength.value && (h(t, {
|
|
2404
2404
|
code: l.too_small,
|
|
@@ -2407,33 +2407,33 @@ class J extends w {
|
|
|
2407
2407
|
inclusive: !0,
|
|
2408
2408
|
exact: !1,
|
|
2409
2409
|
message: n.minLength.message
|
|
2410
|
-
}),
|
|
2410
|
+
}), r.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (h(t, {
|
|
2411
2411
|
code: l.too_big,
|
|
2412
2412
|
maximum: n.maxLength.value,
|
|
2413
2413
|
type: "array",
|
|
2414
2414
|
inclusive: !0,
|
|
2415
2415
|
exact: !1,
|
|
2416
2416
|
message: n.maxLength.message
|
|
2417
|
-
}),
|
|
2418
|
-
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new
|
|
2419
|
-
const a = [...t.data].map((i, o) => n.type._parseSync(new
|
|
2420
|
-
return Z.mergeArray(
|
|
2417
|
+
}), r.dirty()), t.common.async)
|
|
2418
|
+
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new Y(t, i, t.path, o)))).then((i) => Z.mergeArray(r, i));
|
|
2419
|
+
const a = [...t.data].map((i, o) => n.type._parseSync(new Y(t, i, t.path, o)));
|
|
2420
|
+
return Z.mergeArray(r, a);
|
|
2421
2421
|
}
|
|
2422
2422
|
get element() {
|
|
2423
2423
|
return this._def.type;
|
|
2424
2424
|
}
|
|
2425
2425
|
min(e, t) {
|
|
2426
|
-
return new
|
|
2426
|
+
return new q(g(d({}, this._def), {
|
|
2427
2427
|
minLength: { value: e, message: m.toString(t) }
|
|
2428
2428
|
}));
|
|
2429
2429
|
}
|
|
2430
2430
|
max(e, t) {
|
|
2431
|
-
return new
|
|
2431
|
+
return new q(g(d({}, this._def), {
|
|
2432
2432
|
maxLength: { value: e, message: m.toString(t) }
|
|
2433
2433
|
}));
|
|
2434
2434
|
}
|
|
2435
2435
|
length(e, t) {
|
|
2436
|
-
return new
|
|
2436
|
+
return new q(g(d({}, this._def), {
|
|
2437
2437
|
exactLength: { value: e, message: m.toString(t) }
|
|
2438
2438
|
}));
|
|
2439
2439
|
}
|
|
@@ -2441,110 +2441,110 @@ class J extends w {
|
|
|
2441
2441
|
return this.min(1, e);
|
|
2442
2442
|
}
|
|
2443
2443
|
}
|
|
2444
|
-
|
|
2445
|
-
type:
|
|
2444
|
+
q.create = (s, e) => new q(d({
|
|
2445
|
+
type: s,
|
|
2446
2446
|
minLength: null,
|
|
2447
2447
|
maxLength: null,
|
|
2448
2448
|
exactLength: null,
|
|
2449
2449
|
typeName: y.ZodArray
|
|
2450
|
-
},
|
|
2451
|
-
function
|
|
2452
|
-
if (
|
|
2450
|
+
}, w(e)));
|
|
2451
|
+
function Se(s) {
|
|
2452
|
+
if (s instanceof O) {
|
|
2453
2453
|
const e = {};
|
|
2454
|
-
for (const t in
|
|
2455
|
-
const
|
|
2456
|
-
e[t] =
|
|
2454
|
+
for (const t in s.shape) {
|
|
2455
|
+
const r = s.shape[t];
|
|
2456
|
+
e[t] = X.create(Se(r));
|
|
2457
2457
|
}
|
|
2458
|
-
return new
|
|
2458
|
+
return new O(g(d({}, s._def), {
|
|
2459
2459
|
shape: () => e
|
|
2460
2460
|
}));
|
|
2461
|
-
} else return
|
|
2462
|
-
type:
|
|
2463
|
-
})) :
|
|
2461
|
+
} else return s instanceof q ? new q(g(d({}, s._def), {
|
|
2462
|
+
type: Se(s.element)
|
|
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
|
}
|
|
2465
|
-
class
|
|
2465
|
+
class O extends x {
|
|
2466
2466
|
constructor() {
|
|
2467
2467
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2468
2468
|
}
|
|
2469
2469
|
_getCached() {
|
|
2470
2470
|
if (this._cached !== null)
|
|
2471
2471
|
return this._cached;
|
|
2472
|
-
const e = this._def.shape(), t =
|
|
2472
|
+
const e = this._def.shape(), t = k.objectKeys(e);
|
|
2473
2473
|
return this._cached = { shape: e, keys: t };
|
|
2474
2474
|
}
|
|
2475
2475
|
_parse(e) {
|
|
2476
2476
|
if (this._getType(e) !== p.object) {
|
|
2477
|
-
const
|
|
2478
|
-
return h(
|
|
2477
|
+
const u = this._getOrReturnCtx(e);
|
|
2478
|
+
return h(u, {
|
|
2479
2479
|
code: l.invalid_type,
|
|
2480
2480
|
expected: p.object,
|
|
2481
|
-
received:
|
|
2481
|
+
received: u.parsedType
|
|
2482
2482
|
}), _;
|
|
2483
2483
|
}
|
|
2484
|
-
const { status:
|
|
2485
|
-
if (!(this._def.catchall instanceof
|
|
2486
|
-
for (const
|
|
2487
|
-
i.includes(
|
|
2484
|
+
const { status: r, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
2485
|
+
if (!(this._def.catchall instanceof ae && this._def.unknownKeys === "strip"))
|
|
2486
|
+
for (const u in n.data)
|
|
2487
|
+
i.includes(u) || o.push(u);
|
|
2488
2488
|
const c = [];
|
|
2489
|
-
for (const
|
|
2490
|
-
const f = a[
|
|
2489
|
+
for (const u of i) {
|
|
2490
|
+
const f = a[u], v = n.data[u];
|
|
2491
2491
|
c.push({
|
|
2492
|
-
key: { status: "valid", value:
|
|
2493
|
-
value: f._parse(new
|
|
2494
|
-
alwaysSet:
|
|
2492
|
+
key: { status: "valid", value: u },
|
|
2493
|
+
value: f._parse(new Y(n, v, n.path, u)),
|
|
2494
|
+
alwaysSet: u in n.data
|
|
2495
2495
|
});
|
|
2496
2496
|
}
|
|
2497
|
-
if (this._def.catchall instanceof
|
|
2498
|
-
const
|
|
2499
|
-
if (
|
|
2497
|
+
if (this._def.catchall instanceof ae) {
|
|
2498
|
+
const u = this._def.unknownKeys;
|
|
2499
|
+
if (u === "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 (u === "strict")
|
|
2506
2506
|
o.length > 0 && (h(n, {
|
|
2507
2507
|
code: l.unrecognized_keys,
|
|
2508
2508
|
keys: o
|
|
2509
|
-
}),
|
|
2510
|
-
else if (
|
|
2509
|
+
}), r.dirty());
|
|
2510
|
+
else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2511
2511
|
} else {
|
|
2512
|
-
const
|
|
2512
|
+
const u = 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:
|
|
2518
|
-
new
|
|
2517
|
+
value: u._parse(
|
|
2518
|
+
new Y(n, v, n.path, f)
|
|
2519
2519
|
//, ctx.child(key), value, getParsedType(value)
|
|
2520
2520
|
),
|
|
2521
2521
|
alwaysSet: f in n.data
|
|
2522
2522
|
});
|
|
2523
2523
|
}
|
|
2524
2524
|
}
|
|
2525
|
-
return n.common.async ? Promise.resolve().then(() =>
|
|
2526
|
-
const
|
|
2525
|
+
return n.common.async ? Promise.resolve().then(() => I(this, null, function* () {
|
|
2526
|
+
const u = [];
|
|
2527
2527
|
for (const f of c) {
|
|
2528
2528
|
const v = yield f.key, j = yield f.value;
|
|
2529
|
-
|
|
2529
|
+
u.push({
|
|
2530
2530
|
key: v,
|
|
2531
2531
|
value: j,
|
|
2532
2532
|
alwaysSet: f.alwaysSet
|
|
2533
2533
|
});
|
|
2534
2534
|
}
|
|
2535
|
-
return
|
|
2536
|
-
})).then((
|
|
2535
|
+
return u;
|
|
2536
|
+
})).then((u) => Z.mergeObjectSync(r, u)) : 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
|
|
2542
|
+
return m.errToObj, new O(d(g(d({}, this._def), {
|
|
2543
2543
|
unknownKeys: "strict"
|
|
2544
2544
|
}), e !== void 0 ? {
|
|
2545
|
-
errorMap: (t,
|
|
2545
|
+
errorMap: (t, r) => {
|
|
2546
2546
|
var n, a, i, o;
|
|
2547
|
-
const c = (i = (a = (n = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(n, t,
|
|
2547
|
+
const c = (i = (a = (n = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(n, t, r).message) !== null && i !== void 0 ? i : r.defaultError;
|
|
2548
2548
|
return t.code === "unrecognized_keys" ? {
|
|
2549
2549
|
message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o : c
|
|
2550
2550
|
} : {
|
|
@@ -2554,12 +2554,12 @@ class I extends w {
|
|
|
2554
2554
|
} : {}));
|
|
2555
2555
|
}
|
|
2556
2556
|
strip() {
|
|
2557
|
-
return new
|
|
2557
|
+
return new O(g(d({}, this._def), {
|
|
2558
2558
|
unknownKeys: "strip"
|
|
2559
2559
|
}));
|
|
2560
2560
|
}
|
|
2561
2561
|
passthrough() {
|
|
2562
|
-
return new
|
|
2562
|
+
return new O(g(d({}, this._def), {
|
|
2563
2563
|
unknownKeys: "passthrough"
|
|
2564
2564
|
}));
|
|
2565
2565
|
}
|
|
@@ -2581,8 +2581,8 @@ class I extends w {
|
|
|
2581
2581
|
// }) as any;
|
|
2582
2582
|
// };
|
|
2583
2583
|
extend(e) {
|
|
2584
|
-
return new
|
|
2585
|
-
shape: () =>
|
|
2584
|
+
return new O(g(d({}, this._def), {
|
|
2585
|
+
shape: () => d(d({}, this._def.shape()), e)
|
|
2586
2586
|
}));
|
|
2587
2587
|
}
|
|
2588
2588
|
/**
|
|
@@ -2591,10 +2591,10 @@ class I extends w {
|
|
|
2591
2591
|
* upgrade if you are experiencing issues.
|
|
2592
2592
|
*/
|
|
2593
2593
|
merge(e) {
|
|
2594
|
-
return new
|
|
2594
|
+
return new O({
|
|
2595
2595
|
unknownKeys: e._def.unknownKeys,
|
|
2596
2596
|
catchall: e._def.catchall,
|
|
2597
|
-
shape: () =>
|
|
2597
|
+
shape: () => d(d({}, this._def.shape()), e._def.shape()),
|
|
2598
2598
|
typeName: y.ZodObject
|
|
2599
2599
|
});
|
|
2600
2600
|
}
|
|
@@ -2658,23 +2658,23 @@ class I extends w {
|
|
|
2658
2658
|
// return merged;
|
|
2659
2659
|
// }
|
|
2660
2660
|
catchall(e) {
|
|
2661
|
-
return new
|
|
2661
|
+
return new O(g(d({}, this._def), {
|
|
2662
2662
|
catchall: e
|
|
2663
2663
|
}));
|
|
2664
2664
|
}
|
|
2665
2665
|
pick(e) {
|
|
2666
2666
|
const t = {};
|
|
2667
|
-
return
|
|
2668
|
-
e[
|
|
2669
|
-
}), new
|
|
2667
|
+
return k.objectKeys(e).forEach((r) => {
|
|
2668
|
+
e[r] && this.shape[r] && (t[r] = this.shape[r]);
|
|
2669
|
+
}), new O(g(d({}, this._def), {
|
|
2670
2670
|
shape: () => t
|
|
2671
2671
|
}));
|
|
2672
2672
|
}
|
|
2673
2673
|
omit(e) {
|
|
2674
2674
|
const t = {};
|
|
2675
|
-
return
|
|
2676
|
-
e[
|
|
2677
|
-
}), new
|
|
2675
|
+
return k.objectKeys(this.shape).forEach((r) => {
|
|
2676
|
+
e[r] || (t[r] = this.shape[r]);
|
|
2677
|
+
}), new O(g(d({}, this._def), {
|
|
2678
2678
|
shape: () => t
|
|
2679
2679
|
}));
|
|
2680
2680
|
}
|
|
@@ -2682,57 +2682,57 @@ class I extends w {
|
|
|
2682
2682
|
* @deprecated
|
|
2683
2683
|
*/
|
|
2684
2684
|
deepPartial() {
|
|
2685
|
-
return
|
|
2685
|
+
return Se(this);
|
|
2686
2686
|
}
|
|
2687
2687
|
partial(e) {
|
|
2688
2688
|
const t = {};
|
|
2689
|
-
return
|
|
2690
|
-
const n = this.shape[
|
|
2691
|
-
e && !e[
|
|
2692
|
-
}), new
|
|
2689
|
+
return k.objectKeys(this.shape).forEach((r) => {
|
|
2690
|
+
const n = this.shape[r];
|
|
2691
|
+
e && !e[r] ? t[r] = n : t[r] = n.optional();
|
|
2692
|
+
}), new O(g(d({}, this._def), {
|
|
2693
2693
|
shape: () => t
|
|
2694
2694
|
}));
|
|
2695
2695
|
}
|
|
2696
2696
|
required(e) {
|
|
2697
2697
|
const t = {};
|
|
2698
|
-
return
|
|
2699
|
-
if (e && !e[
|
|
2700
|
-
t[
|
|
2698
|
+
return k.objectKeys(this.shape).forEach((r) => {
|
|
2699
|
+
if (e && !e[r])
|
|
2700
|
+
t[r] = this.shape[r];
|
|
2701
2701
|
else {
|
|
2702
|
-
let a = this.shape[
|
|
2703
|
-
for (; a instanceof
|
|
2702
|
+
let a = this.shape[r];
|
|
2703
|
+
for (; a instanceof X; )
|
|
2704
2704
|
a = a._def.innerType;
|
|
2705
|
-
t[
|
|
2705
|
+
t[r] = a;
|
|
2706
2706
|
}
|
|
2707
|
-
}), new
|
|
2707
|
+
}), new O(g(d({}, this._def), {
|
|
2708
2708
|
shape: () => t
|
|
2709
2709
|
}));
|
|
2710
2710
|
}
|
|
2711
2711
|
keyof() {
|
|
2712
|
-
return
|
|
2712
|
+
return gs(k.objectKeys(this.shape));
|
|
2713
2713
|
}
|
|
2714
2714
|
}
|
|
2715
|
-
|
|
2716
|
-
shape: () =>
|
|
2715
|
+
O.create = (s, e) => new O(d({
|
|
2716
|
+
shape: () => s,
|
|
2717
2717
|
unknownKeys: "strip",
|
|
2718
|
-
catchall:
|
|
2718
|
+
catchall: ae.create(),
|
|
2719
2719
|
typeName: y.ZodObject
|
|
2720
|
-
},
|
|
2721
|
-
|
|
2722
|
-
shape: () =>
|
|
2720
|
+
}, w(e)));
|
|
2721
|
+
O.strictCreate = (s, e) => new O(d({
|
|
2722
|
+
shape: () => s,
|
|
2723
2723
|
unknownKeys: "strict",
|
|
2724
|
-
catchall:
|
|
2724
|
+
catchall: ae.create(),
|
|
2725
2725
|
typeName: y.ZodObject
|
|
2726
|
-
},
|
|
2727
|
-
|
|
2728
|
-
shape:
|
|
2726
|
+
}, w(e)));
|
|
2727
|
+
O.lazycreate = (s, e) => new O(d({
|
|
2728
|
+
shape: s,
|
|
2729
2729
|
unknownKeys: "strip",
|
|
2730
|
-
catchall:
|
|
2730
|
+
catchall: ae.create(),
|
|
2731
2731
|
typeName: y.ZodObject
|
|
2732
|
-
},
|
|
2733
|
-
class
|
|
2732
|
+
}, w(e)));
|
|
2733
|
+
class We extends x {
|
|
2734
2734
|
_parse(e) {
|
|
2735
|
-
const { ctx: t } = this._processInputParams(e),
|
|
2735
|
+
const { ctx: t } = this._processInputParams(e), r = this._def.options;
|
|
2736
2736
|
function n(a) {
|
|
2737
2737
|
for (const o of a)
|
|
2738
2738
|
if (o.result.status === "valid")
|
|
@@ -2740,16 +2740,16 @@ class ze extends w {
|
|
|
2740
2740
|
for (const o of a)
|
|
2741
2741
|
if (o.result.status === "dirty")
|
|
2742
2742
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2743
|
-
const i = a.map((o) => new
|
|
2743
|
+
const i = a.map((o) => new U(o.ctx.common.issues));
|
|
2744
2744
|
return h(t, {
|
|
2745
2745
|
code: l.invalid_union,
|
|
2746
2746
|
unionErrors: i
|
|
2747
2747
|
}), _;
|
|
2748
2748
|
}
|
|
2749
2749
|
if (t.common.async)
|
|
2750
|
-
return Promise.all(
|
|
2751
|
-
const i = g(
|
|
2752
|
-
common: g(
|
|
2750
|
+
return Promise.all(r.map((a) => I(this, null, function* () {
|
|
2751
|
+
const i = g(d({}, t), {
|
|
2752
|
+
common: g(d({}, t.common), {
|
|
2753
2753
|
issues: []
|
|
2754
2754
|
}),
|
|
2755
2755
|
parent: null
|
|
@@ -2766,24 +2766,24 @@ class ze extends w {
|
|
|
2766
2766
|
{
|
|
2767
2767
|
let a;
|
|
2768
2768
|
const i = [];
|
|
2769
|
-
for (const c of
|
|
2770
|
-
const
|
|
2771
|
-
common: g(
|
|
2769
|
+
for (const c of r) {
|
|
2770
|
+
const u = g(d({}, t), {
|
|
2771
|
+
common: g(d({}, 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: u
|
|
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: u }), u.common.issues.length && i.push(u.common.issues);
|
|
2783
2783
|
}
|
|
2784
2784
|
if (a)
|
|
2785
2785
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2786
|
-
const o = i.map((c) => new
|
|
2786
|
+
const o = i.map((c) => new U(c));
|
|
2787
2787
|
return h(t, {
|
|
2788
2788
|
code: l.invalid_union,
|
|
2789
2789
|
unionErrors: o
|
|
@@ -2794,12 +2794,12 @@ class ze extends w {
|
|
|
2794
2794
|
return this._def.options;
|
|
2795
2795
|
}
|
|
2796
2796
|
}
|
|
2797
|
-
|
|
2798
|
-
options:
|
|
2797
|
+
We.create = (s, e) => new We(d({
|
|
2798
|
+
options: s,
|
|
2799
2799
|
typeName: y.ZodUnion
|
|
2800
|
-
},
|
|
2801
|
-
const
|
|
2802
|
-
class ft extends
|
|
2800
|
+
}, w(e)));
|
|
2801
|
+
const se = (s) => s instanceof qe ? se(s.schema) : s instanceof H ? se(s.innerType()) : s instanceof He ? [s.value] : s instanceof le ? s.options : s instanceof Je ? k.objectValues(s.enum) : s instanceof Ge ? se(s._def.innerType) : s instanceof Ve ? [void 0] : s instanceof Ue ? [null] : s instanceof X ? [void 0, ...se(s.unwrap())] : s instanceof fe ? [null, ...se(s.unwrap())] : s instanceof $t || s instanceof Xe ? se(s.unwrap()) : s instanceof Ke ? se(s._def.innerType) : [];
|
|
2802
|
+
class ft extends x {
|
|
2803
2803
|
_parse(e) {
|
|
2804
2804
|
const { ctx: t } = this._processInputParams(e);
|
|
2805
2805
|
if (t.parsedType !== p.object)
|
|
@@ -2808,7 +2808,7 @@ class ft extends w {
|
|
|
2808
2808
|
expected: p.object,
|
|
2809
2809
|
received: t.parsedType
|
|
2810
2810
|
}), _;
|
|
2811
|
-
const
|
|
2811
|
+
const r = this.discriminator, n = t.data[r], a = this.optionsMap.get(n);
|
|
2812
2812
|
return a ? t.common.async ? a._parseAsync({
|
|
2813
2813
|
data: t.data,
|
|
2814
2814
|
path: t.path,
|
|
@@ -2820,7 +2820,7 @@ class ft extends w {
|
|
|
2820
2820
|
}) : (h(t, {
|
|
2821
2821
|
code: l.invalid_union_discriminator,
|
|
2822
2822
|
options: Array.from(this.optionsMap.keys()),
|
|
2823
|
-
path: [
|
|
2823
|
+
path: [r]
|
|
2824
2824
|
}), _);
|
|
2825
2825
|
}
|
|
2826
2826
|
get discriminator() {
|
|
@@ -2840,10 +2840,10 @@ class ft extends w {
|
|
|
2840
2840
|
* @param types an array of object schemas
|
|
2841
2841
|
* @param params
|
|
2842
2842
|
*/
|
|
2843
|
-
static create(e, t,
|
|
2843
|
+
static create(e, t, r) {
|
|
2844
2844
|
const n = /* @__PURE__ */ new Map();
|
|
2845
2845
|
for (const a of t) {
|
|
2846
|
-
const i =
|
|
2846
|
+
const i = se(a.shape[e]);
|
|
2847
2847
|
if (!i.length)
|
|
2848
2848
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2849
2849
|
for (const o of i) {
|
|
@@ -2852,126 +2852,126 @@ class ft extends w {
|
|
|
2852
2852
|
n.set(o, a);
|
|
2853
2853
|
}
|
|
2854
2854
|
}
|
|
2855
|
-
return new ft(
|
|
2855
|
+
return new ft(d({
|
|
2856
2856
|
typeName: y.ZodDiscriminatedUnion,
|
|
2857
2857
|
discriminator: e,
|
|
2858
2858
|
options: t,
|
|
2859
2859
|
optionsMap: n
|
|
2860
|
-
},
|
|
2860
|
+
}, w(r)));
|
|
2861
2861
|
}
|
|
2862
2862
|
}
|
|
2863
|
-
function Rt(
|
|
2864
|
-
const t =
|
|
2865
|
-
if (
|
|
2866
|
-
return { valid: !0, data:
|
|
2867
|
-
if (t === p.object &&
|
|
2868
|
-
const n =
|
|
2863
|
+
function Rt(s, e) {
|
|
2864
|
+
const t = re(s), r = re(e);
|
|
2865
|
+
if (s === e)
|
|
2866
|
+
return { valid: !0, data: s };
|
|
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 = d(d({}, s), e);
|
|
2869
2869
|
for (const o of a) {
|
|
2870
|
-
const c = Rt(
|
|
2870
|
+
const c = Rt(s[o], e[o]);
|
|
2871
2871
|
if (!c.valid)
|
|
2872
2872
|
return { valid: !1 };
|
|
2873
2873
|
i[o] = c.data;
|
|
2874
2874
|
}
|
|
2875
2875
|
return { valid: !0, data: i };
|
|
2876
|
-
} else if (t === p.array &&
|
|
2877
|
-
if (
|
|
2876
|
+
} else if (t === p.array && r === p.array) {
|
|
2877
|
+
if (s.length !== e.length)
|
|
2878
2878
|
return { valid: !1 };
|
|
2879
2879
|
const n = [];
|
|
2880
|
-
for (let a = 0; a <
|
|
2881
|
-
const i =
|
|
2880
|
+
for (let a = 0; a < s.length; a++) {
|
|
2881
|
+
const i = s[a], o = e[a], c = Rt(i, o);
|
|
2882
2882
|
if (!c.valid)
|
|
2883
2883
|
return { valid: !1 };
|
|
2884
2884
|
n.push(c.data);
|
|
2885
2885
|
}
|
|
2886
2886
|
return { valid: !0, data: n };
|
|
2887
|
-
} else return t === p.date &&
|
|
2887
|
+
} else return t === p.date && r === p.date && +s == +e ? { valid: !0, data: s } : { valid: !1 };
|
|
2888
2888
|
}
|
|
2889
|
-
class
|
|
2889
|
+
class ze extends x {
|
|
2890
2890
|
_parse(e) {
|
|
2891
|
-
const { status: t, ctx:
|
|
2891
|
+
const { status: t, ctx: r } = this._processInputParams(e), n = (a, i) => {
|
|
2892
2892
|
if (Nt(a) || Nt(i))
|
|
2893
2893
|
return _;
|
|
2894
2894
|
const o = Rt(a.value, i.value);
|
|
2895
|
-
return o.valid ? ((jt(a) || jt(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(
|
|
2895
|
+
return o.valid ? ((jt(a) || jt(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(r, {
|
|
2896
2896
|
code: l.invalid_intersection_types
|
|
2897
2897
|
}), _);
|
|
2898
2898
|
};
|
|
2899
|
-
return
|
|
2899
|
+
return r.common.async ? Promise.all([
|
|
2900
2900
|
this._def.left._parseAsync({
|
|
2901
|
-
data:
|
|
2902
|
-
path:
|
|
2903
|
-
parent:
|
|
2901
|
+
data: r.data,
|
|
2902
|
+
path: r.path,
|
|
2903
|
+
parent: r
|
|
2904
2904
|
}),
|
|
2905
2905
|
this._def.right._parseAsync({
|
|
2906
|
-
data:
|
|
2907
|
-
path:
|
|
2908
|
-
parent:
|
|
2906
|
+
data: r.data,
|
|
2907
|
+
path: r.path,
|
|
2908
|
+
parent: r
|
|
2909
2909
|
})
|
|
2910
2910
|
]).then(([a, i]) => n(a, i)) : n(this._def.left._parseSync({
|
|
2911
|
-
data:
|
|
2912
|
-
path:
|
|
2913
|
-
parent:
|
|
2911
|
+
data: r.data,
|
|
2912
|
+
path: r.path,
|
|
2913
|
+
parent: r
|
|
2914
2914
|
}), this._def.right._parseSync({
|
|
2915
|
-
data:
|
|
2916
|
-
path:
|
|
2917
|
-
parent:
|
|
2915
|
+
data: r.data,
|
|
2916
|
+
path: r.path,
|
|
2917
|
+
parent: r
|
|
2918
2918
|
}));
|
|
2919
2919
|
}
|
|
2920
2920
|
}
|
|
2921
|
-
|
|
2922
|
-
left:
|
|
2921
|
+
ze.create = (s, e, t) => new ze(d({
|
|
2922
|
+
left: s,
|
|
2923
2923
|
right: e,
|
|
2924
2924
|
typeName: y.ZodIntersection
|
|
2925
|
-
},
|
|
2926
|
-
class
|
|
2925
|
+
}, w(t)));
|
|
2926
|
+
class Q extends x {
|
|
2927
2927
|
_parse(e) {
|
|
2928
|
-
const { status: t, ctx:
|
|
2929
|
-
if (
|
|
2930
|
-
return h(
|
|
2928
|
+
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2929
|
+
if (r.parsedType !== p.array)
|
|
2930
|
+
return h(r, {
|
|
2931
2931
|
code: l.invalid_type,
|
|
2932
2932
|
expected: p.array,
|
|
2933
|
-
received:
|
|
2933
|
+
received: r.parsedType
|
|
2934
2934
|
}), _;
|
|
2935
|
-
if (
|
|
2936
|
-
return h(
|
|
2935
|
+
if (r.data.length < this._def.items.length)
|
|
2936
|
+
return h(r, {
|
|
2937
2937
|
code: l.too_small,
|
|
2938
2938
|
minimum: this._def.items.length,
|
|
2939
2939
|
inclusive: !0,
|
|
2940
2940
|
exact: !1,
|
|
2941
2941
|
type: "array"
|
|
2942
2942
|
}), _;
|
|
2943
|
-
!this._def.rest &&
|
|
2943
|
+
!this._def.rest && r.data.length > this._def.items.length && (h(r, {
|
|
2944
2944
|
code: l.too_big,
|
|
2945
2945
|
maximum: this._def.items.length,
|
|
2946
2946
|
inclusive: !0,
|
|
2947
2947
|
exact: !1,
|
|
2948
2948
|
type: "array"
|
|
2949
2949
|
}), t.dirty());
|
|
2950
|
-
const a = [...
|
|
2950
|
+
const a = [...r.data].map((i, o) => {
|
|
2951
2951
|
const c = this._def.items[o] || this._def.rest;
|
|
2952
|
-
return c ? c._parse(new
|
|
2952
|
+
return c ? c._parse(new Y(r, i, r.path, o)) : null;
|
|
2953
2953
|
}).filter((i) => !!i);
|
|
2954
|
-
return
|
|
2954
|
+
return r.common.async ? Promise.all(a).then((i) => Z.mergeArray(t, i)) : Z.mergeArray(t, a);
|
|
2955
2955
|
}
|
|
2956
2956
|
get items() {
|
|
2957
2957
|
return this._def.items;
|
|
2958
2958
|
}
|
|
2959
2959
|
rest(e) {
|
|
2960
|
-
return new
|
|
2960
|
+
return new Q(g(d({}, this._def), {
|
|
2961
2961
|
rest: e
|
|
2962
2962
|
}));
|
|
2963
2963
|
}
|
|
2964
2964
|
}
|
|
2965
|
-
|
|
2966
|
-
if (!Array.isArray(
|
|
2965
|
+
Q.create = (s, e) => {
|
|
2966
|
+
if (!Array.isArray(s))
|
|
2967
2967
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2968
|
-
return new
|
|
2969
|
-
items:
|
|
2968
|
+
return new Q(d({
|
|
2969
|
+
items: s,
|
|
2970
2970
|
typeName: y.ZodTuple,
|
|
2971
2971
|
rest: null
|
|
2972
|
-
},
|
|
2972
|
+
}, w(e)));
|
|
2973
2973
|
};
|
|
2974
|
-
class
|
|
2974
|
+
class Be extends x {
|
|
2975
2975
|
get keySchema() {
|
|
2976
2976
|
return this._def.keyType;
|
|
2977
2977
|
}
|
|
@@ -2979,38 +2979,38 @@ class qe extends w {
|
|
|
2979
2979
|
return this._def.valueType;
|
|
2980
2980
|
}
|
|
2981
2981
|
_parse(e) {
|
|
2982
|
-
const { status: t, ctx:
|
|
2983
|
-
if (
|
|
2984
|
-
return h(
|
|
2982
|
+
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2983
|
+
if (r.parsedType !== p.object)
|
|
2984
|
+
return h(r, {
|
|
2985
2985
|
code: l.invalid_type,
|
|
2986
2986
|
expected: p.object,
|
|
2987
|
-
received:
|
|
2987
|
+
received: r.parsedType
|
|
2988
2988
|
}), _;
|
|
2989
2989
|
const n = [], a = this._def.keyType, i = this._def.valueType;
|
|
2990
|
-
for (const o in
|
|
2990
|
+
for (const o in r.data)
|
|
2991
2991
|
n.push({
|
|
2992
|
-
key: a._parse(new
|
|
2993
|
-
value: i._parse(new
|
|
2994
|
-
alwaysSet: o in
|
|
2992
|
+
key: a._parse(new Y(r, o, r.path, o)),
|
|
2993
|
+
value: i._parse(new Y(r, r.data[o], r.path, o)),
|
|
2994
|
+
alwaysSet: o in r.data
|
|
2995
2995
|
});
|
|
2996
|
-
return
|
|
2996
|
+
return r.common.async ? Z.mergeObjectAsync(t, n) : Z.mergeObjectSync(t, n);
|
|
2997
2997
|
}
|
|
2998
2998
|
get element() {
|
|
2999
2999
|
return this._def.valueType;
|
|
3000
3000
|
}
|
|
3001
|
-
static create(e, t,
|
|
3002
|
-
return t instanceof
|
|
3001
|
+
static create(e, t, r) {
|
|
3002
|
+
return t instanceof x ? new Be(d({
|
|
3003
3003
|
keyType: e,
|
|
3004
3004
|
valueType: t,
|
|
3005
3005
|
typeName: y.ZodRecord
|
|
3006
|
-
},
|
|
3007
|
-
keyType:
|
|
3006
|
+
}, w(r))) : new Be(d({
|
|
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 dt extends x {
|
|
3014
3014
|
get keySchema() {
|
|
3015
3015
|
return this._def.keyType;
|
|
3016
3016
|
}
|
|
@@ -3018,63 +3018,63 @@ class ut extends w {
|
|
|
3018
3018
|
return this._def.valueType;
|
|
3019
3019
|
}
|
|
3020
3020
|
_parse(e) {
|
|
3021
|
-
const { status: t, ctx:
|
|
3022
|
-
if (
|
|
3023
|
-
return h(
|
|
3021
|
+
const { status: t, ctx: r } = this._processInputParams(e);
|
|
3022
|
+
if (r.parsedType !== p.map)
|
|
3023
|
+
return h(r, {
|
|
3024
3024
|
code: l.invalid_type,
|
|
3025
3025
|
expected: p.map,
|
|
3026
|
-
received:
|
|
3026
|
+
received: r.parsedType
|
|
3027
3027
|
}), _;
|
|
3028
|
-
const n = this._def.keyType, a = this._def.valueType, i = [...
|
|
3029
|
-
key: n._parse(new
|
|
3030
|
-
value: a._parse(new
|
|
3028
|
+
const n = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, c], u) => ({
|
|
3029
|
+
key: n._parse(new Y(r, o, r.path, [u, "key"])),
|
|
3030
|
+
value: a._parse(new Y(r, c, r.path, [u, "value"]))
|
|
3031
3031
|
}));
|
|
3032
|
-
if (
|
|
3032
|
+
if (r.common.async) {
|
|
3033
3033
|
const o = /* @__PURE__ */ new Map();
|
|
3034
|
-
return Promise.resolve().then(() =>
|
|
3034
|
+
return Promise.resolve().then(() => I(this, null, function* () {
|
|
3035
3035
|
for (const c of i) {
|
|
3036
|
-
const
|
|
3037
|
-
if (
|
|
3036
|
+
const u = yield c.key, f = yield c.value;
|
|
3037
|
+
if (u.status === "aborted" || f.status === "aborted")
|
|
3038
3038
|
return _;
|
|
3039
|
-
(
|
|
3039
|
+
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.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 u = c.key, f = c.value;
|
|
3047
|
+
if (u.status === "aborted" || f.status === "aborted")
|
|
3048
3048
|
return _;
|
|
3049
|
-
(
|
|
3049
|
+
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
|
|
3050
3050
|
}
|
|
3051
3051
|
return { status: t.value, value: o };
|
|
3052
3052
|
}
|
|
3053
3053
|
}
|
|
3054
3054
|
}
|
|
3055
|
-
|
|
3055
|
+
dt.create = (s, e, t) => new dt(d({
|
|
3056
3056
|
valueType: e,
|
|
3057
|
-
keyType:
|
|
3057
|
+
keyType: s,
|
|
3058
3058
|
typeName: y.ZodMap
|
|
3059
|
-
},
|
|
3060
|
-
class
|
|
3059
|
+
}, w(t)));
|
|
3060
|
+
class we extends x {
|
|
3061
3061
|
_parse(e) {
|
|
3062
|
-
const { status: t, ctx:
|
|
3063
|
-
if (
|
|
3064
|
-
return h(
|
|
3062
|
+
const { status: t, ctx: r } = this._processInputParams(e);
|
|
3063
|
+
if (r.parsedType !== p.set)
|
|
3064
|
+
return h(r, {
|
|
3065
3065
|
code: l.invalid_type,
|
|
3066
3066
|
expected: p.set,
|
|
3067
|
-
received:
|
|
3067
|
+
received: r.parsedType
|
|
3068
3068
|
}), _;
|
|
3069
3069
|
const n = this._def;
|
|
3070
|
-
n.minSize !== null &&
|
|
3070
|
+
n.minSize !== null && r.data.size < n.minSize.value && (h(r, {
|
|
3071
3071
|
code: l.too_small,
|
|
3072
3072
|
minimum: n.minSize.value,
|
|
3073
3073
|
type: "set",
|
|
3074
3074
|
inclusive: !0,
|
|
3075
3075
|
exact: !1,
|
|
3076
3076
|
message: n.minSize.message
|
|
3077
|
-
}), t.dirty()), n.maxSize !== null &&
|
|
3077
|
+
}), t.dirty()), n.maxSize !== null && r.data.size > n.maxSize.value && (h(r, {
|
|
3078
3078
|
code: l.too_big,
|
|
3079
3079
|
maximum: n.maxSize.value,
|
|
3080
3080
|
type: "set",
|
|
@@ -3084,24 +3084,24 @@ class ke extends w {
|
|
|
3084
3084
|
}), t.dirty());
|
|
3085
3085
|
const a = this._def.valueType;
|
|
3086
3086
|
function i(c) {
|
|
3087
|
-
const
|
|
3087
|
+
const u = /* @__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(), u.add(f.value);
|
|
3092
3092
|
}
|
|
3093
|
-
return { status: t.value, value:
|
|
3093
|
+
return { status: t.value, value: u };
|
|
3094
3094
|
}
|
|
3095
|
-
const o = [...
|
|
3096
|
-
return
|
|
3095
|
+
const o = [...r.data.values()].map((c, u) => a._parse(new Y(r, c, r.path, u)));
|
|
3096
|
+
return r.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
3097
3097
|
}
|
|
3098
3098
|
min(e, t) {
|
|
3099
|
-
return new
|
|
3099
|
+
return new we(g(d({}, this._def), {
|
|
3100
3100
|
minSize: { value: e, message: m.toString(t) }
|
|
3101
3101
|
}));
|
|
3102
3102
|
}
|
|
3103
3103
|
max(e, t) {
|
|
3104
|
-
return new
|
|
3104
|
+
return new we(g(d({}, this._def), {
|
|
3105
3105
|
maxSize: { value: e, message: m.toString(t) }
|
|
3106
3106
|
}));
|
|
3107
3107
|
}
|
|
@@ -3112,13 +3112,13 @@ class ke extends w {
|
|
|
3112
3112
|
return this.min(1, e);
|
|
3113
3113
|
}
|
|
3114
3114
|
}
|
|
3115
|
-
|
|
3116
|
-
valueType:
|
|
3115
|
+
we.create = (s, e) => new we(d({
|
|
3116
|
+
valueType: s,
|
|
3117
3117
|
minSize: null,
|
|
3118
3118
|
maxSize: null,
|
|
3119
3119
|
typeName: y.ZodSet
|
|
3120
|
-
},
|
|
3121
|
-
class
|
|
3120
|
+
}, w(e)));
|
|
3121
|
+
class Ae extends x {
|
|
3122
3122
|
constructor() {
|
|
3123
3123
|
super(...arguments), this.validate = this.implement;
|
|
3124
3124
|
}
|
|
@@ -3130,7 +3130,7 @@ class Ce extends w {
|
|
|
3130
3130
|
expected: p.function,
|
|
3131
3131
|
received: t.parsedType
|
|
3132
3132
|
}), _;
|
|
3133
|
-
function
|
|
3133
|
+
function r(o, c) {
|
|
3134
3134
|
return it({
|
|
3135
3135
|
data: o,
|
|
3136
3136
|
path: t.path,
|
|
@@ -3138,8 +3138,8 @@ class Ce extends w {
|
|
|
3138
3138
|
t.common.contextualErrorMap,
|
|
3139
3139
|
t.schemaErrorMap,
|
|
3140
3140
|
at(),
|
|
3141
|
-
|
|
3142
|
-
].filter((
|
|
3141
|
+
Ie
|
|
3142
|
+
].filter((u) => !!u),
|
|
3143
3143
|
issueData: {
|
|
3144
3144
|
code: l.invalid_arguments,
|
|
3145
3145
|
argumentsError: c
|
|
@@ -3154,8 +3154,8 @@ class Ce extends w {
|
|
|
3154
3154
|
t.common.contextualErrorMap,
|
|
3155
3155
|
t.schemaErrorMap,
|
|
3156
3156
|
at(),
|
|
3157
|
-
|
|
3158
|
-
].filter((
|
|
3157
|
+
Ie
|
|
3158
|
+
].filter((u) => !!u),
|
|
3159
3159
|
issueData: {
|
|
3160
3160
|
code: l.invalid_return_type,
|
|
3161
3161
|
returnTypeError: c
|
|
@@ -3163,27 +3163,27 @@ class Ce extends w {
|
|
|
3163
3163
|
});
|
|
3164
3164
|
}
|
|
3165
3165
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
3166
|
-
if (this._def.returns instanceof
|
|
3166
|
+
if (this._def.returns instanceof Ne) {
|
|
3167
3167
|
const o = this;
|
|
3168
3168
|
return $(function(...c) {
|
|
3169
|
-
return
|
|
3170
|
-
const
|
|
3171
|
-
throw
|
|
3169
|
+
return I(this, null, function* () {
|
|
3170
|
+
const u = new U([]), f = yield o._def.args.parseAsync(c, a).catch((M) => {
|
|
3171
|
+
throw u.addIssue(r(c, M)), u;
|
|
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 u.addIssue(n(v, M)), u;
|
|
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
|
|
3184
|
-
const f = Reflect.apply(i, this,
|
|
3181
|
+
const u = o._def.args.safeParse(c, a);
|
|
3182
|
+
if (!u.success)
|
|
3183
|
+
throw new U([r(c, u.error)]);
|
|
3184
|
+
const f = Reflect.apply(i, this, u.data), v = o._def.returns.safeParse(f, a);
|
|
3185
3185
|
if (!v.success)
|
|
3186
|
-
throw new
|
|
3186
|
+
throw new U([n(f, v.error)]);
|
|
3187
3187
|
return v.data;
|
|
3188
3188
|
});
|
|
3189
3189
|
}
|
|
@@ -3195,12 +3195,12 @@ class Ce extends w {
|
|
|
3195
3195
|
return this._def.returns;
|
|
3196
3196
|
}
|
|
3197
3197
|
args(...e) {
|
|
3198
|
-
return new
|
|
3199
|
-
args:
|
|
3198
|
+
return new Ae(g(d({}, this._def), {
|
|
3199
|
+
args: Q.create(e).rest(ve.create())
|
|
3200
3200
|
}));
|
|
3201
3201
|
}
|
|
3202
3202
|
returns(e) {
|
|
3203
|
-
return new
|
|
3203
|
+
return new Ae(g(d({}, this._def), {
|
|
3204
3204
|
returns: e
|
|
3205
3205
|
}));
|
|
3206
3206
|
}
|
|
@@ -3210,15 +3210,15 @@ class Ce extends w {
|
|
|
3210
3210
|
strictImplement(e) {
|
|
3211
3211
|
return this.parse(e);
|
|
3212
3212
|
}
|
|
3213
|
-
static create(e, t,
|
|
3214
|
-
return new
|
|
3215
|
-
args: e ||
|
|
3216
|
-
returns: t ||
|
|
3213
|
+
static create(e, t, r) {
|
|
3214
|
+
return new Ae(d({
|
|
3215
|
+
args: e || Q.create([]).rest(ve.create()),
|
|
3216
|
+
returns: t || ve.create(),
|
|
3217
3217
|
typeName: y.ZodFunction
|
|
3218
|
-
},
|
|
3218
|
+
}, w(r)));
|
|
3219
3219
|
}
|
|
3220
3220
|
}
|
|
3221
|
-
class
|
|
3221
|
+
class qe extends x {
|
|
3222
3222
|
get schema() {
|
|
3223
3223
|
return this._def.getter();
|
|
3224
3224
|
}
|
|
@@ -3227,11 +3227,11 @@ class He extends w {
|
|
|
3227
3227
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
3228
3228
|
}
|
|
3229
3229
|
}
|
|
3230
|
-
|
|
3231
|
-
getter:
|
|
3230
|
+
qe.create = (s, e) => new qe(d({
|
|
3231
|
+
getter: s,
|
|
3232
3232
|
typeName: y.ZodLazy
|
|
3233
|
-
},
|
|
3234
|
-
class
|
|
3233
|
+
}, w(e)));
|
|
3234
|
+
class He extends x {
|
|
3235
3235
|
_parse(e) {
|
|
3236
3236
|
if (e.data !== this._def.value) {
|
|
3237
3237
|
const t = this._getOrReturnCtx(e);
|
|
@@ -3247,35 +3247,35 @@ class Je extends w {
|
|
|
3247
3247
|
return this._def.value;
|
|
3248
3248
|
}
|
|
3249
3249
|
}
|
|
3250
|
-
|
|
3251
|
-
value:
|
|
3250
|
+
He.create = (s, e) => new He(d({
|
|
3251
|
+
value: s,
|
|
3252
3252
|
typeName: y.ZodLiteral
|
|
3253
|
-
},
|
|
3254
|
-
function
|
|
3255
|
-
return new
|
|
3256
|
-
values:
|
|
3253
|
+
}, w(e)));
|
|
3254
|
+
function gs(s, e) {
|
|
3255
|
+
return new le(d({
|
|
3256
|
+
values: s,
|
|
3257
3257
|
typeName: y.ZodEnum
|
|
3258
|
-
},
|
|
3258
|
+
}, w(e)));
|
|
3259
3259
|
}
|
|
3260
|
-
class
|
|
3260
|
+
class le extends x {
|
|
3261
3261
|
constructor() {
|
|
3262
|
-
super(...arguments),
|
|
3262
|
+
super(...arguments), Pe.set(this, void 0);
|
|
3263
3263
|
}
|
|
3264
3264
|
_parse(e) {
|
|
3265
3265
|
if (typeof e.data != "string") {
|
|
3266
|
-
const t = this._getOrReturnCtx(e),
|
|
3266
|
+
const t = this._getOrReturnCtx(e), r = this._def.values;
|
|
3267
3267
|
return h(t, {
|
|
3268
|
-
expected:
|
|
3268
|
+
expected: k.joinValues(r),
|
|
3269
3269
|
received: t.parsedType,
|
|
3270
3270
|
code: l.invalid_type
|
|
3271
3271
|
}), _;
|
|
3272
3272
|
}
|
|
3273
|
-
if (ot(this,
|
|
3274
|
-
const t = this._getOrReturnCtx(e),
|
|
3273
|
+
if (ot(this, Pe) || fs(this, Pe, new Set(this._def.values)), !ot(this, Pe).has(e.data)) {
|
|
3274
|
+
const t = this._getOrReturnCtx(e), r = this._def.values;
|
|
3275
3275
|
return h(t, {
|
|
3276
3276
|
received: t.data,
|
|
3277
3277
|
code: l.invalid_enum_value,
|
|
3278
|
-
options:
|
|
3278
|
+
options: r
|
|
3279
3279
|
}), _;
|
|
3280
3280
|
}
|
|
3281
3281
|
return $(e.data);
|
|
@@ -3302,32 +3302,32 @@ class he extends w {
|
|
|
3302
3302
|
return e;
|
|
3303
3303
|
}
|
|
3304
3304
|
extract(e, t = this._def) {
|
|
3305
|
-
return
|
|
3305
|
+
return le.create(e, d(d({}, this._def), t));
|
|
3306
3306
|
}
|
|
3307
3307
|
exclude(e, t = this._def) {
|
|
3308
|
-
return
|
|
3308
|
+
return le.create(this.options.filter((r) => !e.includes(r)), d(d({}, this._def), t));
|
|
3309
3309
|
}
|
|
3310
3310
|
}
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
class
|
|
3311
|
+
Pe = /* @__PURE__ */ new WeakMap();
|
|
3312
|
+
le.create = gs;
|
|
3313
|
+
class Je extends x {
|
|
3314
3314
|
constructor() {
|
|
3315
|
-
super(...arguments),
|
|
3315
|
+
super(...arguments), $e.set(this, void 0);
|
|
3316
3316
|
}
|
|
3317
3317
|
_parse(e) {
|
|
3318
|
-
const t =
|
|
3319
|
-
if (
|
|
3320
|
-
const n =
|
|
3321
|
-
return h(
|
|
3322
|
-
expected:
|
|
3323
|
-
received:
|
|
3318
|
+
const t = k.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
|
|
3319
|
+
if (r.parsedType !== p.string && r.parsedType !== p.number) {
|
|
3320
|
+
const n = k.objectValues(t);
|
|
3321
|
+
return h(r, {
|
|
3322
|
+
expected: k.joinValues(n),
|
|
3323
|
+
received: r.parsedType,
|
|
3324
3324
|
code: l.invalid_type
|
|
3325
3325
|
}), _;
|
|
3326
3326
|
}
|
|
3327
|
-
if (ot(this,
|
|
3328
|
-
const n =
|
|
3329
|
-
return h(
|
|
3330
|
-
received:
|
|
3327
|
+
if (ot(this, $e) || fs(this, $e, new Set(k.getValidEnumValues(this._def.values))), !ot(this, $e).has(e.data)) {
|
|
3328
|
+
const n = k.objectValues(t);
|
|
3329
|
+
return h(r, {
|
|
3330
|
+
received: r.data,
|
|
3331
3331
|
code: l.invalid_enum_value,
|
|
3332
3332
|
options: n
|
|
3333
3333
|
}), _;
|
|
@@ -3338,12 +3338,12 @@ class Ge extends w {
|
|
|
3338
3338
|
return this._def.values;
|
|
3339
3339
|
}
|
|
3340
3340
|
}
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
values:
|
|
3341
|
+
$e = /* @__PURE__ */ new WeakMap();
|
|
3342
|
+
Je.create = (s, e) => new Je(d({
|
|
3343
|
+
values: s,
|
|
3344
3344
|
typeName: y.ZodNativeEnum
|
|
3345
|
-
},
|
|
3346
|
-
class
|
|
3345
|
+
}, w(e)));
|
|
3346
|
+
class Ne extends x {
|
|
3347
3347
|
unwrap() {
|
|
3348
3348
|
return this._def.type;
|
|
3349
3349
|
}
|
|
@@ -3355,18 +3355,18 @@ class je extends w {
|
|
|
3355
3355
|
expected: p.promise,
|
|
3356
3356
|
received: t.parsedType
|
|
3357
3357
|
}), _;
|
|
3358
|
-
const
|
|
3359
|
-
return $(
|
|
3358
|
+
const r = t.parsedType === p.promise ? t.data : Promise.resolve(t.data);
|
|
3359
|
+
return $(r.then((n) => this._def.type.parseAsync(n, {
|
|
3360
3360
|
path: t.path,
|
|
3361
3361
|
errorMap: t.common.contextualErrorMap
|
|
3362
3362
|
})));
|
|
3363
3363
|
}
|
|
3364
3364
|
}
|
|
3365
|
-
|
|
3366
|
-
type:
|
|
3365
|
+
Ne.create = (s, e) => new Ne(d({
|
|
3366
|
+
type: s,
|
|
3367
3367
|
typeName: y.ZodPromise
|
|
3368
|
-
},
|
|
3369
|
-
class
|
|
3368
|
+
}, w(e)));
|
|
3369
|
+
class H extends x {
|
|
3370
3370
|
innerType() {
|
|
3371
3371
|
return this._def.schema;
|
|
3372
3372
|
}
|
|
@@ -3374,86 +3374,86 @@ class G extends w {
|
|
|
3374
3374
|
return this._def.schema._def.typeName === y.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
3375
3375
|
}
|
|
3376
3376
|
_parse(e) {
|
|
3377
|
-
const { status: t, ctx:
|
|
3377
|
+
const { status: t, ctx: r } = this._processInputParams(e), n = this._def.effect || null, a = {
|
|
3378
3378
|
addIssue: (i) => {
|
|
3379
|
-
h(
|
|
3379
|
+
h(r, i), i.fatal ? t.abort() : t.dirty();
|
|
3380
3380
|
},
|
|
3381
3381
|
get path() {
|
|
3382
|
-
return
|
|
3382
|
+
return r.path;
|
|
3383
3383
|
}
|
|
3384
3384
|
};
|
|
3385
3385
|
if (a.addIssue = a.addIssue.bind(a), n.type === "preprocess") {
|
|
3386
|
-
const i = n.transform(
|
|
3387
|
-
if (
|
|
3388
|
-
return Promise.resolve(i).then((o) =>
|
|
3386
|
+
const i = n.transform(r.data, a);
|
|
3387
|
+
if (r.common.async)
|
|
3388
|
+
return Promise.resolve(i).then((o) => I(this, null, function* () {
|
|
3389
3389
|
if (t.value === "aborted")
|
|
3390
3390
|
return _;
|
|
3391
3391
|
const c = yield this._def.schema._parseAsync({
|
|
3392
3392
|
data: o,
|
|
3393
|
-
path:
|
|
3394
|
-
parent:
|
|
3393
|
+
path: r.path,
|
|
3394
|
+
parent: r
|
|
3395
3395
|
});
|
|
3396
|
-
return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ?
|
|
3396
|
+
return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ? Ee(c.value) : c;
|
|
3397
3397
|
}));
|
|
3398
3398
|
{
|
|
3399
3399
|
if (t.value === "aborted")
|
|
3400
3400
|
return _;
|
|
3401
3401
|
const o = this._def.schema._parseSync({
|
|
3402
3402
|
data: i,
|
|
3403
|
-
path:
|
|
3404
|
-
parent:
|
|
3403
|
+
path: r.path,
|
|
3404
|
+
parent: r
|
|
3405
3405
|
});
|
|
3406
|
-
return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ?
|
|
3406
|
+
return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ? Ee(o.value) : o;
|
|
3407
3407
|
}
|
|
3408
3408
|
}
|
|
3409
3409
|
if (n.type === "refinement") {
|
|
3410
3410
|
const i = (o) => {
|
|
3411
3411
|
const c = n.refinement(o, a);
|
|
3412
|
-
if (
|
|
3412
|
+
if (r.common.async)
|
|
3413
3413
|
return Promise.resolve(c);
|
|
3414
3414
|
if (c instanceof Promise)
|
|
3415
3415
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3416
3416
|
return o;
|
|
3417
3417
|
};
|
|
3418
|
-
if (
|
|
3418
|
+
if (r.common.async === !1) {
|
|
3419
3419
|
const o = this._def.schema._parseSync({
|
|
3420
|
-
data:
|
|
3421
|
-
path:
|
|
3422
|
-
parent:
|
|
3420
|
+
data: r.data,
|
|
3421
|
+
path: r.path,
|
|
3422
|
+
parent: r
|
|
3423
3423
|
});
|
|
3424
3424
|
return o.status === "aborted" ? _ : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
3425
3425
|
} else
|
|
3426
|
-
return this._def.schema._parseAsync({ data:
|
|
3426
|
+
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => o.status === "aborted" ? _ : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
3427
3427
|
}
|
|
3428
3428
|
if (n.type === "transform")
|
|
3429
|
-
if (
|
|
3429
|
+
if (r.common.async === !1) {
|
|
3430
3430
|
const i = this._def.schema._parseSync({
|
|
3431
|
-
data:
|
|
3432
|
-
path:
|
|
3433
|
-
parent:
|
|
3431
|
+
data: r.data,
|
|
3432
|
+
path: r.path,
|
|
3433
|
+
parent: r
|
|
3434
3434
|
});
|
|
3435
|
-
if (!
|
|
3435
|
+
if (!_e(i))
|
|
3436
3436
|
return i;
|
|
3437
3437
|
const o = n.transform(i.value, a);
|
|
3438
3438
|
if (o instanceof Promise)
|
|
3439
3439
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3440
3440
|
return { status: t.value, value: o };
|
|
3441
3441
|
} else
|
|
3442
|
-
return this._def.schema._parseAsync({ data:
|
|
3443
|
-
|
|
3442
|
+
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((i) => _e(i) ? Promise.resolve(n.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
3443
|
+
k.assertNever(n);
|
|
3444
3444
|
}
|
|
3445
3445
|
}
|
|
3446
|
-
|
|
3447
|
-
schema:
|
|
3446
|
+
H.create = (s, e, t) => new H(d({
|
|
3447
|
+
schema: s,
|
|
3448
3448
|
typeName: y.ZodEffects,
|
|
3449
3449
|
effect: e
|
|
3450
|
-
},
|
|
3451
|
-
|
|
3450
|
+
}, w(t)));
|
|
3451
|
+
H.createWithPreprocess = (s, e, t) => new H(d({
|
|
3452
3452
|
schema: e,
|
|
3453
|
-
effect: { type: "preprocess", transform:
|
|
3453
|
+
effect: { type: "preprocess", transform: s },
|
|
3454
3454
|
typeName: y.ZodEffects
|
|
3455
|
-
},
|
|
3456
|
-
class
|
|
3455
|
+
}, w(t)));
|
|
3456
|
+
class X extends x {
|
|
3457
3457
|
_parse(e) {
|
|
3458
3458
|
return this._getType(e) === p.undefined ? $(void 0) : this._def.innerType._parse(e);
|
|
3459
3459
|
}
|
|
@@ -3461,11 +3461,11 @@ class Q extends w {
|
|
|
3461
3461
|
return this._def.innerType;
|
|
3462
3462
|
}
|
|
3463
3463
|
}
|
|
3464
|
-
|
|
3465
|
-
innerType:
|
|
3464
|
+
X.create = (s, e) => new X(d({
|
|
3465
|
+
innerType: s,
|
|
3466
3466
|
typeName: y.ZodOptional
|
|
3467
|
-
},
|
|
3468
|
-
class
|
|
3467
|
+
}, w(e)));
|
|
3468
|
+
class fe extends x {
|
|
3469
3469
|
_parse(e) {
|
|
3470
3470
|
return this._getType(e) === p.null ? $(null) : this._def.innerType._parse(e);
|
|
3471
3471
|
}
|
|
@@ -3473,16 +3473,16 @@ class pe extends w {
|
|
|
3473
3473
|
return this._def.innerType;
|
|
3474
3474
|
}
|
|
3475
3475
|
}
|
|
3476
|
-
|
|
3477
|
-
innerType:
|
|
3476
|
+
fe.create = (s, e) => new fe(d({
|
|
3477
|
+
innerType: s,
|
|
3478
3478
|
typeName: y.ZodNullable
|
|
3479
|
-
},
|
|
3480
|
-
class
|
|
3479
|
+
}, w(e)));
|
|
3480
|
+
class Ge extends x {
|
|
3481
3481
|
_parse(e) {
|
|
3482
3482
|
const { ctx: t } = this._processInputParams(e);
|
|
3483
|
-
let
|
|
3484
|
-
return t.parsedType === p.undefined && (
|
|
3485
|
-
data:
|
|
3483
|
+
let r = t.data;
|
|
3484
|
+
return t.parsedType === p.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
|
|
3485
|
+
data: r,
|
|
3486
3486
|
path: t.path,
|
|
3487
3487
|
parent: t
|
|
3488
3488
|
});
|
|
@@ -3491,37 +3491,37 @@ class Ke extends w {
|
|
|
3491
3491
|
return this._def.innerType;
|
|
3492
3492
|
}
|
|
3493
3493
|
}
|
|
3494
|
-
|
|
3495
|
-
innerType:
|
|
3494
|
+
Ge.create = (s, e) => new Ge(d({
|
|
3495
|
+
innerType: s,
|
|
3496
3496
|
typeName: y.ZodDefault,
|
|
3497
3497
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
3498
|
-
},
|
|
3499
|
-
class
|
|
3498
|
+
}, w(e)));
|
|
3499
|
+
class Ke extends x {
|
|
3500
3500
|
_parse(e) {
|
|
3501
|
-
const { ctx: t } = this._processInputParams(e),
|
|
3502
|
-
common: g(
|
|
3501
|
+
const { ctx: t } = this._processInputParams(e), r = g(d({}, t), {
|
|
3502
|
+
common: g(d({}, t.common), {
|
|
3503
3503
|
issues: []
|
|
3504
3504
|
})
|
|
3505
3505
|
}), n = this._def.innerType._parse({
|
|
3506
|
-
data:
|
|
3507
|
-
path:
|
|
3508
|
-
parent:
|
|
3506
|
+
data: r.data,
|
|
3507
|
+
path: r.path,
|
|
3508
|
+
parent: d({}, r)
|
|
3509
3509
|
});
|
|
3510
|
-
return
|
|
3510
|
+
return De(n) ? n.then((a) => ({
|
|
3511
3511
|
status: "valid",
|
|
3512
3512
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
3513
3513
|
get error() {
|
|
3514
|
-
return new
|
|
3514
|
+
return new U(r.common.issues);
|
|
3515
3515
|
},
|
|
3516
|
-
input:
|
|
3516
|
+
input: r.data
|
|
3517
3517
|
})
|
|
3518
3518
|
})) : {
|
|
3519
3519
|
status: "valid",
|
|
3520
3520
|
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
3521
3521
|
get error() {
|
|
3522
|
-
return new
|
|
3522
|
+
return new U(r.common.issues);
|
|
3523
3523
|
},
|
|
3524
|
-
input:
|
|
3524
|
+
input: r.data
|
|
3525
3525
|
})
|
|
3526
3526
|
};
|
|
3527
3527
|
}
|
|
@@ -3529,33 +3529,33 @@ class Xe extends w {
|
|
|
3529
3529
|
return this._def.innerType;
|
|
3530
3530
|
}
|
|
3531
3531
|
}
|
|
3532
|
-
|
|
3533
|
-
innerType:
|
|
3532
|
+
Ke.create = (s, e) => new Ke(d({
|
|
3533
|
+
innerType: s,
|
|
3534
3534
|
typeName: y.ZodCatch,
|
|
3535
3535
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
3536
|
-
},
|
|
3537
|
-
class lt extends
|
|
3536
|
+
}, w(e)));
|
|
3537
|
+
class lt extends x {
|
|
3538
3538
|
_parse(e) {
|
|
3539
3539
|
if (this._getType(e) !== p.nan) {
|
|
3540
|
-
const
|
|
3541
|
-
return h(
|
|
3540
|
+
const r = this._getOrReturnCtx(e);
|
|
3541
|
+
return h(r, {
|
|
3542
3542
|
code: l.invalid_type,
|
|
3543
3543
|
expected: p.nan,
|
|
3544
|
-
received:
|
|
3544
|
+
received: r.parsedType
|
|
3545
3545
|
}), _;
|
|
3546
3546
|
}
|
|
3547
3547
|
return { status: "valid", value: e.data };
|
|
3548
3548
|
}
|
|
3549
3549
|
}
|
|
3550
|
-
lt.create = (
|
|
3550
|
+
lt.create = (s) => new lt(d({
|
|
3551
3551
|
typeName: y.ZodNaN
|
|
3552
|
-
},
|
|
3552
|
+
}, w(s)));
|
|
3553
3553
|
const tn = Symbol("zod_brand");
|
|
3554
|
-
class $t extends
|
|
3554
|
+
class $t extends x {
|
|
3555
3555
|
_parse(e) {
|
|
3556
|
-
const { ctx: t } = this._processInputParams(e),
|
|
3556
|
+
const { ctx: t } = this._processInputParams(e), r = t.data;
|
|
3557
3557
|
return this._def.type._parse({
|
|
3558
|
-
data:
|
|
3558
|
+
data: r,
|
|
3559
3559
|
path: t.path,
|
|
3560
3560
|
parent: t
|
|
3561
3561
|
});
|
|
@@ -3564,167 +3564,167 @@ class $t extends w {
|
|
|
3564
3564
|
return this._def.type;
|
|
3565
3565
|
}
|
|
3566
3566
|
}
|
|
3567
|
-
class
|
|
3567
|
+
class Qe extends x {
|
|
3568
3568
|
_parse(e) {
|
|
3569
|
-
const { status: t, ctx:
|
|
3570
|
-
if (
|
|
3571
|
-
return
|
|
3569
|
+
const { status: t, ctx: r } = this._processInputParams(e);
|
|
3570
|
+
if (r.common.async)
|
|
3571
|
+
return I(this, null, function* () {
|
|
3572
3572
|
const a = yield this._def.in._parseAsync({
|
|
3573
|
-
data:
|
|
3574
|
-
path:
|
|
3575
|
-
parent:
|
|
3573
|
+
data: r.data,
|
|
3574
|
+
path: r.path,
|
|
3575
|
+
parent: r
|
|
3576
3576
|
});
|
|
3577
|
-
return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(),
|
|
3577
|
+
return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(), Ee(a.value)) : this._def.out._parseAsync({
|
|
3578
3578
|
data: a.value,
|
|
3579
|
-
path:
|
|
3580
|
-
parent:
|
|
3579
|
+
path: r.path,
|
|
3580
|
+
parent: r
|
|
3581
3581
|
});
|
|
3582
3582
|
});
|
|
3583
3583
|
{
|
|
3584
3584
|
const n = this._def.in._parseSync({
|
|
3585
|
-
data:
|
|
3586
|
-
path:
|
|
3587
|
-
parent:
|
|
3585
|
+
data: r.data,
|
|
3586
|
+
path: r.path,
|
|
3587
|
+
parent: r
|
|
3588
3588
|
});
|
|
3589
3589
|
return n.status === "aborted" ? _ : n.status === "dirty" ? (t.dirty(), {
|
|
3590
3590
|
status: "dirty",
|
|
3591
3591
|
value: n.value
|
|
3592
3592
|
}) : this._def.out._parseSync({
|
|
3593
3593
|
data: n.value,
|
|
3594
|
-
path:
|
|
3595
|
-
parent:
|
|
3594
|
+
path: r.path,
|
|
3595
|
+
parent: r
|
|
3596
3596
|
});
|
|
3597
3597
|
}
|
|
3598
3598
|
}
|
|
3599
3599
|
static create(e, t) {
|
|
3600
|
-
return new
|
|
3600
|
+
return new Qe({
|
|
3601
3601
|
in: e,
|
|
3602
3602
|
out: t,
|
|
3603
3603
|
typeName: y.ZodPipeline
|
|
3604
3604
|
});
|
|
3605
3605
|
}
|
|
3606
3606
|
}
|
|
3607
|
-
class
|
|
3607
|
+
class Xe extends x {
|
|
3608
3608
|
_parse(e) {
|
|
3609
|
-
const t = this._def.innerType._parse(e),
|
|
3610
|
-
return
|
|
3609
|
+
const t = this._def.innerType._parse(e), r = (n) => (_e(n) && (n.value = Object.freeze(n.value)), n);
|
|
3610
|
+
return De(t) ? t.then((n) => r(n)) : r(t);
|
|
3611
3611
|
}
|
|
3612
3612
|
unwrap() {
|
|
3613
3613
|
return this._def.innerType;
|
|
3614
3614
|
}
|
|
3615
3615
|
}
|
|
3616
|
-
|
|
3617
|
-
innerType:
|
|
3616
|
+
Xe.create = (s, e) => new Xe(d({
|
|
3617
|
+
innerType: s,
|
|
3618
3618
|
typeName: y.ZodReadonly
|
|
3619
|
-
},
|
|
3620
|
-
function Kt(
|
|
3621
|
-
const t = typeof
|
|
3619
|
+
}, w(e)));
|
|
3620
|
+
function Kt(s, e) {
|
|
3621
|
+
const t = typeof s == "function" ? s(e) : typeof s == "string" ? { message: s } : s;
|
|
3622
3622
|
return typeof t == "string" ? { message: t } : t;
|
|
3623
3623
|
}
|
|
3624
|
-
function
|
|
3625
|
-
return
|
|
3624
|
+
function ys(s, e = {}, t) {
|
|
3625
|
+
return s ? Oe.create().superRefine((r, n) => {
|
|
3626
3626
|
var a, i;
|
|
3627
|
-
const o = r
|
|
3627
|
+
const o = s(r);
|
|
3628
3628
|
if (o instanceof Promise)
|
|
3629
3629
|
return o.then((c) => {
|
|
3630
|
-
var
|
|
3630
|
+
var u, f;
|
|
3631
3631
|
if (!c) {
|
|
3632
|
-
const v = Kt(e,
|
|
3633
|
-
n.addIssue(g(
|
|
3632
|
+
const v = Kt(e, r), j = (f = (u = v.fatal) !== null && u !== void 0 ? u : t) !== null && f !== void 0 ? f : !0;
|
|
3633
|
+
n.addIssue(g(d({ code: "custom" }, v), { fatal: j }));
|
|
3634
3634
|
}
|
|
3635
3635
|
});
|
|
3636
3636
|
if (!o) {
|
|
3637
|
-
const c = Kt(e,
|
|
3638
|
-
n.addIssue(g(
|
|
3637
|
+
const c = Kt(e, r), u = (i = (a = c.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
|
|
3638
|
+
n.addIssue(g(d({ code: "custom" }, c), { fatal: u }));
|
|
3639
3639
|
}
|
|
3640
|
-
}) :
|
|
3640
|
+
}) : Oe.create();
|
|
3641
3641
|
}
|
|
3642
|
-
const
|
|
3643
|
-
object:
|
|
3642
|
+
const sn = {
|
|
3643
|
+
object: O.lazycreate
|
|
3644
3644
|
};
|
|
3645
3645
|
var y;
|
|
3646
|
-
(function(
|
|
3647
|
-
|
|
3646
|
+
(function(s) {
|
|
3647
|
+
s.ZodString = "ZodString", s.ZodNumber = "ZodNumber", s.ZodNaN = "ZodNaN", s.ZodBigInt = "ZodBigInt", s.ZodBoolean = "ZodBoolean", s.ZodDate = "ZodDate", s.ZodSymbol = "ZodSymbol", s.ZodUndefined = "ZodUndefined", s.ZodNull = "ZodNull", s.ZodAny = "ZodAny", s.ZodUnknown = "ZodUnknown", s.ZodNever = "ZodNever", s.ZodVoid = "ZodVoid", s.ZodArray = "ZodArray", s.ZodObject = "ZodObject", s.ZodUnion = "ZodUnion", s.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", s.ZodIntersection = "ZodIntersection", s.ZodTuple = "ZodTuple", s.ZodRecord = "ZodRecord", s.ZodMap = "ZodMap", s.ZodSet = "ZodSet", s.ZodFunction = "ZodFunction", s.ZodLazy = "ZodLazy", s.ZodLiteral = "ZodLiteral", s.ZodEnum = "ZodEnum", s.ZodEffects = "ZodEffects", s.ZodNativeEnum = "ZodNativeEnum", s.ZodOptional = "ZodOptional", s.ZodNullable = "ZodNullable", s.ZodDefault = "ZodDefault", s.ZodCatch = "ZodCatch", s.ZodPromise = "ZodPromise", s.ZodBranded = "ZodBranded", s.ZodPipeline = "ZodPipeline", s.ZodReadonly = "ZodReadonly";
|
|
3648
3648
|
})(y || (y = {}));
|
|
3649
|
-
const
|
|
3650
|
-
message: `Input not instance of ${
|
|
3651
|
-
}) =>
|
|
3652
|
-
string: (
|
|
3653
|
-
number: (
|
|
3654
|
-
boolean: (
|
|
3649
|
+
const rn = (s, e = {
|
|
3650
|
+
message: `Input not instance of ${s.name}`
|
|
3651
|
+
}) => ys((t) => t instanceof s, e), vs = B.create, _s = ue.create, nn = lt.create, an = de.create, bs = Le.create, on = be.create, cn = ct.create, un = Ve.create, dn = Ue.create, ln = Oe.create, fn = ve.create, hn = ae.create, pn = ut.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 = dt.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(d({}, s), { coerce: !0 })),
|
|
3653
|
+
number: (s) => ue.create(g(d({}, s), { coerce: !0 })),
|
|
3654
|
+
boolean: (s) => Le.create(g(d({}, s), {
|
|
3655
3655
|
coerce: !0
|
|
3656
3656
|
})),
|
|
3657
|
-
bigint: (
|
|
3658
|
-
date: (
|
|
3657
|
+
bigint: (s) => de.create(g(d({}, s), { coerce: !0 })),
|
|
3658
|
+
date: (s) => be.create(g(d({}, s), { coerce: !0 }))
|
|
3659
3659
|
}, Dn = _;
|
|
3660
3660
|
var T = /* @__PURE__ */ Object.freeze({
|
|
3661
3661
|
__proto__: null,
|
|
3662
|
-
defaultErrorMap:
|
|
3663
|
-
setErrorMap:
|
|
3662
|
+
defaultErrorMap: Ie,
|
|
3663
|
+
setErrorMap: jr,
|
|
3664
3664
|
getErrorMap: at,
|
|
3665
3665
|
makeIssue: it,
|
|
3666
|
-
EMPTY_PATH:
|
|
3666
|
+
EMPTY_PATH: Rr,
|
|
3667
3667
|
addIssueToContext: h,
|
|
3668
3668
|
ParseStatus: Z,
|
|
3669
3669
|
INVALID: _,
|
|
3670
|
-
DIRTY:
|
|
3670
|
+
DIRTY: Ee,
|
|
3671
3671
|
OK: $,
|
|
3672
3672
|
isAborted: Nt,
|
|
3673
3673
|
isDirty: jt,
|
|
3674
|
-
isValid:
|
|
3675
|
-
isAsync:
|
|
3674
|
+
isValid: _e,
|
|
3675
|
+
isAsync: De,
|
|
3676
3676
|
get util() {
|
|
3677
|
-
return
|
|
3677
|
+
return k;
|
|
3678
3678
|
},
|
|
3679
3679
|
get objectUtil() {
|
|
3680
3680
|
return Ot;
|
|
3681
3681
|
},
|
|
3682
3682
|
ZodParsedType: p,
|
|
3683
|
-
getParsedType:
|
|
3684
|
-
ZodType:
|
|
3685
|
-
datetimeRegex:
|
|
3686
|
-
ZodString:
|
|
3687
|
-
ZodNumber:
|
|
3688
|
-
ZodBigInt:
|
|
3689
|
-
ZodBoolean:
|
|
3690
|
-
ZodDate:
|
|
3683
|
+
getParsedType: re,
|
|
3684
|
+
ZodType: x,
|
|
3685
|
+
datetimeRegex: ms,
|
|
3686
|
+
ZodString: B,
|
|
3687
|
+
ZodNumber: ue,
|
|
3688
|
+
ZodBigInt: de,
|
|
3689
|
+
ZodBoolean: Le,
|
|
3690
|
+
ZodDate: be,
|
|
3691
3691
|
ZodSymbol: ct,
|
|
3692
|
-
ZodUndefined:
|
|
3693
|
-
ZodNull:
|
|
3694
|
-
ZodAny:
|
|
3695
|
-
ZodUnknown:
|
|
3696
|
-
ZodNever:
|
|
3697
|
-
ZodVoid:
|
|
3698
|
-
ZodArray:
|
|
3699
|
-
ZodObject:
|
|
3700
|
-
ZodUnion:
|
|
3692
|
+
ZodUndefined: Ve,
|
|
3693
|
+
ZodNull: Ue,
|
|
3694
|
+
ZodAny: Oe,
|
|
3695
|
+
ZodUnknown: ve,
|
|
3696
|
+
ZodNever: ae,
|
|
3697
|
+
ZodVoid: ut,
|
|
3698
|
+
ZodArray: q,
|
|
3699
|
+
ZodObject: O,
|
|
3700
|
+
ZodUnion: We,
|
|
3701
3701
|
ZodDiscriminatedUnion: ft,
|
|
3702
|
-
ZodIntersection:
|
|
3703
|
-
ZodTuple:
|
|
3704
|
-
ZodRecord:
|
|
3705
|
-
ZodMap:
|
|
3706
|
-
ZodSet:
|
|
3707
|
-
ZodFunction:
|
|
3708
|
-
ZodLazy:
|
|
3709
|
-
ZodLiteral:
|
|
3710
|
-
ZodEnum:
|
|
3711
|
-
ZodNativeEnum:
|
|
3712
|
-
ZodPromise:
|
|
3713
|
-
ZodEffects:
|
|
3714
|
-
ZodTransformer:
|
|
3715
|
-
ZodOptional:
|
|
3716
|
-
ZodNullable:
|
|
3717
|
-
ZodDefault:
|
|
3718
|
-
ZodCatch:
|
|
3702
|
+
ZodIntersection: ze,
|
|
3703
|
+
ZodTuple: Q,
|
|
3704
|
+
ZodRecord: Be,
|
|
3705
|
+
ZodMap: dt,
|
|
3706
|
+
ZodSet: we,
|
|
3707
|
+
ZodFunction: Ae,
|
|
3708
|
+
ZodLazy: qe,
|
|
3709
|
+
ZodLiteral: He,
|
|
3710
|
+
ZodEnum: le,
|
|
3711
|
+
ZodNativeEnum: Je,
|
|
3712
|
+
ZodPromise: Ne,
|
|
3713
|
+
ZodEffects: H,
|
|
3714
|
+
ZodTransformer: H,
|
|
3715
|
+
ZodOptional: X,
|
|
3716
|
+
ZodNullable: fe,
|
|
3717
|
+
ZodDefault: Ge,
|
|
3718
|
+
ZodCatch: Ke,
|
|
3719
3719
|
ZodNaN: lt,
|
|
3720
3720
|
BRAND: tn,
|
|
3721
3721
|
ZodBranded: $t,
|
|
3722
|
-
ZodPipeline:
|
|
3723
|
-
ZodReadonly:
|
|
3724
|
-
custom:
|
|
3725
|
-
Schema:
|
|
3726
|
-
ZodSchema:
|
|
3727
|
-
late:
|
|
3722
|
+
ZodPipeline: Qe,
|
|
3723
|
+
ZodReadonly: Xe,
|
|
3724
|
+
custom: ys,
|
|
3725
|
+
Schema: x,
|
|
3726
|
+
ZodSchema: x,
|
|
3727
|
+
late: sn,
|
|
3728
3728
|
get ZodFirstPartyTypeKind() {
|
|
3729
3729
|
return y;
|
|
3730
3730
|
},
|
|
@@ -3732,13 +3732,13 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3732
3732
|
any: ln,
|
|
3733
3733
|
array: mn,
|
|
3734
3734
|
bigint: an,
|
|
3735
|
-
boolean:
|
|
3735
|
+
boolean: bs,
|
|
3736
3736
|
date: on,
|
|
3737
3737
|
discriminatedUnion: _n,
|
|
3738
3738
|
effect: Xt,
|
|
3739
3739
|
enum: Cn,
|
|
3740
3740
|
function: Sn,
|
|
3741
|
-
instanceof:
|
|
3741
|
+
instanceof: rn,
|
|
3742
3742
|
intersection: bn,
|
|
3743
3743
|
lazy: En,
|
|
3744
3744
|
literal: An,
|
|
@@ -3746,9 +3746,9 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3746
3746
|
nan: nn,
|
|
3747
3747
|
nativeEnum: In,
|
|
3748
3748
|
never: hn,
|
|
3749
|
-
null:
|
|
3749
|
+
null: dn,
|
|
3750
3750
|
nullable: jn,
|
|
3751
|
-
number:
|
|
3751
|
+
number: _s,
|
|
3752
3752
|
object: gn,
|
|
3753
3753
|
oboolean: $n,
|
|
3754
3754
|
onumber: Pn,
|
|
@@ -3760,18 +3760,18 @@ var T = /* @__PURE__ */ Object.freeze({
|
|
|
3760
3760
|
record: xn,
|
|
3761
3761
|
set: Tn,
|
|
3762
3762
|
strictObject: yn,
|
|
3763
|
-
string:
|
|
3763
|
+
string: vs,
|
|
3764
3764
|
symbol: cn,
|
|
3765
3765
|
transformer: Xt,
|
|
3766
3766
|
tuple: wn,
|
|
3767
|
-
undefined:
|
|
3767
|
+
undefined: un,
|
|
3768
3768
|
union: vn,
|
|
3769
3769
|
unknown: fn,
|
|
3770
3770
|
void: pn,
|
|
3771
3771
|
NEVER: Dn,
|
|
3772
3772
|
ZodIssueCode: l,
|
|
3773
|
-
quotelessJson:
|
|
3774
|
-
ZodError:
|
|
3773
|
+
quotelessJson: Nr,
|
|
3774
|
+
ZodError: U
|
|
3775
3775
|
});
|
|
3776
3776
|
const Ln = T.object({
|
|
3777
3777
|
language: T.enum(["typescript", "javascript"]).optional(),
|
|
@@ -3816,8 +3816,8 @@ const Ln = T.object({
|
|
|
3816
3816
|
enableTranslation: T.boolean().optional()
|
|
3817
3817
|
})
|
|
3818
3818
|
])
|
|
3819
|
-
), Vn = (
|
|
3820
|
-
const e = Ln.safeParse(
|
|
3819
|
+
), Vn = (s) => {
|
|
3820
|
+
const e = Ln.safeParse(s);
|
|
3821
3821
|
if (e.success === !1) {
|
|
3822
3822
|
const t = new Error("Invalid codegen settings");
|
|
3823
3823
|
throw t.cause = e.error, t;
|
|
@@ -3829,15 +3829,15 @@ const Ln = T.object({
|
|
|
3829
3829
|
"COMPONENT",
|
|
3830
3830
|
"COMPONENT_SET",
|
|
3831
3831
|
"GROUP"
|
|
3832
|
-
]), Un = (
|
|
3833
|
-
const
|
|
3834
|
-
if (!
|
|
3832
|
+
]), Un = (s, e, t = { allowAutoSelectFirstNode: !0 }) => {
|
|
3833
|
+
const r = ds(s.document, e);
|
|
3834
|
+
if (!r)
|
|
3835
3835
|
return {
|
|
3836
3836
|
isValid: !1,
|
|
3837
3837
|
reason: "There is no node with the given id"
|
|
3838
3838
|
};
|
|
3839
|
-
if (
|
|
3840
|
-
const n =
|
|
3839
|
+
if (r.type === "CANVAS") {
|
|
3840
|
+
const n = r.children.filter(
|
|
3841
3841
|
(a) => Yt.has(a.type)
|
|
3842
3842
|
);
|
|
3843
3843
|
return n.length === 0 ? {
|
|
@@ -3856,41 +3856,41 @@ const Ln = T.object({
|
|
|
3856
3856
|
reason: "Selected node is a page with multiple children"
|
|
3857
3857
|
};
|
|
3858
3858
|
}
|
|
3859
|
-
return Yt.has(
|
|
3859
|
+
return Yt.has(r.type) ? { isValid: !0, node: r } : {
|
|
3860
3860
|
isValid: !1,
|
|
3861
3861
|
reason: "Selected node type is not supported"
|
|
3862
3862
|
};
|
|
3863
3863
|
};
|
|
3864
|
-
var
|
|
3865
|
-
class
|
|
3864
|
+
var A, Ye, ne, ws, Fe;
|
|
3865
|
+
class ta {
|
|
3866
3866
|
constructor({
|
|
3867
3867
|
auth: e,
|
|
3868
3868
|
apiBaseAddress: t = "https://public-api.animaapp.com"
|
|
3869
3869
|
} = {}) {
|
|
3870
|
-
tt(this,
|
|
3871
|
-
tt(this,
|
|
3872
|
-
tt(this,
|
|
3873
|
-
gt(this,
|
|
3870
|
+
tt(this, ne);
|
|
3871
|
+
tt(this, A);
|
|
3872
|
+
tt(this, Ye);
|
|
3873
|
+
gt(this, Ye, t), e && (this.auth = e);
|
|
3874
3874
|
}
|
|
3875
3875
|
hasAuth() {
|
|
3876
|
-
return !!
|
|
3876
|
+
return !!C(this, A);
|
|
3877
3877
|
}
|
|
3878
3878
|
set auth(e) {
|
|
3879
|
-
gt(this,
|
|
3879
|
+
gt(this, A, e);
|
|
3880
3880
|
}
|
|
3881
3881
|
get headers() {
|
|
3882
3882
|
const e = {
|
|
3883
3883
|
"Content-Type": "application/json"
|
|
3884
3884
|
};
|
|
3885
|
-
return
|
|
3885
|
+
return C(this, A) && (e.Authorization = `Bearer ${C(this, A).token}`, "teamId" in C(this, A) && (e["X-Team-Id"] = C(this, A).teamId)), e;
|
|
3886
3886
|
}
|
|
3887
3887
|
generateCode(n) {
|
|
3888
|
-
return
|
|
3888
|
+
return I(this, arguments, function* (e, t = {}, r) {
|
|
3889
3889
|
var c;
|
|
3890
3890
|
const a = Vn(e.settings);
|
|
3891
|
-
e.figmaToken && (yield
|
|
3891
|
+
e.figmaToken && (yield Te(this, ne, ws).call(this, e.fileKey, e.figmaToken, e.nodesId, { allowAutoSelectFirstNode: (c = a.allowAutoSelectFirstNode) != null ? c : !0 }, r));
|
|
3892
3892
|
let i = e.tracking;
|
|
3893
|
-
|
|
3893
|
+
C(this, A) && "userId" in C(this, A) && C(this, A).userId && (i != null && i.externalId || (i = { externalId: C(this, A).userId }));
|
|
3894
3894
|
const o = {
|
|
3895
3895
|
tracking: i,
|
|
3896
3896
|
fileKey: e.fileKey,
|
|
@@ -3917,13 +3917,13 @@ class ea {
|
|
|
3917
3917
|
codegenSettings: a.codegenSettings,
|
|
3918
3918
|
webhookUrl: e.webhookUrl
|
|
3919
3919
|
};
|
|
3920
|
-
return
|
|
3920
|
+
return Te(this, ne, Fe).call(this, "/v1/codegen", o, t, "codegen", r);
|
|
3921
3921
|
});
|
|
3922
3922
|
}
|
|
3923
3923
|
generateCodeFromWebsite(n) {
|
|
3924
|
-
return
|
|
3924
|
+
return I(this, arguments, function* (e, t = {}, r) {
|
|
3925
3925
|
let a = e.tracking;
|
|
3926
|
-
|
|
3926
|
+
C(this, A) && "userId" in C(this, A) && C(this, A).userId && (a != null && a.externalId || (a = { externalId: C(this, A).userId }));
|
|
3927
3927
|
let i;
|
|
3928
3928
|
if (e.mhtml)
|
|
3929
3929
|
i = {
|
|
@@ -3953,7 +3953,7 @@ class ea {
|
|
|
3953
3953
|
}
|
|
3954
3954
|
}
|
|
3955
3955
|
};
|
|
3956
|
-
return
|
|
3956
|
+
return Te(this, ne, Fe).call(this, "/v1/l2c", o, t, "l2c", r);
|
|
3957
3957
|
});
|
|
3958
3958
|
}
|
|
3959
3959
|
/**
|
|
@@ -3989,14 +3989,14 @@ class ea {
|
|
|
3989
3989
|
* ```
|
|
3990
3990
|
*/
|
|
3991
3991
|
generateCodeFromPrompt(n) {
|
|
3992
|
-
return
|
|
3992
|
+
return I(this, arguments, function* (e, t = {}, r) {
|
|
3993
3993
|
var o;
|
|
3994
3994
|
let a = e.tracking;
|
|
3995
|
-
|
|
3995
|
+
C(this, A) && "userId" in C(this, A) && C(this, A).userId && (a != null && a.externalId || (a = { externalId: C(this, A).userId }));
|
|
3996
3996
|
const i = {
|
|
3997
3997
|
tracking: a,
|
|
3998
3998
|
assetsStorage: e.assetsStorage,
|
|
3999
|
-
params:
|
|
3999
|
+
params: d({
|
|
4000
4000
|
prompt: e.prompt,
|
|
4001
4001
|
conventions: {
|
|
4002
4002
|
language: e.settings.language,
|
|
@@ -4007,30 +4007,30 @@ class ea {
|
|
|
4007
4007
|
}, (o = e.settings.codegenSettings) != null ? o : {}),
|
|
4008
4008
|
webhookUrl: e.webhookUrl
|
|
4009
4009
|
};
|
|
4010
|
-
return console.log("P2C Request Body:", JSON.stringify(i, null, 2)),
|
|
4010
|
+
return console.log("P2C Request Body:", JSON.stringify(i, null, 2)), Te(this, ne, Fe).call(this, "/v1/p2c", i, t, "p2c", r);
|
|
4011
4011
|
});
|
|
4012
4012
|
}
|
|
4013
4013
|
/**
|
|
4014
4014
|
* @deprecated This method will be removed soon, please use `generateCodeFromWebsite` instead.
|
|
4015
4015
|
*/
|
|
4016
4016
|
generateLink2Code(n) {
|
|
4017
|
-
return
|
|
4017
|
+
return I(this, arguments, function* (e, t = {}, r) {
|
|
4018
4018
|
let a = e.tracking;
|
|
4019
|
-
|
|
4019
|
+
C(this, A) && "userId" in C(this, A) && C(this, A).userId && (a != null && a.externalId || (a = { externalId: C(this, A).userId }));
|
|
4020
4020
|
const i = {
|
|
4021
4021
|
tracking: a,
|
|
4022
4022
|
assetsStorage: e.assetsStorage,
|
|
4023
4023
|
params: e.params
|
|
4024
4024
|
};
|
|
4025
|
-
return
|
|
4025
|
+
return Te(this, ne, Fe).call(this, "/v1/l2c", i, t, "l2c", r);
|
|
4026
4026
|
});
|
|
4027
4027
|
}
|
|
4028
4028
|
}
|
|
4029
|
-
|
|
4030
|
-
return
|
|
4029
|
+
A = new WeakMap(), Ye = new WeakMap(), ne = new WeakSet(), ws = function(e, t, r, n, a) {
|
|
4030
|
+
return I(this, null, function* () {
|
|
4031
4031
|
let i;
|
|
4032
4032
|
try {
|
|
4033
|
-
i = yield
|
|
4033
|
+
i = yield Or({
|
|
4034
4034
|
fileKey: e,
|
|
4035
4035
|
authToken: t,
|
|
4036
4036
|
params: {
|
|
@@ -4038,199 +4038,205 @@ E = new WeakMap(), Qe = new WeakMap(), ie = new WeakSet(), wr = function(e, t, s
|
|
|
4038
4038
|
},
|
|
4039
4039
|
signal: a
|
|
4040
4040
|
});
|
|
4041
|
-
} catch (
|
|
4042
|
-
if (
|
|
4043
|
-
throw
|
|
4041
|
+
} catch (u) {
|
|
4042
|
+
if (u instanceof Error && u.name === "AbortError")
|
|
4043
|
+
throw u;
|
|
4044
4044
|
return;
|
|
4045
4045
|
}
|
|
4046
|
-
const c =
|
|
4047
|
-
(
|
|
4046
|
+
const c = r.map(
|
|
4047
|
+
(u) => Un(i, u, n)
|
|
4048
4048
|
).find(
|
|
4049
|
-
(
|
|
4049
|
+
(u) => !u.isValid
|
|
4050
4050
|
);
|
|
4051
4051
|
if (c)
|
|
4052
|
-
throw new
|
|
4052
|
+
throw new me({
|
|
4053
4053
|
name: "Task Crashed",
|
|
4054
4054
|
reason: c.reason
|
|
4055
4055
|
});
|
|
4056
4056
|
});
|
|
4057
|
-
},
|
|
4058
|
-
return
|
|
4059
|
-
var v, j, M, F,
|
|
4057
|
+
}, Fe = function(e, t, r, n, a) {
|
|
4058
|
+
return I(this, null, function* () {
|
|
4059
|
+
var v, j, M, F, W, ee, he, ie, L, oe, et;
|
|
4060
4060
|
if (this.hasAuth() === !1)
|
|
4061
4061
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
4062
|
-
const i = {}, o = yield fetch(`${
|
|
4062
|
+
const i = {}, o = yield fetch(`${C(this, Ye)}${e}`, {
|
|
4063
4063
|
method: "POST",
|
|
4064
|
-
headers: g(
|
|
4064
|
+
headers: g(d({}, this.headers), {
|
|
4065
4065
|
Accept: "text/event-stream"
|
|
4066
4066
|
}),
|
|
4067
4067
|
body: JSON.stringify(t),
|
|
4068
4068
|
signal: a
|
|
4069
4069
|
});
|
|
4070
4070
|
if (!o.ok) {
|
|
4071
|
-
const
|
|
4072
|
-
let
|
|
4071
|
+
const xe = yield o.text();
|
|
4072
|
+
let E;
|
|
4073
4073
|
try {
|
|
4074
|
-
|
|
4075
|
-
} catch (
|
|
4074
|
+
E = JSON.parse(xe);
|
|
4075
|
+
} catch (ke) {
|
|
4076
4076
|
}
|
|
4077
|
-
throw ((v =
|
|
4077
|
+
throw ((v = E == null ? void 0 : E.error) == null ? void 0 : v.name) === "ZodError" ? (console.log(
|
|
4078
4078
|
"Zod validation error:",
|
|
4079
|
-
JSON.stringify(
|
|
4080
|
-
), new
|
|
4079
|
+
JSON.stringify(E.error.issues, null, 2)
|
|
4080
|
+
), new me({
|
|
4081
4081
|
name: "HTTP error from Anima API",
|
|
4082
4082
|
reason: "Invalid body payload",
|
|
4083
|
-
detail:
|
|
4083
|
+
detail: E.error.issues,
|
|
4084
4084
|
status: o.status
|
|
4085
|
-
})) : typeof
|
|
4086
|
-
name: `Error "${
|
|
4085
|
+
})) : typeof E == "object" ? new me({
|
|
4086
|
+
name: `Error "${E}"`,
|
|
4087
4087
|
reason: "Unknown",
|
|
4088
4088
|
status: o.status
|
|
4089
|
-
}) : new
|
|
4089
|
+
}) : new me({
|
|
4090
4090
|
name: "HTTP error from Anima API",
|
|
4091
|
-
reason:
|
|
4091
|
+
reason: xe,
|
|
4092
4092
|
status: o.status
|
|
4093
4093
|
});
|
|
4094
4094
|
}
|
|
4095
4095
|
if (!o.body)
|
|
4096
|
-
throw new
|
|
4096
|
+
throw new me({
|
|
4097
4097
|
name: "Stream Error",
|
|
4098
4098
|
reason: "Response body is null",
|
|
4099
4099
|
status: o.status
|
|
4100
4100
|
});
|
|
4101
|
-
const c = o.body.getReader(),
|
|
4101
|
+
const c = o.body.getReader(), u = new TextDecoder();
|
|
4102
4102
|
let f = "";
|
|
4103
4103
|
try {
|
|
4104
4104
|
for (; ; ) {
|
|
4105
|
-
const { done:
|
|
4106
|
-
if (
|
|
4105
|
+
const { done: xe, value: E } = yield c.read();
|
|
4106
|
+
if (xe)
|
|
4107
4107
|
break;
|
|
4108
|
-
f +=
|
|
4109
|
-
const
|
|
4108
|
+
f += u.decode(E, { stream: !0 });
|
|
4109
|
+
const ke = f.split(`
|
|
4110
4110
|
`);
|
|
4111
|
-
f =
|
|
4112
|
-
for (const
|
|
4113
|
-
if (!(!
|
|
4114
|
-
let
|
|
4111
|
+
f = ke.pop() || "";
|
|
4112
|
+
for (const pe of ke)
|
|
4113
|
+
if (!(!pe.trim() || pe.startsWith(":")) && pe.startsWith("data: ")) {
|
|
4114
|
+
let b;
|
|
4115
4115
|
try {
|
|
4116
|
-
|
|
4117
|
-
} catch (
|
|
4116
|
+
b = JSON.parse(pe.slice(6));
|
|
4117
|
+
} catch (Kn) {
|
|
4118
4118
|
continue;
|
|
4119
4119
|
}
|
|
4120
|
-
switch (
|
|
4120
|
+
switch (b.type) {
|
|
4121
4121
|
case "queueing": {
|
|
4122
|
-
typeof
|
|
4122
|
+
typeof r == "function" ? r(b) : (j = r.onQueueing) == null || j.call(r, {
|
|
4123
|
+
sessionId: b.sessionId
|
|
4124
|
+
});
|
|
4123
4125
|
break;
|
|
4124
4126
|
}
|
|
4125
4127
|
case "start": {
|
|
4126
|
-
i.sessionId =
|
|
4128
|
+
i.sessionId = b.sessionId, typeof r == "function" ? r(b) : (M = r.onStart) == null || M.call(r, { sessionId: b.sessionId });
|
|
4127
4129
|
break;
|
|
4128
4130
|
}
|
|
4129
4131
|
case "pre_codegen": {
|
|
4130
|
-
n === "codegen" && (typeof
|
|
4131
|
-
message:
|
|
4132
|
+
n === "codegen" && (typeof r == "function" ? r(b) : (F = r.onPreCodegen) == null || F.call(r, {
|
|
4133
|
+
message: b.message
|
|
4132
4134
|
}));
|
|
4133
4135
|
break;
|
|
4134
4136
|
}
|
|
4135
4137
|
case "assets_uploaded": {
|
|
4136
|
-
typeof
|
|
4138
|
+
typeof r == "function" ? r(b) : (W = r.onAssetsUploaded) == null || W.call(r);
|
|
4137
4139
|
break;
|
|
4138
4140
|
}
|
|
4139
4141
|
case "assets_list": {
|
|
4140
|
-
i.assets =
|
|
4142
|
+
i.assets = b.payload.assets, typeof r == "function" ? r(b) : (ee = r.onAssetsList) == null || ee.call(r, b.payload);
|
|
4141
4143
|
break;
|
|
4142
4144
|
}
|
|
4143
4145
|
case "figma_metadata": {
|
|
4144
|
-
n === "codegen" && (i.figmaFileName =
|
|
4145
|
-
figmaFileName:
|
|
4146
|
-
figmaSelectedFrameName:
|
|
4146
|
+
n === "codegen" && (i.figmaFileName = b.figmaFileName, i.figmaSelectedFrameName = b.figmaSelectedFrameName, typeof r == "function" ? r(b) : (he = r.onFigmaMetadata) == null || he.call(r, {
|
|
4147
|
+
figmaFileName: b.figmaFileName,
|
|
4148
|
+
figmaSelectedFrameName: b.figmaSelectedFrameName
|
|
4147
4149
|
}));
|
|
4148
4150
|
break;
|
|
4149
4151
|
}
|
|
4150
4152
|
case "generating_code": {
|
|
4151
|
-
|
|
4152
|
-
status:
|
|
4153
|
-
progress:
|
|
4154
|
-
files:
|
|
4153
|
+
b.payload.status === "success" && (i.files = b.payload.files), typeof r == "function" ? r(b) : (ie = r.onGeneratingCode) == null || ie.call(r, {
|
|
4154
|
+
status: b.payload.status,
|
|
4155
|
+
progress: b.payload.progress,
|
|
4156
|
+
files: b.payload.files
|
|
4155
4157
|
});
|
|
4156
4158
|
break;
|
|
4157
4159
|
}
|
|
4158
4160
|
case "progress_messages_updated": {
|
|
4159
|
-
typeof
|
|
4160
|
-
|
|
4161
|
-
|
|
4161
|
+
typeof r == "function" ? r(b) : (L = r.onProgressMessagesUpdated) == null || L.call(
|
|
4162
|
+
r,
|
|
4163
|
+
b.payload.progressMessages
|
|
4162
4164
|
);
|
|
4163
4165
|
break;
|
|
4164
4166
|
}
|
|
4167
|
+
case "job_status_updated": {
|
|
4168
|
+
typeof r == "function" ? r(b) : (oe = r.onJobStatusUpdated) == null || oe.call(r, b.payload.jobStatus);
|
|
4169
|
+
break;
|
|
4170
|
+
}
|
|
4165
4171
|
case "codegen_completed":
|
|
4166
4172
|
case "generation_completed": {
|
|
4167
|
-
typeof
|
|
4173
|
+
typeof r == "function" ? r(b) : (et = r.onCodegenCompleted) == null || et.call(r);
|
|
4168
4174
|
break;
|
|
4169
4175
|
}
|
|
4170
4176
|
case "error":
|
|
4171
|
-
throw new
|
|
4172
|
-
name:
|
|
4173
|
-
reason:
|
|
4177
|
+
throw new me({
|
|
4178
|
+
name: b.payload.errorName,
|
|
4179
|
+
reason: b.payload.reason
|
|
4174
4180
|
});
|
|
4175
4181
|
case "done":
|
|
4176
|
-
return i.tokenUsage =
|
|
4182
|
+
return i.tokenUsage = b.payload.tokenUsage, i.sessionId = b.payload.sessionId, i;
|
|
4177
4183
|
}
|
|
4178
4184
|
}
|
|
4179
4185
|
}
|
|
4180
4186
|
} finally {
|
|
4181
4187
|
c.cancel();
|
|
4182
4188
|
}
|
|
4183
|
-
throw new
|
|
4189
|
+
throw new me({
|
|
4184
4190
|
name: "Connection",
|
|
4185
4191
|
reason: "Connection closed before the 'done' message",
|
|
4186
4192
|
status: 500
|
|
4187
4193
|
});
|
|
4188
4194
|
});
|
|
4189
4195
|
};
|
|
4190
|
-
const
|
|
4196
|
+
const sa = (s) => {
|
|
4191
4197
|
var e;
|
|
4192
|
-
if (!
|
|
4198
|
+
if (!s)
|
|
4193
4199
|
return [!1, "", ""];
|
|
4194
4200
|
try {
|
|
4195
|
-
const t = new URL(
|
|
4201
|
+
const t = new URL(s), r = t.pathname;
|
|
4196
4202
|
if (t.origin !== "https://www.figma.com")
|
|
4197
4203
|
return [!1, "", ""];
|
|
4198
4204
|
const n = t.toString();
|
|
4199
|
-
if (
|
|
4205
|
+
if (s !== n)
|
|
4200
4206
|
return [!1, "", ""];
|
|
4201
|
-
const a = ((e = t.searchParams.get("node-id")) != null ? e : "").replace(/-/g, ":"), i =
|
|
4202
|
-
return [(
|
|
4207
|
+
const a = ((e = t.searchParams.get("node-id")) != null ? e : "").replace(/-/g, ":"), i = r.split("/")[2];
|
|
4208
|
+
return [(r.startsWith("/file/") && t.searchParams.get("type") !== "whiteboard" || r.startsWith("/design/") || r.startsWith("/proto/")) && i.length === 22, i, a];
|
|
4203
4209
|
} catch (t) {
|
|
4204
4210
|
return [!1, "", ""];
|
|
4205
4211
|
}
|
|
4206
4212
|
}, ra = ({
|
|
4207
|
-
fileKey:
|
|
4213
|
+
fileKey: s,
|
|
4208
4214
|
nodeId: e,
|
|
4209
4215
|
duplicate: t
|
|
4210
4216
|
}) => {
|
|
4211
|
-
const
|
|
4212
|
-
return
|
|
4217
|
+
const r = new URL("https://www.figma.com");
|
|
4218
|
+
return r.pathname = `design/${s}`, t && (r.pathname = `${r.pathname}/dummy/duplicate`), e && r.searchParams.set("node-id", e.replace(":", "-")), r;
|
|
4213
4219
|
};
|
|
4214
|
-
class
|
|
4220
|
+
class na extends Error {
|
|
4215
4221
|
constructor(e, t) {
|
|
4216
4222
|
super(e), this.response = t;
|
|
4217
4223
|
}
|
|
4218
4224
|
}
|
|
4219
|
-
const
|
|
4220
|
-
files:
|
|
4225
|
+
const aa = ({
|
|
4226
|
+
files: s,
|
|
4221
4227
|
screenPath: e = "src/screens"
|
|
4222
4228
|
}) => {
|
|
4223
|
-
const t = {},
|
|
4229
|
+
const t = {}, r = /* @__PURE__ */ new Set();
|
|
4224
4230
|
function n(a) {
|
|
4225
|
-
if (
|
|
4231
|
+
if (r.has(a) || !s[a])
|
|
4226
4232
|
return;
|
|
4227
|
-
|
|
4233
|
+
r.add(a), t[a] = s[a], Wn(s[a].content).forEach((o) => {
|
|
4228
4234
|
try {
|
|
4229
4235
|
const c = zn(a, o);
|
|
4230
4236
|
if (c.startsWith("src/")) {
|
|
4231
|
-
const
|
|
4232
|
-
Bn(
|
|
4233
|
-
|
|
4237
|
+
const u = c.split("/").slice(0, -1).join("/");
|
|
4238
|
+
Bn(s, u).forEach((v) => {
|
|
4239
|
+
r.has(v) || n(v);
|
|
4234
4240
|
});
|
|
4235
4241
|
}
|
|
4236
4242
|
} catch (c) {
|
|
@@ -4241,45 +4247,45 @@ const na = ({
|
|
|
4241
4247
|
}
|
|
4242
4248
|
});
|
|
4243
4249
|
}
|
|
4244
|
-
return Object.entries(
|
|
4250
|
+
return Object.entries(s).forEach(([a, i]) => {
|
|
4245
4251
|
a.startsWith(e) ? n(a) : a.startsWith("src/") || (t[a] = i);
|
|
4246
4252
|
}), t;
|
|
4247
4253
|
};
|
|
4248
|
-
function Wn(
|
|
4249
|
-
const e = /import.*?["']([^"']+)["']/g, t = /export.*from\s+["']([^"']+)["']/g,
|
|
4254
|
+
function Wn(s) {
|
|
4255
|
+
const e = /import.*?["']([^"']+)["']/g, t = /export.*from\s+["']([^"']+)["']/g, r = [];
|
|
4250
4256
|
let n;
|
|
4251
|
-
for (; (n = e.exec(
|
|
4252
|
-
|
|
4253
|
-
for (; (n = t.exec(
|
|
4254
|
-
|
|
4255
|
-
return [...new Set(
|
|
4257
|
+
for (; (n = e.exec(s)) !== null; )
|
|
4258
|
+
r.push(n[1]);
|
|
4259
|
+
for (; (n = t.exec(s)) !== null; )
|
|
4260
|
+
r.push(n[1]);
|
|
4261
|
+
return [...new Set(r)];
|
|
4256
4262
|
}
|
|
4257
|
-
function zn(
|
|
4263
|
+
function zn(s, e) {
|
|
4258
4264
|
if (!e.startsWith("."))
|
|
4259
4265
|
return e;
|
|
4260
|
-
const t =
|
|
4261
|
-
for (const a of
|
|
4266
|
+
const t = s.split("/").slice(0, -1), r = e.split("/"), n = [...t];
|
|
4267
|
+
for (const a of r)
|
|
4262
4268
|
a === ".." ? n.pop() : a !== "." && n.push(a);
|
|
4263
4269
|
return n.join("/");
|
|
4264
4270
|
}
|
|
4265
|
-
function Bn(
|
|
4266
|
-
return Object.keys(
|
|
4271
|
+
function Bn(s, e) {
|
|
4272
|
+
return Object.keys(s).filter((t) => t.startsWith(e));
|
|
4267
4273
|
}
|
|
4268
|
-
function ht(
|
|
4274
|
+
function ht(s, e, t) {
|
|
4269
4275
|
return new ReadableStream({
|
|
4270
|
-
start(
|
|
4271
|
-
t.call(
|
|
4272
|
-
n.type === "error" ||
|
|
4276
|
+
start(r) {
|
|
4277
|
+
t.call(s, e, (n) => {
|
|
4278
|
+
n.type === "error" || r.enqueue(n), (n.type === "aborted" || n.type === "error") && r.close();
|
|
4273
4279
|
}).then((n) => {
|
|
4274
|
-
|
|
4280
|
+
r.enqueue({
|
|
4275
4281
|
type: "done",
|
|
4276
4282
|
payload: {
|
|
4277
4283
|
tokenUsage: n.tokenUsage,
|
|
4278
4284
|
sessionId: n.sessionId
|
|
4279
4285
|
}
|
|
4280
|
-
}),
|
|
4286
|
+
}), r.close();
|
|
4281
4287
|
}).catch((n) => {
|
|
4282
|
-
|
|
4288
|
+
r.enqueue({
|
|
4283
4289
|
type: "error",
|
|
4284
4290
|
payload: {
|
|
4285
4291
|
name: "name" in n ? n.name : "Unknown error",
|
|
@@ -4288,19 +4294,19 @@ function ht(r, e, t) {
|
|
|
4288
4294
|
detail: "detail" in n ? n.detail : void 0,
|
|
4289
4295
|
errorPayload: "payload" in n ? n.payload : void 0
|
|
4290
4296
|
}
|
|
4291
|
-
}),
|
|
4297
|
+
}), r.close();
|
|
4292
4298
|
});
|
|
4293
4299
|
}
|
|
4294
4300
|
});
|
|
4295
4301
|
}
|
|
4296
|
-
const qn = (
|
|
4297
|
-
function pt(
|
|
4298
|
-
return
|
|
4299
|
-
var i, o, c,
|
|
4300
|
-
const [e, t] =
|
|
4301
|
-
if (
|
|
4302
|
-
return new Response(JSON.stringify(
|
|
4303
|
-
status: ((o =
|
|
4302
|
+
const qn = (s, e) => ht(s, e, s.generateCode);
|
|
4303
|
+
function pt(s) {
|
|
4304
|
+
return I(this, null, function* () {
|
|
4305
|
+
var i, o, c, u;
|
|
4306
|
+
const [e, t] = s.tee(), r = yield e.getReader().read();
|
|
4307
|
+
if (r.done || !r.value || r.value.type === "error" && ((i = r.value.payload) != null && i.status))
|
|
4308
|
+
return new Response(JSON.stringify(r.value), {
|
|
4309
|
+
status: ((o = r.value) == null ? void 0 : o.type) === "error" && (u = (c = r.value.payload) == null ? void 0 : c.status) != null ? u : 500,
|
|
4304
4310
|
headers: {
|
|
4305
4311
|
"Content-Type": "application/json"
|
|
4306
4312
|
}
|
|
@@ -4328,50 +4334,50 @@ data: ${JSON.stringify(
|
|
|
4328
4334
|
});
|
|
4329
4335
|
});
|
|
4330
4336
|
}
|
|
4331
|
-
const
|
|
4332
|
-
const t = qn(
|
|
4337
|
+
const ia = (s, e) => I(void 0, null, function* () {
|
|
4338
|
+
const t = qn(s, e);
|
|
4333
4339
|
return pt(t);
|
|
4334
|
-
}), Hn = (
|
|
4335
|
-
const t = Hn(
|
|
4340
|
+
}), Hn = (s, e) => ht(s, e, s.generateCodeFromWebsite), oa = (s, e) => I(void 0, null, function* () {
|
|
4341
|
+
const t = Hn(s, e);
|
|
4336
4342
|
return pt(t);
|
|
4337
|
-
}), Jn = (
|
|
4338
|
-
const t = Jn(
|
|
4343
|
+
}), Jn = (s, e) => ht(s, e, s.generateCodeFromPrompt), ca = (s, e) => I(void 0, null, function* () {
|
|
4344
|
+
const t = Jn(s, e);
|
|
4339
4345
|
return pt(t);
|
|
4340
|
-
}), Gn = (
|
|
4341
|
-
const t = Gn(
|
|
4346
|
+
}), Gn = (s, e) => ht(s, e, s.generateLink2Code), ua = (s, e) => I(void 0, null, function* () {
|
|
4347
|
+
const t = Gn(s, e);
|
|
4342
4348
|
return pt(t);
|
|
4343
4349
|
});
|
|
4344
4350
|
export {
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4351
|
+
ta as Anima,
|
|
4352
|
+
me as CodegenError,
|
|
4353
|
+
As as FigmaTokenIssue,
|
|
4354
|
+
Os as NotFound,
|
|
4355
|
+
Cs as RateLimitExceeded,
|
|
4356
|
+
Is as RequestTooLarge,
|
|
4357
|
+
na as ResponseError,
|
|
4358
|
+
js as UnknownFigmaApiException,
|
|
4359
|
+
ca as createCodeFromPromptResponseEventStream,
|
|
4354
4360
|
Jn as createCodeFromPromptStream,
|
|
4355
|
-
|
|
4361
|
+
oa as createCodeFromWebsiteResponseEventStream,
|
|
4356
4362
|
Hn as createCodeFromWebsiteStream,
|
|
4357
|
-
|
|
4363
|
+
ia as createCodegenResponseEventStream,
|
|
4358
4364
|
qn as createCodegenStream,
|
|
4359
|
-
|
|
4365
|
+
ua as createLink2CodeResponseEventStream,
|
|
4360
4366
|
Gn as createLink2CodeStream,
|
|
4361
|
-
|
|
4367
|
+
ds as findChildrenNode,
|
|
4362
4368
|
ra as formatToFigmaLink,
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4369
|
+
Qn as getFigmaApiErrorType,
|
|
4370
|
+
Or as getFigmaFile,
|
|
4371
|
+
ea as getFileNodes,
|
|
4372
|
+
aa as getRelatedScreenFiles,
|
|
4373
|
+
Zs as isFigmaTokenIssue,
|
|
4368
4374
|
Un as isNodeCodegenCompatible,
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4375
|
+
Ns as isNotFound,
|
|
4376
|
+
Rs as isRateLimitExceeded,
|
|
4377
|
+
Ms as isRequestTooLarge,
|
|
4378
|
+
Yn as isUnknownFigmaApiException,
|
|
4379
|
+
sa as isValidFigmaUrl,
|
|
4374
4380
|
Vn as validateSettings,
|
|
4375
|
-
|
|
4381
|
+
ns as wrapFigmaApiError
|
|
4376
4382
|
};
|
|
4377
4383
|
//# sourceMappingURL=index.js.map
|