@animaapp/anima-sdk 0.3.12 → 0.4.3
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 +6 -2
- package/dist/index.js +991 -985
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var xr = Object.defineProperty, kr = Object.defineProperties;
|
|
2
|
+
var Tr = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Pt = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var Ft = (
|
|
6
|
-
throw TypeError(
|
|
4
|
+
var Sr = Object.prototype.hasOwnProperty, Er = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Ft = (r) => {
|
|
6
|
+
throw TypeError(r);
|
|
7
7
|
};
|
|
8
|
-
var $t = (
|
|
8
|
+
var $t = (r, e, t) => e in r ? xr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, d = (r, e) => {
|
|
9
9
|
for (var t in e || (e = {}))
|
|
10
|
-
|
|
10
|
+
Sr.call(e, t) && $t(r, t, e[t]);
|
|
11
11
|
if (Pt)
|
|
12
12
|
for (var t of Pt(e))
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
},
|
|
16
|
-
var lt = (
|
|
17
|
-
var P = (
|
|
18
|
-
var
|
|
13
|
+
Er.call(e, t) && $t(r, t, e[t]);
|
|
14
|
+
return r;
|
|
15
|
+
}, g = (r, e) => kr(r, Tr(e));
|
|
16
|
+
var lt = (r, e, t) => e.has(r) || Ft("Cannot " + t);
|
|
17
|
+
var P = (r, e, t) => (lt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), Xe = (r, e, t) => e.has(r) ? Ft("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), ft = (r, e, t, s) => (lt(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t), Ye = (r, e, t) => (lt(r, e, "access private method"), t);
|
|
18
|
+
var C = (r, e, t) => new Promise((s, n) => {
|
|
19
19
|
var a = (c) => {
|
|
20
20
|
try {
|
|
21
21
|
o(t.next(c));
|
|
@@ -28,87 +28,87 @@ var A = (s, e, t) => new Promise((r, n) => {
|
|
|
28
28
|
} catch (u) {
|
|
29
29
|
n(u);
|
|
30
30
|
}
|
|
31
|
-
}, o = (c) => c.done ?
|
|
32
|
-
o((t = t.apply(
|
|
31
|
+
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
32
|
+
o((t = t.apply(r, e)).next());
|
|
33
33
|
});
|
|
34
34
|
class oe extends Error {
|
|
35
35
|
constructor({
|
|
36
36
|
name: e,
|
|
37
37
|
reason: t,
|
|
38
|
-
status:
|
|
38
|
+
status: s,
|
|
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 = s;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
const Xt = "Figma Token Issue";
|
|
45
|
-
class
|
|
45
|
+
class Ar extends Error {
|
|
46
46
|
constructor({
|
|
47
47
|
fileKey: e,
|
|
48
48
|
reason: t,
|
|
49
|
-
cause:
|
|
49
|
+
cause: s
|
|
50
50
|
}) {
|
|
51
|
-
super(Xt), this.fileKey = e, this.reason = t, this.cause =
|
|
51
|
+
super(Xt), this.fileKey = e, this.reason = t, this.cause = s;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
const Yt = "Rate Limit Exceeded";
|
|
55
|
-
class
|
|
55
|
+
class Cr extends Error {
|
|
56
56
|
constructor({ fileKey: e, cause: t }) {
|
|
57
57
|
super(Yt), this.fileKey = e, this.cause = t;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
const Qt = "Request Too Large";
|
|
61
|
-
class
|
|
61
|
+
class Or extends Error {
|
|
62
62
|
constructor({ fileKey: e, cause: t }) {
|
|
63
63
|
super(Qt), this.fileKey = e, this.cause = t;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
class
|
|
66
|
+
const er = "Not Found";
|
|
67
|
+
class Ir extends Error {
|
|
68
68
|
constructor({ fileKey: e, cause: t }) {
|
|
69
|
-
super(
|
|
69
|
+
super(er), this.fileKey = e, this.cause = t;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
const
|
|
73
|
-
class
|
|
72
|
+
const Nr = (r) => r.message === er, tr = "Unknown Figma API Exception";
|
|
73
|
+
class jr extends Error {
|
|
74
74
|
constructor({ fileKey: e, cause: t }) {
|
|
75
|
-
super(
|
|
75
|
+
super(tr), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = t;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
const Gn = (
|
|
78
|
+
const Gn = (r) => r.message === tr, Rr = (r) => r.message === Yt, Zr = (r) => [Xt, ...[
|
|
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
|
+
r.message
|
|
83
|
+
), Mr = (r) => r.message === Qt, rr = (r, e) => {
|
|
84
|
+
var s;
|
|
85
|
+
if (((s = r == null ? void 0 : r.cause) == null ? void 0 : s.message) === "Fetch Error") {
|
|
86
|
+
const { err: n, status: a } = r.cause.body;
|
|
87
87
|
if (a === 403)
|
|
88
|
-
return new
|
|
88
|
+
return new Ar({
|
|
89
89
|
fileKey: e,
|
|
90
90
|
reason: n,
|
|
91
|
-
cause:
|
|
91
|
+
cause: r
|
|
92
92
|
});
|
|
93
93
|
if (a === 429)
|
|
94
|
-
return new
|
|
94
|
+
return new Cr({ fileKey: e, cause: r });
|
|
95
95
|
if (a === 404)
|
|
96
|
-
return new
|
|
96
|
+
return new Ir({ fileKey: e, cause: r });
|
|
97
97
|
if (a === 400 && n.includes("Request too large"))
|
|
98
|
-
return new
|
|
98
|
+
return new Or({ fileKey: e, cause: r });
|
|
99
99
|
}
|
|
100
|
-
return new
|
|
101
|
-
}, Kn = (
|
|
102
|
-
var
|
|
103
|
-
throw TypeError(
|
|
104
|
-
}, Vt = (
|
|
100
|
+
return new jr({ fileKey: e, cause: r });
|
|
101
|
+
}, Kn = (r) => Nr(r) ? "NotFound" : Rr(r) ? "RateLimitExceeded" : Zr(r) ? "FigmaTokenIssue" : Mr(r) ? "RequestTooLarge" : "UnknownFigmaApiException";
|
|
102
|
+
var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwnPropertyDescriptors, Lt = Object.getOwnPropertySymbols, Lr = Object.prototype.hasOwnProperty, Dr = Object.prototype.propertyIsEnumerable, Dt = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), sr = (r) => {
|
|
103
|
+
throw TypeError(r);
|
|
104
|
+
}, Vt = (r, e, t) => e in r ? Pr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, U = (r, e) => {
|
|
105
105
|
for (var t in e || (e = {}))
|
|
106
|
-
|
|
106
|
+
Lr.call(e, t) && Vt(r, t, e[t]);
|
|
107
107
|
if (Lt)
|
|
108
108
|
for (var t of Lt(e))
|
|
109
|
-
|
|
110
|
-
return
|
|
111
|
-
}, Nt = (
|
|
109
|
+
Dr.call(e, t) && Vt(r, t, e[t]);
|
|
110
|
+
return r;
|
|
111
|
+
}, Nt = (r, e) => $r(r, Fr(e)), jt = (r, e, t) => e.has(r) || sr("Cannot " + t), T = (r, e, t) => (jt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), B = (r, e, t) => e.has(r) ? sr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), N = (r, e, t, s) => (jt(r, e, "write to private field"), e.set(r, t), t), X = (r, e, t) => (jt(r, e, "access private method"), t), A = (r, e, t) => new Promise((s, n) => {
|
|
112
112
|
var a = (c) => {
|
|
113
113
|
try {
|
|
114
114
|
o(t.next(c));
|
|
@@ -121,26 +121,26 @@ var Ps = Object.defineProperty, $s = Object.defineProperties, Fs = Object.getOwn
|
|
|
121
121
|
} catch (u) {
|
|
122
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 ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
125
|
+
o((t = t.apply(r, e)).next());
|
|
126
|
+
}), Vr = (r, e, t) => (e = r[Dt("asyncIterator")]) ? e.call(r) : (r = r[Dt("iterator")](), e = {}, t = (s, n) => (n = r[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = n.call(r, a), c = a.done, Promise.resolve(a.value).then((u) => i({ value: u, done: c }), o)))), t("next"), t("return"), e), Ur = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
127
|
+
function zr(r) {
|
|
128
|
+
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
131
|
-
function
|
|
132
|
-
return Ut || (Ut = 1, function(
|
|
133
|
-
(function(t,
|
|
134
|
-
|
|
135
|
-
})(
|
|
136
|
-
var t = typeof Promise == "function",
|
|
130
|
+
var yt = { exports: {} }, Wr = yt.exports, Ut;
|
|
131
|
+
function Br() {
|
|
132
|
+
return Ut || (Ut = 1, function(r, e) {
|
|
133
|
+
(function(t, s) {
|
|
134
|
+
r.exports = s();
|
|
135
|
+
})(Wr, function() {
|
|
136
|
+
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ur, 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", O = i && typeof Set.prototype.entries == "function", R = a && typeof Map.prototype.entries == "function", L = O && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), W = R && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), te = f && typeof Array.prototype[Symbol.iterator] == "function", he = te && Object.getPrototypeOf([][Symbol.iterator]()), ie = f && typeof String.prototype[Symbol.iterator] == "function", Z = ie && Object.getPrototypeOf(""[Symbol.iterator]()), M = 8, Oe = -1;
|
|
137
137
|
function we(b) {
|
|
138
138
|
var ut = typeof b;
|
|
139
139
|
if (ut !== "object")
|
|
140
140
|
return ut;
|
|
141
141
|
if (b === null)
|
|
142
142
|
return "null";
|
|
143
|
-
if (b ===
|
|
143
|
+
if (b === s)
|
|
144
144
|
return "global";
|
|
145
145
|
if (Array.isArray(b) && (v === !1 || !(Symbol.toStringTag in b)))
|
|
146
146
|
return "Array";
|
|
@@ -172,18 +172,18 @@ function Bs() {
|
|
|
172
172
|
}
|
|
173
173
|
return we;
|
|
174
174
|
});
|
|
175
|
-
}(
|
|
175
|
+
}(yt)), yt.exports;
|
|
176
176
|
}
|
|
177
|
-
var
|
|
178
|
-
const
|
|
177
|
+
var qr = Br();
|
|
178
|
+
const Hr = /* @__PURE__ */ zr(qr), Rt = typeof Buffer != "undefined", Jr = Rt && typeof Buffer.from != "undefined", Gr = Rt ? (
|
|
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(r) {
|
|
186
|
+
return Buffer.isBuffer(r);
|
|
187
187
|
}
|
|
188
188
|
) : (
|
|
189
189
|
/**
|
|
@@ -196,15 +196,15 @@ const Hs = /* @__PURE__ */ zs(qs), Rt = typeof Buffer != "undefined", Js = Rt &&
|
|
|
196
196
|
function() {
|
|
197
197
|
return !1;
|
|
198
198
|
}
|
|
199
|
-
),
|
|
199
|
+
), Kr = Jr ? (
|
|
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(r) {
|
|
207
|
+
return Buffer.from(r);
|
|
208
208
|
}
|
|
209
209
|
) : Rt ? (
|
|
210
210
|
/**
|
|
@@ -215,8 +215,8 @@ const Hs = /* @__PURE__ */ zs(qs), Rt = typeof Buffer != "undefined", Js = Rt &&
|
|
|
215
215
|
* @param {Buffer} value
|
|
216
216
|
* @return {Buffer}
|
|
217
217
|
*/
|
|
218
|
-
function(
|
|
219
|
-
return new Buffer(
|
|
218
|
+
function(r) {
|
|
219
|
+
return new Buffer(r);
|
|
220
220
|
}
|
|
221
221
|
) : (
|
|
222
222
|
/**
|
|
@@ -227,115 +227,115 @@ const Hs = /* @__PURE__ */ zs(qs), Rt = typeof Buffer != "undefined", Js = Rt &&
|
|
|
227
227
|
* @param {*}
|
|
228
228
|
* @return {*}
|
|
229
229
|
*/
|
|
230
|
-
function(
|
|
231
|
-
return
|
|
230
|
+
function(r) {
|
|
231
|
+
return r;
|
|
232
232
|
}
|
|
233
233
|
);
|
|
234
|
-
function Se(
|
|
235
|
-
return
|
|
234
|
+
function Se(r) {
|
|
235
|
+
return Gr(r) ? "Buffer" : Hr(r);
|
|
236
236
|
}
|
|
237
|
-
const
|
|
237
|
+
const Xr = /* @__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 || Se(
|
|
244
|
+
function Yr(r, e, t = null) {
|
|
245
|
+
switch (t || Se(r)) {
|
|
246
246
|
case "Arguments":
|
|
247
247
|
case "Array":
|
|
248
248
|
case "Object":
|
|
249
|
-
return
|
|
249
|
+
return r[e];
|
|
250
250
|
case "Map":
|
|
251
|
-
return
|
|
251
|
+
return r.get(e);
|
|
252
252
|
case "Set":
|
|
253
253
|
return e;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
function vt(
|
|
257
|
-
return
|
|
256
|
+
function vt(r) {
|
|
257
|
+
return Xr.has(r);
|
|
258
258
|
}
|
|
259
|
-
function zt(
|
|
260
|
-
switch (
|
|
259
|
+
function zt(r, e, t, s = null) {
|
|
260
|
+
switch (s || Se(r)) {
|
|
261
261
|
case "Arguments":
|
|
262
262
|
case "Array":
|
|
263
263
|
case "Object":
|
|
264
|
-
|
|
264
|
+
r[e] = t;
|
|
265
265
|
break;
|
|
266
266
|
case "Map":
|
|
267
|
-
|
|
267
|
+
r.set(e, t);
|
|
268
268
|
break;
|
|
269
269
|
case "Set":
|
|
270
|
-
|
|
270
|
+
r.add(t);
|
|
271
271
|
break;
|
|
272
272
|
}
|
|
273
|
-
return
|
|
273
|
+
return r;
|
|
274
274
|
}
|
|
275
|
-
const
|
|
276
|
-
function
|
|
277
|
-
return
|
|
275
|
+
const Qr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, es = typeof global != "undefined" && global !== null && global.Object === Object && global, ts = typeof self != "undefined" && self !== null && self.Object === Object && self, ht = Qr || es || ts || Function("return this")();
|
|
276
|
+
function rs(r) {
|
|
277
|
+
return r.slice(0);
|
|
278
278
|
}
|
|
279
|
-
function
|
|
280
|
-
return new Boolean(
|
|
279
|
+
function ss(r) {
|
|
280
|
+
return new Boolean(r.valueOf());
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
return new DataView(
|
|
282
|
+
function ns(r) {
|
|
283
|
+
return new DataView(r.buffer);
|
|
284
284
|
}
|
|
285
|
-
function
|
|
286
|
-
return
|
|
285
|
+
function as(r) {
|
|
286
|
+
return Kr(r);
|
|
287
287
|
}
|
|
288
|
-
function
|
|
289
|
-
return new Date(
|
|
288
|
+
function is(r) {
|
|
289
|
+
return new Date(r.getTime());
|
|
290
290
|
}
|
|
291
|
-
function
|
|
292
|
-
return new Number(
|
|
291
|
+
function os(r) {
|
|
292
|
+
return new Number(r);
|
|
293
293
|
}
|
|
294
|
-
function
|
|
295
|
-
return new RegExp(
|
|
294
|
+
function cs(r) {
|
|
295
|
+
return new RegExp(r.source, r.flags);
|
|
296
296
|
}
|
|
297
|
-
function
|
|
298
|
-
return new String(
|
|
297
|
+
function ds(r) {
|
|
298
|
+
return new String(r);
|
|
299
299
|
}
|
|
300
|
-
function
|
|
301
|
-
return ht[e].from ? ht[e].from(
|
|
300
|
+
function re(r, e) {
|
|
301
|
+
return ht[e].from ? ht[e].from(r) : new ht[e](r);
|
|
302
302
|
}
|
|
303
|
-
function $(
|
|
304
|
-
return
|
|
303
|
+
function $(r) {
|
|
304
|
+
return r;
|
|
305
305
|
}
|
|
306
306
|
function Wt() {
|
|
307
307
|
return [];
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function us() {
|
|
310
310
|
return /* @__PURE__ */ new Map();
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function ls() {
|
|
313
313
|
return {};
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function fs() {
|
|
316
316
|
return /* @__PURE__ */ new Set();
|
|
317
317
|
}
|
|
318
|
-
const
|
|
318
|
+
const hs = /* @__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", rs],
|
|
321
|
+
["Boolean", ss],
|
|
322
|
+
["Buffer", as],
|
|
323
|
+
["DataView", ns],
|
|
324
|
+
["Date", is],
|
|
325
|
+
["Number", os],
|
|
326
|
+
["RegExp", cs],
|
|
327
|
+
["String", ds],
|
|
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", re],
|
|
331
|
+
["Float64Array", re],
|
|
332
|
+
["Int16Array", re],
|
|
333
|
+
["Int32Array", re],
|
|
334
|
+
["Int8Array", re],
|
|
335
|
+
["Uint16Array", re],
|
|
336
|
+
["Uint32Array", re],
|
|
337
|
+
["Uint8Array", re],
|
|
338
|
+
["Uint8ClampedArray", re],
|
|
339
339
|
// shallow copy
|
|
340
340
|
["Array Iterator", $],
|
|
341
341
|
["Map Iterator", $],
|
|
@@ -358,9 +358,9 @@ const hr = /* @__PURE__ */ new Map([
|
|
|
358
358
|
// NOTE: return empty value, because recursively copy later.
|
|
359
359
|
["Arguments", Wt],
|
|
360
360
|
["Array", Wt],
|
|
361
|
-
["Map",
|
|
362
|
-
["Object",
|
|
363
|
-
["Set",
|
|
361
|
+
["Map", us],
|
|
362
|
+
["Object", ls],
|
|
363
|
+
["Set", fs]
|
|
364
364
|
// NOTE: type-detect returns following types
|
|
365
365
|
// 'Location'
|
|
366
366
|
// 'Document'
|
|
@@ -372,19 +372,19 @@ const hr = /* @__PURE__ */ new Map([
|
|
|
372
372
|
// TODO: is type-detect never return 'object'?
|
|
373
373
|
// 'object'
|
|
374
374
|
]);
|
|
375
|
-
function
|
|
375
|
+
function ps() {
|
|
376
376
|
}
|
|
377
|
-
function _t(
|
|
377
|
+
function _t(r, e = null, t = ps) {
|
|
378
378
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
379
|
-
const
|
|
380
|
-
if (
|
|
381
|
-
const a = t(
|
|
379
|
+
const s = e || Se(r), n = hs.get(s);
|
|
380
|
+
if (s === "Object") {
|
|
381
|
+
const a = t(r, s);
|
|
382
382
|
if (a !== void 0)
|
|
383
383
|
return a;
|
|
384
384
|
}
|
|
385
|
-
return n ? n(
|
|
385
|
+
return n ? n(r, s) : r;
|
|
386
386
|
}
|
|
387
|
-
function Ie(
|
|
387
|
+
function Ie(r, e = {}) {
|
|
388
388
|
typeof e == "function" && (e = {
|
|
389
389
|
customizer: e
|
|
390
390
|
});
|
|
@@ -393,44 +393,44 @@ function Ie(s, e = {}) {
|
|
|
393
393
|
customizer: t
|
|
394
394
|
// TODO: max depth
|
|
395
395
|
// depth = Infinity,
|
|
396
|
-
} = e,
|
|
397
|
-
if (!vt(
|
|
398
|
-
return bt(
|
|
399
|
-
const n = _t(
|
|
400
|
-
return bt(
|
|
396
|
+
} = e, s = Se(r);
|
|
397
|
+
if (!vt(s))
|
|
398
|
+
return bt(r, null, null, null);
|
|
399
|
+
const n = _t(r, s, t), a = new WeakMap([[r, n]]), i = new WeakSet([r]);
|
|
400
|
+
return bt(r, n, a, i);
|
|
401
401
|
}
|
|
402
|
-
function bt(
|
|
403
|
-
const a = Se(
|
|
402
|
+
function bt(r, e, t, s, n) {
|
|
403
|
+
const a = Se(r), i = _t(r, a);
|
|
404
404
|
if (!vt(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(r);
|
|
411
411
|
break;
|
|
412
412
|
case "Object":
|
|
413
|
-
o = Object.keys(
|
|
413
|
+
o = Object.keys(r), o.push(...Object.getOwnPropertySymbols(r));
|
|
414
414
|
break;
|
|
415
415
|
case "Map":
|
|
416
416
|
case "Set":
|
|
417
|
-
o =
|
|
417
|
+
o = r.keys();
|
|
418
418
|
break;
|
|
419
419
|
}
|
|
420
420
|
for (let c of o) {
|
|
421
|
-
const u =
|
|
422
|
-
if (
|
|
421
|
+
const u = Yr(r, c, a);
|
|
422
|
+
if (s.has(u))
|
|
423
423
|
zt(e, c, t.get(u), a);
|
|
424
424
|
else {
|
|
425
425
|
const f = Se(u), v = _t(u, f);
|
|
426
|
-
vt(f) && (t.set(u, v),
|
|
426
|
+
vt(f) && (t.set(u, v), s.add(u)), zt(
|
|
427
427
|
e,
|
|
428
428
|
c,
|
|
429
429
|
bt(
|
|
430
430
|
u,
|
|
431
431
|
v,
|
|
432
432
|
t,
|
|
433
|
-
|
|
433
|
+
s
|
|
434
434
|
),
|
|
435
435
|
a
|
|
436
436
|
);
|
|
@@ -438,36 +438,36 @@ function bt(s, e, t, r, n) {
|
|
|
438
438
|
}
|
|
439
439
|
return e;
|
|
440
440
|
}
|
|
441
|
-
const
|
|
442
|
-
var Qe, pe, et, wt,
|
|
443
|
-
class
|
|
441
|
+
const ms = (r) => new Promise((e) => setTimeout(e, r));
|
|
442
|
+
var Qe, pe, et, wt, nr;
|
|
443
|
+
class gs {
|
|
444
444
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
445
445
|
B(this, wt), B(this, Qe), B(this, pe), B(this, et), N(this, Qe, e), N(this, et, t), N(this, pe, 0);
|
|
446
446
|
}
|
|
447
447
|
run() {
|
|
448
|
-
return
|
|
448
|
+
return A(this, null, function* () {
|
|
449
449
|
try {
|
|
450
450
|
return yield T(this, et).call(this);
|
|
451
451
|
} catch (e) {
|
|
452
452
|
if (N(this, pe, T(this, pe) + 1), T(this, pe) > T(this, Qe))
|
|
453
453
|
throw console.error("Max attempts reached"), e;
|
|
454
|
-
const t = X(this, wt,
|
|
455
|
-
return yield
|
|
454
|
+
const t = X(this, wt, nr).call(this);
|
|
455
|
+
return yield ms(t), yield this.run();
|
|
456
456
|
}
|
|
457
457
|
});
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
Qe = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakSet(),
|
|
460
|
+
Qe = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakSet(), nr = function() {
|
|
461
461
|
return T(this, pe) * 1e3 * 1.5;
|
|
462
462
|
};
|
|
463
|
-
function
|
|
463
|
+
function ys() {
|
|
464
464
|
return typeof CompressionStream != "undefined";
|
|
465
465
|
}
|
|
466
|
-
function
|
|
467
|
-
return
|
|
468
|
-
const e = new Blob([
|
|
466
|
+
function vs(r) {
|
|
467
|
+
return A(this, null, function* () {
|
|
468
|
+
const e = new Blob([r]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
469
469
|
try {
|
|
470
|
-
for (var
|
|
470
|
+
for (var s = Vr(e), n, a, i; n = !(a = yield s.next()).done; n = !1) {
|
|
471
471
|
const o = a.value;
|
|
472
472
|
t.push(o);
|
|
473
473
|
}
|
|
@@ -475,24 +475,24 @@ function vr(s) {
|
|
|
475
475
|
i = [o];
|
|
476
476
|
} finally {
|
|
477
477
|
try {
|
|
478
|
-
n && (a =
|
|
478
|
+
n && (a = s.return) && (yield a.call(s));
|
|
479
479
|
} finally {
|
|
480
480
|
if (i)
|
|
481
481
|
throw i[0];
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
|
-
return yield
|
|
484
|
+
return yield _s(t);
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
|
-
function
|
|
488
|
-
return
|
|
489
|
-
const e = yield new Blob(
|
|
487
|
+
function _s(r) {
|
|
488
|
+
return A(this, null, function* () {
|
|
489
|
+
const e = yield new Blob(r).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 bs extends Error {
|
|
494
|
+
constructor({ resource: e, api: t, args: s, 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 = s, 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 = {};
|
|
@@ -509,12 +509,12 @@ class Bt extends Error {
|
|
|
509
509
|
constructor({
|
|
510
510
|
url: e,
|
|
511
511
|
method: t,
|
|
512
|
-
statusCode:
|
|
512
|
+
statusCode: s,
|
|
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 = s, this.requestHeaders = n, this.responseHeaders = a, i)
|
|
518
518
|
try {
|
|
519
519
|
const o = JSON.parse(i);
|
|
520
520
|
this.body = o;
|
|
@@ -529,7 +529,7 @@ class Ne extends Error {
|
|
|
529
529
|
super("Abort Error"), this.name = "Abort Error", this.canceled = t;
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
|
-
class
|
|
532
|
+
class ws 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 pt extends Error {
|
|
|
539
539
|
super(e), this.name = "Request Validation Error";
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function ar() {
|
|
543
543
|
return Array.from(
|
|
544
544
|
{ length: 32 },
|
|
545
545
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
@@ -548,9 +548,9 @@ function as() {
|
|
|
548
548
|
function xt() {
|
|
549
549
|
return Math.floor(Date.now() / 1e3).toString();
|
|
550
550
|
}
|
|
551
|
-
const
|
|
551
|
+
const xs = 5 * 60 * 1e3, ks = 1 * 1e3;
|
|
552
552
|
var me, D, G, kt, Tt, je;
|
|
553
|
-
class
|
|
553
|
+
class Ts {
|
|
554
554
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
555
555
|
B(this, G), B(this, me), B(this, D), this.baseAddress = t, N(this, me, e), N(this, D, {}), this.plugins = [];
|
|
556
556
|
}
|
|
@@ -567,56 +567,56 @@ class Tr {
|
|
|
567
567
|
return N(this, D, e), this;
|
|
568
568
|
}
|
|
569
569
|
get(e) {
|
|
570
|
-
return
|
|
571
|
-
const { overrideBaseAddress: n, overrideDefaultHeaders: a } =
|
|
570
|
+
return A(this, arguments, function* (t, s = {}) {
|
|
571
|
+
const { overrideBaseAddress: n, overrideDefaultHeaders: a } = s, i = n != null ? n : this.baseAddress;
|
|
572
572
|
let o = a != null ? a : this.headers;
|
|
573
573
|
const c = Ie(T(this, D));
|
|
574
|
-
return N(this, D, {}), c.extraHeaders && (o = U(U({}, o), c.extraHeaders)), c.requestValidation && (o = Nt(U({}, o), { "X-Request-Nonce":
|
|
574
|
+
return N(this, D, {}), c.extraHeaders && (o = U(U({}, o), c.extraHeaders)), c.requestValidation && (o = Nt(U({}, o), { "X-Request-Nonce": ar(), "X-Request-Timestamp": xt() })), c.async ? yield X(this, G, Tt).call(this, `${i}${t}`, c.async, { headers: o }) : yield X(this, G, kt).call(this, `${i}${t}`, c, { headers: o });
|
|
575
575
|
});
|
|
576
576
|
}
|
|
577
577
|
post(e, t) {
|
|
578
|
-
return
|
|
578
|
+
return A(this, arguments, function* (s, n, a = {}) {
|
|
579
579
|
const i = Ie(T(this, D));
|
|
580
|
-
return N(this, D, {}), X(this, G, je).call(this,
|
|
580
|
+
return N(this, D, {}), X(this, G, je).call(this, s, "POST", n, a, i);
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
583
|
put(e, t) {
|
|
584
|
-
return
|
|
584
|
+
return A(this, arguments, function* (s, n, a = {}) {
|
|
585
585
|
const i = Ie(T(this, D));
|
|
586
|
-
return N(this, D, {}), X(this, G, je).call(this,
|
|
586
|
+
return N(this, D, {}), X(this, G, je).call(this, s, "PUT", n, a, i);
|
|
587
587
|
});
|
|
588
588
|
}
|
|
589
589
|
delete(e, t) {
|
|
590
|
-
return
|
|
590
|
+
return A(this, arguments, function* (s, n, a = {}) {
|
|
591
591
|
const i = Ie(T(this, D));
|
|
592
|
-
return N(this, D, {}), X(this, G, je).call(this,
|
|
592
|
+
return N(this, D, {}), X(this, G, je).call(this, s, "DELETE", n, a, i);
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
595
|
patch(e, t) {
|
|
596
|
-
return
|
|
596
|
+
return A(this, arguments, function* (s, n, a = {}) {
|
|
597
597
|
const i = Ie(T(this, D));
|
|
598
|
-
return N(this, D, {}), X(this, G, je).call(this,
|
|
598
|
+
return N(this, D, {}), X(this, G, je).call(this, s, "PATCH", n, a, i);
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
|
-
me = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakSet(), kt = function(
|
|
603
|
-
return
|
|
604
|
-
const
|
|
602
|
+
me = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakSet(), kt = function(r, e, t) {
|
|
603
|
+
return A(this, null, function* () {
|
|
604
|
+
const s = () => A(this, null, function* () {
|
|
605
605
|
var c, u;
|
|
606
606
|
try {
|
|
607
|
-
return yield T(this, me).call(this,
|
|
607
|
+
return yield T(this, me).call(this, r, U(U({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
608
608
|
} catch (f) {
|
|
609
609
|
throw f instanceof Error && f.name === "AbortError" ? new Ne({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : f;
|
|
610
610
|
}
|
|
611
611
|
}), { headers: n } = t != null ? t : {}, a = (c, u) => {
|
|
612
612
|
var f, v;
|
|
613
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
|
-
}, i = (c) =>
|
|
614
|
+
}, i = (c) => A(this, null, function* () {
|
|
615
615
|
var u;
|
|
616
616
|
if (!c.ok) {
|
|
617
617
|
const v = yield c.text().catch();
|
|
618
618
|
throw new Bt({
|
|
619
|
-
url:
|
|
619
|
+
url: r,
|
|
620
620
|
method: (u = t == null ? void 0 : t.method) != null ? u : "GET",
|
|
621
621
|
statusCode: c.status,
|
|
622
622
|
requestHeaders: n,
|
|
@@ -644,34 +644,34 @@ me = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), G = /* @_
|
|
|
644
644
|
return f;
|
|
645
645
|
});
|
|
646
646
|
if (e.retry) {
|
|
647
|
-
const c = yield new
|
|
647
|
+
const c = yield new gs({
|
|
648
648
|
maxAttempts: e.retry,
|
|
649
|
-
func:
|
|
649
|
+
func: s
|
|
650
650
|
}).run();
|
|
651
651
|
return yield i(c);
|
|
652
652
|
}
|
|
653
|
-
const o = yield
|
|
653
|
+
const o = yield s();
|
|
654
654
|
return yield i(o);
|
|
655
655
|
});
|
|
656
|
-
}, Tt = function(
|
|
657
|
-
return
|
|
658
|
-
var
|
|
656
|
+
}, Tt = function(r, e, t) {
|
|
657
|
+
return A(this, null, function* () {
|
|
658
|
+
var s, n;
|
|
659
659
|
const {
|
|
660
660
|
onProgress: a,
|
|
661
661
|
abortSignal: i,
|
|
662
|
-
pollingInterval: o = () =>
|
|
663
|
-
maxTimeout: c =
|
|
664
|
-
} = e, u = `${
|
|
662
|
+
pollingInterval: o = () => ks,
|
|
663
|
+
maxTimeout: c = xs
|
|
664
|
+
} = e, u = `${r}/async`, f = `${r}/async/job`;
|
|
665
665
|
let v;
|
|
666
666
|
try {
|
|
667
667
|
v = yield T(this, me).call(this, u, U(U({}, t), i && { signal: i }));
|
|
668
668
|
} catch (L) {
|
|
669
|
-
throw L instanceof Error && L.name === "AbortError" ? new Ne({ canceled: (
|
|
669
|
+
throw L instanceof Error && L.name === "AbortError" ? new Ne({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : L;
|
|
670
670
|
}
|
|
671
671
|
if (!v.ok) {
|
|
672
672
|
const L = yield v.text().catch();
|
|
673
673
|
throw new Bt({
|
|
674
|
-
url:
|
|
674
|
+
url: r,
|
|
675
675
|
method: (n = t == null ? void 0 : t.method) != null ? n : "GET",
|
|
676
676
|
statusCode: v.status,
|
|
677
677
|
requestHeaders: this.headers,
|
|
@@ -682,10 +682,10 @@ me = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), G = /* @_
|
|
|
682
682
|
const O = yield v.json(), { job_id: R } = O;
|
|
683
683
|
if (!R)
|
|
684
684
|
throw new Error("Job ID not found in response");
|
|
685
|
-
return new Promise((L, W) =>
|
|
685
|
+
return new Promise((L, W) => A(this, null, function* () {
|
|
686
686
|
const te = setTimeout(() => {
|
|
687
687
|
W(new Error("Job timed out"));
|
|
688
|
-
}, c), he = (ie = 0) =>
|
|
688
|
+
}, c), he = (ie = 0) => A(this, null, function* () {
|
|
689
689
|
if (i != null && i.aborted) {
|
|
690
690
|
clearTimeout(te), T(this, me).call(this, `${f}/${R}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
691
691
|
W(new Ne({ canceled: !0 }));
|
|
@@ -701,7 +701,7 @@ me = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), G = /* @_
|
|
|
701
701
|
const M = Z.response_json;
|
|
702
702
|
L(M);
|
|
703
703
|
} else if (Z.status === "failed")
|
|
704
|
-
clearTimeout(te), W(new
|
|
704
|
+
clearTimeout(te), W(new ws(Z.response_json));
|
|
705
705
|
else {
|
|
706
706
|
a && a(Z.response_json);
|
|
707
707
|
const M = o(ie);
|
|
@@ -714,68 +714,68 @@ me = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), G = /* @_
|
|
|
714
714
|
he();
|
|
715
715
|
}));
|
|
716
716
|
});
|
|
717
|
-
}, je = function(
|
|
718
|
-
return
|
|
719
|
-
const { overrideBaseAddress: a, overrideDefaultHeaders: i } =
|
|
717
|
+
}, je = function(r, e, t, s, n) {
|
|
718
|
+
return A(this, null, function* () {
|
|
719
|
+
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
720
720
|
let c = i != null ? i : this.headers;
|
|
721
|
-
n.extraHeaders && (c = U(U({}, c), n.extraHeaders)), n.requestValidation && (c = Nt(U({}, c), { "X-Request-Nonce":
|
|
721
|
+
n.extraHeaders && (c = U(U({}, c), n.extraHeaders)), n.requestValidation && (c = Nt(U({}, c), { "X-Request-Nonce": ar(), "X-Request-Timestamp": xt() }));
|
|
722
722
|
let u = t;
|
|
723
|
-
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (u =
|
|
723
|
+
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (u = s.skipBodyJsonStringify ? t : JSON.stringify(t), n.compress && ys() && (c["Content-Encoding"] = "gzip", u = yield vs(u))), n.async ? yield X(this, G, Tt).call(this, `${o}${r}`, n.async, {
|
|
724
724
|
method: e,
|
|
725
725
|
headers: c,
|
|
726
726
|
body: u
|
|
727
|
-
}) : yield X(this, G, kt).call(this, `${o}${
|
|
727
|
+
}) : yield X(this, G, kt).call(this, `${o}${r}`, n, { method: e, headers: c, body: u });
|
|
728
728
|
});
|
|
729
729
|
};
|
|
730
|
-
const qt = (
|
|
731
|
-
get(t,
|
|
730
|
+
const qt = (r, e, t, s) => r instanceof Ne ? r : new bs({ resource: e, api: String(t), args: s, cause: r }), mt = (r, e) => new Proxy(e, {
|
|
731
|
+
get(t, s) {
|
|
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 r.plugins) {
|
|
735
|
+
const c = (a = o.beforeApi) == null ? void 0 : a.call(o, { resource: t.resourceName, api: s, 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[s](...n);
|
|
742
742
|
} catch (o) {
|
|
743
|
-
throw qt(o, t.resourceName,
|
|
743
|
+
throw qt(o, t.resourceName, s, n);
|
|
744
744
|
}
|
|
745
745
|
return i instanceof Promise ? i.catch((o) => {
|
|
746
|
-
throw qt(o, t.resourceName,
|
|
746
|
+
throw qt(o, t.resourceName, s, n);
|
|
747
747
|
}) : i;
|
|
748
748
|
};
|
|
749
749
|
}
|
|
750
750
|
});
|
|
751
751
|
var Re;
|
|
752
|
-
class
|
|
752
|
+
class Ss {
|
|
753
753
|
constructor(e) {
|
|
754
754
|
B(this, Re), this.resourceName = "Files", N(this, Re, e);
|
|
755
755
|
}
|
|
756
756
|
get(e) {
|
|
757
|
-
return
|
|
757
|
+
return A(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
758
758
|
const n = new URLSearchParams(U({
|
|
759
759
|
plugin_data: "857346721138427857"
|
|
760
|
-
},
|
|
760
|
+
}, s)).toString(), a = `v1/files/${t}?${n}`;
|
|
761
761
|
return yield T(this, Re).get(a);
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
getImageFills(e) {
|
|
765
|
-
return
|
|
766
|
-
var
|
|
765
|
+
return A(this, arguments, function* ({ fileKey: t }) {
|
|
766
|
+
var s, n;
|
|
767
767
|
const a = `v1/files/${t}/images`;
|
|
768
|
-
return (n = (
|
|
768
|
+
return (n = (s = (yield T(this, Re).get(a)).meta) == null ? void 0 : s.images) != null ? n : {};
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
772
|
Re = /* @__PURE__ */ new WeakMap();
|
|
773
|
-
const
|
|
774
|
-
const
|
|
775
|
-
return `${
|
|
776
|
-
},
|
|
777
|
-
var K, St,
|
|
778
|
-
class
|
|
773
|
+
const Es = (r, e, t) => {
|
|
774
|
+
const s = e.sort();
|
|
775
|
+
return `${r}-${s.join("-")}-${t}`;
|
|
776
|
+
}, As = (r) => r ? r.ts > Date.now() - 1e3 * 30 : !1;
|
|
777
|
+
var K, St, ir;
|
|
778
|
+
class Cs {
|
|
779
779
|
constructor(e) {
|
|
780
780
|
B(this, St), B(this, K), this.resourceName = "Images", N(this, K, e);
|
|
781
781
|
}
|
|
@@ -784,15 +784,15 @@ class Cr {
|
|
|
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
|
|
788
|
-
const i =
|
|
789
|
-
if (
|
|
787
|
+
return A(this, arguments, function* ({ fileKey: t, nodeIds: s, format: n = "jpg", scale: a }) {
|
|
788
|
+
const i = Es(t, s, n), o = T(this, K).cache.images.entries.get(i);
|
|
789
|
+
if (As(o))
|
|
790
790
|
return o.result;
|
|
791
791
|
o && T(this, K).cache.images.entries.delete(i);
|
|
792
792
|
const c = T(this, K).cache.images.pendingRequests.get(i);
|
|
793
793
|
if (c)
|
|
794
794
|
return c;
|
|
795
|
-
const u = X(this, St,
|
|
795
|
+
const u = X(this, St, ir).call(this, i, t, s, n, a);
|
|
796
796
|
T(this, K).cache.images.pendingRequests.set(i, u);
|
|
797
797
|
try {
|
|
798
798
|
return yield u;
|
|
@@ -802,26 +802,26 @@ class Cr {
|
|
|
802
802
|
});
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
|
-
K = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(),
|
|
806
|
-
return
|
|
805
|
+
K = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), ir = function(r, e, t, s, n) {
|
|
806
|
+
return A(this, null, function* () {
|
|
807
807
|
const a = yield T(this, K).get(
|
|
808
|
-
`v1/images/${e}?ids=${t}&format=${
|
|
808
|
+
`v1/images/${e}?ids=${t}&format=${s}${n ? `&scale=${n}` : ""}`
|
|
809
809
|
);
|
|
810
|
-
return T(this, K).cache.images.entries.set(
|
|
810
|
+
return T(this, K).cache.images.entries.set(r, {
|
|
811
811
|
result: a,
|
|
812
812
|
ts: Date.now()
|
|
813
813
|
}), a;
|
|
814
814
|
});
|
|
815
815
|
};
|
|
816
816
|
var tt;
|
|
817
|
-
class
|
|
817
|
+
class Os {
|
|
818
818
|
constructor(e) {
|
|
819
819
|
B(this, tt), this.resourceName = "Nodes", N(this, tt, e);
|
|
820
820
|
}
|
|
821
821
|
get(e) {
|
|
822
|
-
return
|
|
822
|
+
return A(this, arguments, function* ({ fileKey: t, nodeIds: s, params: n = {} }) {
|
|
823
823
|
const a = Nt(U({}, n), {
|
|
824
|
-
ids:
|
|
824
|
+
ids: s.join(",")
|
|
825
825
|
}), i = new URLSearchParams(U({
|
|
826
826
|
plugin_data: "857346721138427857"
|
|
827
827
|
}, a)).toString(), o = `v1/files/${t}/nodes?${i}`;
|
|
@@ -831,7 +831,7 @@ class Or {
|
|
|
831
831
|
}
|
|
832
832
|
tt = /* @__PURE__ */ new WeakMap();
|
|
833
833
|
var ce;
|
|
834
|
-
class
|
|
834
|
+
class or extends Ts {
|
|
835
835
|
constructor({
|
|
836
836
|
baseAddress: e = "https://api.figma.com/",
|
|
837
837
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
@@ -841,7 +841,7 @@ class os extends Tr {
|
|
|
841
841
|
entries: /* @__PURE__ */ new Map(),
|
|
842
842
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
843
843
|
}
|
|
844
|
-
}, this.files = mt(this, new
|
|
844
|
+
}, this.files = mt(this, new Ss(this)), this.nodes = mt(this, new Os(this)), this.images = mt(this, new Cs(this));
|
|
845
845
|
}
|
|
846
846
|
set token(e) {
|
|
847
847
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
@@ -859,88 +859,88 @@ class os extends Tr {
|
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
861
|
ce = /* @__PURE__ */ new WeakMap();
|
|
862
|
-
const
|
|
863
|
-
fileKey:
|
|
862
|
+
const Is = (n) => C(void 0, [n], function* ({
|
|
863
|
+
fileKey: r,
|
|
864
864
|
authToken: e,
|
|
865
|
-
figmaRestApi: t = new
|
|
866
|
-
params:
|
|
865
|
+
figmaRestApi: t = new or(),
|
|
866
|
+
params: s = {}
|
|
867
867
|
}) {
|
|
868
868
|
e && (t.token = e);
|
|
869
869
|
try {
|
|
870
870
|
return yield t.files.get({
|
|
871
|
-
fileKey:
|
|
872
|
-
params:
|
|
871
|
+
fileKey: r,
|
|
872
|
+
params: s
|
|
873
873
|
});
|
|
874
874
|
} catch (a) {
|
|
875
|
-
throw console.error(a),
|
|
875
|
+
throw console.error(a), rr(a, r);
|
|
876
876
|
}
|
|
877
|
-
}), Xn = (a) =>
|
|
878
|
-
fileKey:
|
|
877
|
+
}), Xn = (a) => C(void 0, [a], function* ({
|
|
878
|
+
fileKey: r,
|
|
879
879
|
authToken: e,
|
|
880
880
|
nodeIds: t,
|
|
881
|
-
figmaRestApi:
|
|
881
|
+
figmaRestApi: s = new or(),
|
|
882
882
|
params: n = {}
|
|
883
883
|
}) {
|
|
884
|
-
e && (
|
|
884
|
+
e && (s.token = e);
|
|
885
885
|
try {
|
|
886
|
-
return (yield
|
|
887
|
-
fileKey:
|
|
886
|
+
return (yield s.nodes.get({
|
|
887
|
+
fileKey: r,
|
|
888
888
|
nodeIds: t,
|
|
889
889
|
params: d({}, n)
|
|
890
890
|
})).nodes;
|
|
891
891
|
} catch (i) {
|
|
892
|
-
throw
|
|
893
|
-
}
|
|
894
|
-
}),
|
|
895
|
-
if (
|
|
896
|
-
return
|
|
897
|
-
if ("children" in
|
|
898
|
-
for (const t of
|
|
899
|
-
const
|
|
900
|
-
if (
|
|
901
|
-
return
|
|
892
|
+
throw rr(i, r);
|
|
893
|
+
}
|
|
894
|
+
}), cr = (r, e) => {
|
|
895
|
+
if (r.id === e)
|
|
896
|
+
return r;
|
|
897
|
+
if ("children" in r)
|
|
898
|
+
for (const t of r.children) {
|
|
899
|
+
const s = cr(t, e);
|
|
900
|
+
if (s)
|
|
901
|
+
return s;
|
|
902
902
|
}
|
|
903
903
|
return null;
|
|
904
904
|
};
|
|
905
905
|
var k;
|
|
906
|
-
(function(
|
|
907
|
-
|
|
906
|
+
(function(r) {
|
|
907
|
+
r.assertEqual = (n) => n;
|
|
908
908
|
function e(n) {
|
|
909
909
|
}
|
|
910
|
-
|
|
910
|
+
r.assertIs = e;
|
|
911
911
|
function t(n) {
|
|
912
912
|
throw new Error();
|
|
913
913
|
}
|
|
914
|
-
|
|
914
|
+
r.assertNever = t, r.arrayToEnum = (n) => {
|
|
915
915
|
const a = {};
|
|
916
916
|
for (const i of n)
|
|
917
917
|
a[i] = i;
|
|
918
918
|
return a;
|
|
919
|
-
},
|
|
920
|
-
const a =
|
|
919
|
+
}, r.getValidEnumValues = (n) => {
|
|
920
|
+
const a = r.objectKeys(n).filter((o) => typeof n[n[o]] != "number"), i = {};
|
|
921
921
|
for (const o of a)
|
|
922
922
|
i[o] = n[o];
|
|
923
|
-
return
|
|
924
|
-
},
|
|
923
|
+
return r.objectValues(i);
|
|
924
|
+
}, r.objectValues = (n) => r.objectKeys(n).map(function(a) {
|
|
925
925
|
return n[a];
|
|
926
|
-
}),
|
|
926
|
+
}), r.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
|
|
927
927
|
const a = [];
|
|
928
928
|
for (const i in n)
|
|
929
929
|
Object.prototype.hasOwnProperty.call(n, i) && a.push(i);
|
|
930
930
|
return a;
|
|
931
|
-
},
|
|
931
|
+
}, r.find = (n, a) => {
|
|
932
932
|
for (const i of n)
|
|
933
933
|
if (a(i))
|
|
934
934
|
return i;
|
|
935
|
-
},
|
|
936
|
-
function
|
|
935
|
+
}, r.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && isFinite(n) && Math.floor(n) === n;
|
|
936
|
+
function s(n, a = " | ") {
|
|
937
937
|
return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
938
938
|
}
|
|
939
|
-
|
|
939
|
+
r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
|
|
940
940
|
})(k || (k = {}));
|
|
941
941
|
var Et;
|
|
942
|
-
(function(
|
|
943
|
-
|
|
942
|
+
(function(r) {
|
|
943
|
+
r.mergeShapes = (e, t) => d(d({}, e), t);
|
|
944
944
|
})(Et || (Et = {}));
|
|
945
945
|
const p = k.arrayToEnum([
|
|
946
946
|
"string",
|
|
@@ -963,14 +963,14 @@ const p = k.arrayToEnum([
|
|
|
963
963
|
"never",
|
|
964
964
|
"map",
|
|
965
965
|
"set"
|
|
966
|
-
]), ne = (
|
|
967
|
-
switch (typeof
|
|
966
|
+
]), ne = (r) => {
|
|
967
|
+
switch (typeof r) {
|
|
968
968
|
case "undefined":
|
|
969
969
|
return p.undefined;
|
|
970
970
|
case "string":
|
|
971
971
|
return p.string;
|
|
972
972
|
case "number":
|
|
973
|
-
return isNaN(
|
|
973
|
+
return isNaN(r) ? p.nan : p.number;
|
|
974
974
|
case "boolean":
|
|
975
975
|
return p.boolean;
|
|
976
976
|
case "function":
|
|
@@ -980,7 +980,7 @@ const p = k.arrayToEnum([
|
|
|
980
980
|
case "symbol":
|
|
981
981
|
return p.symbol;
|
|
982
982
|
case "object":
|
|
983
|
-
return Array.isArray(
|
|
983
|
+
return Array.isArray(r) ? p.array : r === null ? p.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? p.promise : typeof Map != "undefined" && r instanceof Map ? p.map : typeof Set != "undefined" && r instanceof Set ? p.set : typeof Date != "undefined" && r instanceof Date ? p.date : p.object;
|
|
984
984
|
default:
|
|
985
985
|
return p.unknown;
|
|
986
986
|
}
|
|
@@ -1001,16 +1001,16 @@ const p = k.arrayToEnum([
|
|
|
1001
1001
|
"invalid_intersection_types",
|
|
1002
1002
|
"not_multiple_of",
|
|
1003
1003
|
"not_finite"
|
|
1004
|
-
]),
|
|
1004
|
+
]), Ns = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
1005
1005
|
class z extends Error {
|
|
1006
1006
|
get errors() {
|
|
1007
1007
|
return this.issues;
|
|
1008
1008
|
}
|
|
1009
1009
|
constructor(e) {
|
|
1010
|
-
super(), this.issues = [], this.addIssue = (
|
|
1011
|
-
this.issues = [...this.issues,
|
|
1012
|
-
}, this.addIssues = (
|
|
1013
|
-
this.issues = [...this.issues, ...
|
|
1010
|
+
super(), this.issues = [], this.addIssue = (s) => {
|
|
1011
|
+
this.issues = [...this.issues, s];
|
|
1012
|
+
}, this.addIssues = (s = []) => {
|
|
1013
|
+
this.issues = [...this.issues, ...s];
|
|
1014
1014
|
};
|
|
1015
1015
|
const t = new.target.prototype;
|
|
1016
1016
|
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
@@ -1018,7 +1018,7 @@ class z extends Error {
|
|
|
1018
1018
|
format(e) {
|
|
1019
1019
|
const t = e || function(a) {
|
|
1020
1020
|
return a.message;
|
|
1021
|
-
},
|
|
1021
|
+
}, s = { _errors: [] }, n = (a) => {
|
|
1022
1022
|
for (const i of a.issues)
|
|
1023
1023
|
if (i.code === "invalid_union")
|
|
1024
1024
|
i.unionErrors.map(n);
|
|
@@ -1027,16 +1027,16 @@ class z extends Error {
|
|
|
1027
1027
|
else if (i.code === "invalid_arguments")
|
|
1028
1028
|
n(i.argumentsError);
|
|
1029
1029
|
else if (i.path.length === 0)
|
|
1030
|
-
|
|
1030
|
+
s._errors.push(t(i));
|
|
1031
1031
|
else {
|
|
1032
|
-
let o =
|
|
1032
|
+
let o = s, c = 0;
|
|
1033
1033
|
for (; c < i.path.length; ) {
|
|
1034
1034
|
const u = i.path[c];
|
|
1035
1035
|
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++;
|
|
1036
1036
|
}
|
|
1037
1037
|
}
|
|
1038
1038
|
};
|
|
1039
|
-
return n(this),
|
|
1039
|
+
return n(this), s;
|
|
1040
1040
|
}
|
|
1041
1041
|
static assert(e) {
|
|
1042
1042
|
if (!(e instanceof z))
|
|
@@ -1052,36 +1052,36 @@ class z extends Error {
|
|
|
1052
1052
|
return this.issues.length === 0;
|
|
1053
1053
|
}
|
|
1054
1054
|
flatten(e = (t) => t.message) {
|
|
1055
|
-
const t = {},
|
|
1055
|
+
const t = {}, s = [];
|
|
1056
1056
|
for (const n of this.issues)
|
|
1057
|
-
n.path.length > 0 ? (t[n.path[0]] = t[n.path[0]] || [], t[n.path[0]].push(e(n))) :
|
|
1058
|
-
return { formErrors:
|
|
1057
|
+
n.path.length > 0 ? (t[n.path[0]] = t[n.path[0]] || [], t[n.path[0]].push(e(n))) : s.push(e(n));
|
|
1058
|
+
return { formErrors: s, fieldErrors: t };
|
|
1059
1059
|
}
|
|
1060
1060
|
get formErrors() {
|
|
1061
1061
|
return this.flatten();
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
1064
|
-
z.create = (
|
|
1065
|
-
const Ee = (
|
|
1064
|
+
z.create = (r) => new z(r);
|
|
1065
|
+
const Ee = (r, e) => {
|
|
1066
1066
|
let t;
|
|
1067
|
-
switch (
|
|
1067
|
+
switch (r.code) {
|
|
1068
1068
|
case l.invalid_type:
|
|
1069
|
-
|
|
1069
|
+
r.received === p.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
1070
1070
|
break;
|
|
1071
1071
|
case l.invalid_literal:
|
|
1072
|
-
t = `Invalid literal value, expected ${JSON.stringify(
|
|
1072
|
+
t = `Invalid literal value, expected ${JSON.stringify(r.expected, k.jsonStringifyReplacer)}`;
|
|
1073
1073
|
break;
|
|
1074
1074
|
case l.unrecognized_keys:
|
|
1075
|
-
t = `Unrecognized key(s) in object: ${k.joinValues(
|
|
1075
|
+
t = `Unrecognized key(s) in object: ${k.joinValues(r.keys, ", ")}`;
|
|
1076
1076
|
break;
|
|
1077
1077
|
case l.invalid_union:
|
|
1078
1078
|
t = "Invalid input";
|
|
1079
1079
|
break;
|
|
1080
1080
|
case l.invalid_union_discriminator:
|
|
1081
|
-
t = `Invalid discriminator value. Expected ${k.joinValues(
|
|
1081
|
+
t = `Invalid discriminator value. Expected ${k.joinValues(r.options)}`;
|
|
1082
1082
|
break;
|
|
1083
1083
|
case l.invalid_enum_value:
|
|
1084
|
-
t = `Invalid enum value. Expected ${k.joinValues(
|
|
1084
|
+
t = `Invalid enum value. Expected ${k.joinValues(r.options)}, received '${r.received}'`;
|
|
1085
1085
|
break;
|
|
1086
1086
|
case l.invalid_arguments:
|
|
1087
1087
|
t = "Invalid function arguments";
|
|
@@ -1093,13 +1093,13 @@ const Ee = (s, e) => {
|
|
|
1093
1093
|
t = "Invalid date";
|
|
1094
1094
|
break;
|
|
1095
1095
|
case l.invalid_string:
|
|
1096
|
-
typeof
|
|
1096
|
+
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : k.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
|
|
1097
1097
|
break;
|
|
1098
1098
|
case l.too_small:
|
|
1099
|
-
|
|
1099
|
+
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
|
|
1100
1100
|
break;
|
|
1101
1101
|
case l.too_big:
|
|
1102
|
-
|
|
1102
|
+
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
|
|
1103
1103
|
break;
|
|
1104
1104
|
case l.custom:
|
|
1105
1105
|
t = "Invalid input";
|
|
@@ -1108,50 +1108,50 @@ const Ee = (s, e) => {
|
|
|
1108
1108
|
t = "Intersection results could not be merged";
|
|
1109
1109
|
break;
|
|
1110
1110
|
case l.not_multiple_of:
|
|
1111
|
-
t = `Number must be a multiple of ${
|
|
1111
|
+
t = `Number must be a multiple of ${r.multipleOf}`;
|
|
1112
1112
|
break;
|
|
1113
1113
|
case l.not_finite:
|
|
1114
1114
|
t = "Number must be finite";
|
|
1115
1115
|
break;
|
|
1116
1116
|
default:
|
|
1117
|
-
t = e.defaultError, k.assertNever(
|
|
1117
|
+
t = e.defaultError, k.assertNever(r);
|
|
1118
1118
|
}
|
|
1119
1119
|
return { message: t };
|
|
1120
1120
|
};
|
|
1121
|
-
let
|
|
1122
|
-
function
|
|
1123
|
-
|
|
1121
|
+
let dr = Ee;
|
|
1122
|
+
function js(r) {
|
|
1123
|
+
dr = r;
|
|
1124
1124
|
}
|
|
1125
|
-
function
|
|
1126
|
-
return
|
|
1125
|
+
function rt() {
|
|
1126
|
+
return dr;
|
|
1127
1127
|
}
|
|
1128
|
-
const
|
|
1129
|
-
const { data: e, path: t, errorMaps:
|
|
1128
|
+
const st = (r) => {
|
|
1129
|
+
const { data: e, path: t, errorMaps: s, issueData: n } = r, a = [...t, ...n.path || []], i = g(d({}, n), {
|
|
1130
1130
|
path: a
|
|
1131
1131
|
});
|
|
1132
1132
|
if (n.message !== void 0)
|
|
1133
|
-
return
|
|
1133
|
+
return g(d({}, n), {
|
|
1134
1134
|
path: a,
|
|
1135
1135
|
message: n.message
|
|
1136
1136
|
});
|
|
1137
1137
|
let o = "";
|
|
1138
|
-
const c =
|
|
1138
|
+
const c = s.filter((u) => !!u).slice().reverse();
|
|
1139
1139
|
for (const u of c)
|
|
1140
1140
|
o = u(i, { data: e, defaultError: o }).message;
|
|
1141
|
-
return
|
|
1141
|
+
return g(d({}, n), {
|
|
1142
1142
|
path: a,
|
|
1143
1143
|
message: o
|
|
1144
1144
|
});
|
|
1145
|
-
},
|
|
1146
|
-
function h(
|
|
1147
|
-
const t =
|
|
1145
|
+
}, Rs = [];
|
|
1146
|
+
function h(r, e) {
|
|
1147
|
+
const t = rt(), s = st({
|
|
1148
1148
|
issueData: e,
|
|
1149
|
-
data:
|
|
1150
|
-
path:
|
|
1149
|
+
data: r.data,
|
|
1150
|
+
path: r.path,
|
|
1151
1151
|
errorMaps: [
|
|
1152
|
-
|
|
1152
|
+
r.common.contextualErrorMap,
|
|
1153
1153
|
// contextual error map is first priority
|
|
1154
|
-
|
|
1154
|
+
r.schemaErrorMap,
|
|
1155
1155
|
// then schema-bound map if available
|
|
1156
1156
|
t,
|
|
1157
1157
|
// then global override map
|
|
@@ -1159,7 +1159,7 @@ function h(s, e) {
|
|
|
1159
1159
|
// then global default map
|
|
1160
1160
|
].filter((n) => !!n)
|
|
1161
1161
|
});
|
|
1162
|
-
|
|
1162
|
+
r.common.issues.push(s);
|
|
1163
1163
|
}
|
|
1164
1164
|
class j {
|
|
1165
1165
|
constructor() {
|
|
@@ -1172,87 +1172,87 @@ class j {
|
|
|
1172
1172
|
this.value !== "aborted" && (this.value = "aborted");
|
|
1173
1173
|
}
|
|
1174
1174
|
static mergeArray(e, t) {
|
|
1175
|
-
const
|
|
1175
|
+
const s = [];
|
|
1176
1176
|
for (const n of t) {
|
|
1177
1177
|
if (n.status === "aborted")
|
|
1178
1178
|
return _;
|
|
1179
|
-
n.status === "dirty" && e.dirty(),
|
|
1179
|
+
n.status === "dirty" && e.dirty(), s.push(n.value);
|
|
1180
1180
|
}
|
|
1181
|
-
return { status: e.value, value:
|
|
1181
|
+
return { status: e.value, value: s };
|
|
1182
1182
|
}
|
|
1183
1183
|
static mergeObjectAsync(e, t) {
|
|
1184
|
-
return
|
|
1185
|
-
const
|
|
1184
|
+
return C(this, null, function* () {
|
|
1185
|
+
const s = [];
|
|
1186
1186
|
for (const n of t) {
|
|
1187
1187
|
const a = yield n.key, i = yield n.value;
|
|
1188
|
-
|
|
1188
|
+
s.push({
|
|
1189
1189
|
key: a,
|
|
1190
1190
|
value: i
|
|
1191
1191
|
});
|
|
1192
1192
|
}
|
|
1193
|
-
return j.mergeObjectSync(e,
|
|
1193
|
+
return j.mergeObjectSync(e, s);
|
|
1194
1194
|
});
|
|
1195
1195
|
}
|
|
1196
1196
|
static mergeObjectSync(e, t) {
|
|
1197
|
-
const
|
|
1197
|
+
const s = {};
|
|
1198
1198
|
for (const n of t) {
|
|
1199
1199
|
const { key: a, value: i } = n;
|
|
1200
1200
|
if (a.status === "aborted" || i.status === "aborted")
|
|
1201
1201
|
return _;
|
|
1202
|
-
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value != "undefined" || n.alwaysSet) && (
|
|
1202
|
+
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value != "undefined" || n.alwaysSet) && (s[a.value] = i.value);
|
|
1203
1203
|
}
|
|
1204
|
-
return { status: e.value, value:
|
|
1204
|
+
return { status: e.value, value: s };
|
|
1205
1205
|
}
|
|
1206
1206
|
}
|
|
1207
1207
|
const _ = Object.freeze({
|
|
1208
1208
|
status: "aborted"
|
|
1209
|
-
}), ke = (
|
|
1210
|
-
function nt(
|
|
1211
|
-
if (typeof e == "function" ?
|
|
1212
|
-
return e.get(
|
|
1209
|
+
}), ke = (r) => ({ status: "dirty", value: r }), F = (r) => ({ status: "valid", value: r }), At = (r) => r.status === "aborted", Ct = (r) => r.status === "dirty", ye = (r) => r.status === "valid", Pe = (r) => typeof Promise != "undefined" && r instanceof Promise;
|
|
1210
|
+
function nt(r, e, t, s) {
|
|
1211
|
+
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1212
|
+
return e.get(r);
|
|
1213
1213
|
}
|
|
1214
|
-
function
|
|
1215
|
-
if (typeof e == "function" ?
|
|
1216
|
-
return e.set(
|
|
1214
|
+
function ur(r, e, t, s, n) {
|
|
1215
|
+
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1216
|
+
return e.set(r, t), t;
|
|
1217
1217
|
}
|
|
1218
1218
|
var m;
|
|
1219
|
-
(function(
|
|
1220
|
-
|
|
1219
|
+
(function(r) {
|
|
1220
|
+
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
1221
1221
|
})(m || (m = {}));
|
|
1222
1222
|
var Ze, Me;
|
|
1223
1223
|
class Q {
|
|
1224
|
-
constructor(e, t,
|
|
1225
|
-
this._cachedPath = [], this.parent = e, this.data = t, this._path =
|
|
1224
|
+
constructor(e, t, s, n) {
|
|
1225
|
+
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
|
|
1226
1226
|
}
|
|
1227
1227
|
get path() {
|
|
1228
1228
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
1229
1229
|
}
|
|
1230
1230
|
}
|
|
1231
|
-
const Ht = (
|
|
1232
|
-
if (
|
|
1231
|
+
const Ht = (r, e) => {
|
|
1232
|
+
if (ye(e))
|
|
1233
1233
|
return { success: !0, data: e.value };
|
|
1234
|
-
if (!
|
|
1234
|
+
if (!r.common.issues.length)
|
|
1235
1235
|
throw new Error("Validation failed but no issues detected.");
|
|
1236
1236
|
return {
|
|
1237
1237
|
success: !1,
|
|
1238
1238
|
get error() {
|
|
1239
1239
|
if (this._error)
|
|
1240
1240
|
return this._error;
|
|
1241
|
-
const t = new z(
|
|
1241
|
+
const t = new z(r.common.issues);
|
|
1242
1242
|
return this._error = t, this._error;
|
|
1243
1243
|
}
|
|
1244
1244
|
};
|
|
1245
1245
|
};
|
|
1246
|
-
function w(
|
|
1247
|
-
if (!
|
|
1246
|
+
function w(r) {
|
|
1247
|
+
if (!r)
|
|
1248
1248
|
return {};
|
|
1249
|
-
const { errorMap: e, invalid_type_error: t, required_error:
|
|
1250
|
-
if (e && (t ||
|
|
1249
|
+
const { errorMap: e, invalid_type_error: t, required_error: s, description: n } = r;
|
|
1250
|
+
if (e && (t || s))
|
|
1251
1251
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
1252
1252
|
return e ? { errorMap: e, description: n } : { errorMap: (i, o) => {
|
|
1253
1253
|
var c, u;
|
|
1254
|
-
const { message: f } =
|
|
1255
|
-
return i.code === "invalid_enum_value" ? { message: f != null ? f : o.defaultError } : typeof o.data == "undefined" ? { message: (c = f != null ? f :
|
|
1254
|
+
const { message: f } = r;
|
|
1255
|
+
return i.code === "invalid_enum_value" ? { message: f != null ? f : o.defaultError } : typeof o.data == "undefined" ? { message: (c = f != null ? f : s) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (u = f != null ? f : t) !== null && u !== void 0 ? u : o.defaultError };
|
|
1256
1256
|
}, description: n };
|
|
1257
1257
|
}
|
|
1258
1258
|
class x {
|
|
@@ -1296,17 +1296,17 @@ class x {
|
|
|
1296
1296
|
return Promise.resolve(t);
|
|
1297
1297
|
}
|
|
1298
1298
|
parse(e, t) {
|
|
1299
|
-
const
|
|
1300
|
-
if (
|
|
1301
|
-
return
|
|
1302
|
-
throw
|
|
1299
|
+
const s = this.safeParse(e, t);
|
|
1300
|
+
if (s.success)
|
|
1301
|
+
return s.data;
|
|
1302
|
+
throw s.error;
|
|
1303
1303
|
}
|
|
1304
1304
|
safeParse(e, t) {
|
|
1305
|
-
var
|
|
1305
|
+
var s;
|
|
1306
1306
|
const n = {
|
|
1307
1307
|
common: {
|
|
1308
1308
|
issues: [],
|
|
1309
|
-
async: (
|
|
1309
|
+
async: (s = t == null ? void 0 : t.async) !== null && s !== void 0 ? s : !1,
|
|
1310
1310
|
contextualErrorMap: t == null ? void 0 : t.errorMap
|
|
1311
1311
|
},
|
|
1312
1312
|
path: (t == null ? void 0 : t.path) || [],
|
|
@@ -1318,7 +1318,7 @@ class x {
|
|
|
1318
1318
|
return Ht(n, a);
|
|
1319
1319
|
}
|
|
1320
1320
|
"~validate"(e) {
|
|
1321
|
-
var t,
|
|
1321
|
+
var t, s;
|
|
1322
1322
|
const n = {
|
|
1323
1323
|
common: {
|
|
1324
1324
|
issues: [],
|
|
@@ -1333,34 +1333,34 @@ class x {
|
|
|
1333
1333
|
if (!this["~standard"].async)
|
|
1334
1334
|
try {
|
|
1335
1335
|
const a = this._parseSync({ data: e, path: [], parent: n });
|
|
1336
|
-
return
|
|
1336
|
+
return ye(a) ? {
|
|
1337
1337
|
value: a.value
|
|
1338
1338
|
} : {
|
|
1339
1339
|
issues: n.common.issues
|
|
1340
1340
|
};
|
|
1341
1341
|
} catch (a) {
|
|
1342
|
-
!((
|
|
1342
|
+
!((s = (t = a == null ? void 0 : a.message) === null || t === void 0 ? void 0 : t.toLowerCase()) === null || s === void 0) && s.includes("encountered") && (this["~standard"].async = !0), n.common = {
|
|
1343
1343
|
issues: [],
|
|
1344
1344
|
async: !0
|
|
1345
1345
|
};
|
|
1346
1346
|
}
|
|
1347
|
-
return this._parseAsync({ data: e, path: [], parent: n }).then((a) =>
|
|
1347
|
+
return this._parseAsync({ data: e, path: [], parent: n }).then((a) => ye(a) ? {
|
|
1348
1348
|
value: a.value
|
|
1349
1349
|
} : {
|
|
1350
1350
|
issues: n.common.issues
|
|
1351
1351
|
});
|
|
1352
1352
|
}
|
|
1353
1353
|
parseAsync(e, t) {
|
|
1354
|
-
return
|
|
1355
|
-
const
|
|
1356
|
-
if (
|
|
1357
|
-
return
|
|
1358
|
-
throw
|
|
1354
|
+
return C(this, null, function* () {
|
|
1355
|
+
const s = yield this.safeParseAsync(e, t);
|
|
1356
|
+
if (s.success)
|
|
1357
|
+
return s.data;
|
|
1358
|
+
throw s.error;
|
|
1359
1359
|
});
|
|
1360
1360
|
}
|
|
1361
1361
|
safeParseAsync(e, t) {
|
|
1362
|
-
return
|
|
1363
|
-
const
|
|
1362
|
+
return C(this, null, function* () {
|
|
1363
|
+
const s = {
|
|
1364
1364
|
common: {
|
|
1365
1365
|
issues: [],
|
|
1366
1366
|
contextualErrorMap: t == null ? void 0 : t.errorMap,
|
|
@@ -1371,26 +1371,26 @@ class x {
|
|
|
1371
1371
|
parent: null,
|
|
1372
1372
|
data: e,
|
|
1373
1373
|
parsedType: ne(e)
|
|
1374
|
-
}, n = this._parse({ data: e, path:
|
|
1375
|
-
return Ht(
|
|
1374
|
+
}, n = this._parse({ data: e, path: s.path, parent: s }), a = yield Pe(n) ? n : Promise.resolve(n);
|
|
1375
|
+
return Ht(s, a);
|
|
1376
1376
|
});
|
|
1377
1377
|
}
|
|
1378
1378
|
refine(e, t) {
|
|
1379
|
-
const
|
|
1379
|
+
const s = (n) => typeof t == "string" || typeof t == "undefined" ? { message: t } : typeof t == "function" ? t(n) : t;
|
|
1380
1380
|
return this._refinement((n, a) => {
|
|
1381
1381
|
const i = e(n), o = () => a.addIssue(d({
|
|
1382
1382
|
code: l.custom
|
|
1383
|
-
},
|
|
1383
|
+
}, s(n)));
|
|
1384
1384
|
return typeof Promise != "undefined" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
1385
1385
|
});
|
|
1386
1386
|
}
|
|
1387
1387
|
refinement(e, t) {
|
|
1388
|
-
return this._refinement((
|
|
1388
|
+
return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof t == "function" ? t(s, n) : t), !1));
|
|
1389
1389
|
}
|
|
1390
1390
|
_refinement(e) {
|
|
1391
1391
|
return new J({
|
|
1392
1392
|
schema: this,
|
|
1393
|
-
typeName:
|
|
1393
|
+
typeName: y.ZodEffects,
|
|
1394
1394
|
effect: { type: "refinement", refinement: e }
|
|
1395
1395
|
});
|
|
1396
1396
|
}
|
|
@@ -1426,37 +1426,37 @@ class x {
|
|
|
1426
1426
|
return Ve.create(this, e, this._def);
|
|
1427
1427
|
}
|
|
1428
1428
|
transform(e) {
|
|
1429
|
-
return new J(
|
|
1429
|
+
return new J(g(d({}, w(this._def)), {
|
|
1430
1430
|
schema: this,
|
|
1431
|
-
typeName:
|
|
1431
|
+
typeName: y.ZodEffects,
|
|
1432
1432
|
effect: { type: "transform", transform: e }
|
|
1433
1433
|
}));
|
|
1434
1434
|
}
|
|
1435
1435
|
default(e) {
|
|
1436
1436
|
const t = typeof e == "function" ? e : () => e;
|
|
1437
|
-
return new qe(
|
|
1437
|
+
return new qe(g(d({}, w(this._def)), {
|
|
1438
1438
|
innerType: this,
|
|
1439
1439
|
defaultValue: t,
|
|
1440
|
-
typeName:
|
|
1440
|
+
typeName: y.ZodDefault
|
|
1441
1441
|
}));
|
|
1442
1442
|
}
|
|
1443
1443
|
brand() {
|
|
1444
1444
|
return new Zt(d({
|
|
1445
|
-
typeName:
|
|
1445
|
+
typeName: y.ZodBranded,
|
|
1446
1446
|
type: this
|
|
1447
1447
|
}, w(this._def)));
|
|
1448
1448
|
}
|
|
1449
1449
|
catch(e) {
|
|
1450
1450
|
const t = typeof e == "function" ? e : () => e;
|
|
1451
|
-
return new He(
|
|
1451
|
+
return new He(g(d({}, w(this._def)), {
|
|
1452
1452
|
innerType: this,
|
|
1453
1453
|
catchValue: t,
|
|
1454
|
-
typeName:
|
|
1454
|
+
typeName: y.ZodCatch
|
|
1455
1455
|
}));
|
|
1456
1456
|
}
|
|
1457
1457
|
describe(e) {
|
|
1458
1458
|
const t = this.constructor;
|
|
1459
|
-
return new t(
|
|
1459
|
+
return new t(g(d({}, this._def), {
|
|
1460
1460
|
description: e
|
|
1461
1461
|
}));
|
|
1462
1462
|
}
|
|
@@ -1473,36 +1473,36 @@ class x {
|
|
|
1473
1473
|
return this.safeParse(null).success;
|
|
1474
1474
|
}
|
|
1475
1475
|
}
|
|
1476
|
-
const
|
|
1477
|
-
let
|
|
1478
|
-
const
|
|
1479
|
-
function
|
|
1476
|
+
const Zs = /^c[^\s-]{8,}$/i, Ms = /^[0-9a-z]+$/, Ps = /^[0-9A-HJKMNP-TV-Z]{26}$/i, $s = /^[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, Fs = /^[a-z0-9_-]{21}$/i, Ls = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Ds = /^[-+]?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)?)??$/, Vs = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Us = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1477
|
+
let gt;
|
|
1478
|
+
const zs = /^(?:(?: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])$/, Ws = /^(?:(?: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])$/, Bs = /^(([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]))$/, qs = /^(([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])$/, Hs = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Js = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, lr = "((\\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])))", Gs = new RegExp(`^${lr}$`);
|
|
1479
|
+
function fr(r) {
|
|
1480
1480
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
1481
|
-
return
|
|
1481
|
+
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
1482
1482
|
}
|
|
1483
|
-
function
|
|
1484
|
-
return new RegExp(`^${
|
|
1483
|
+
function Ks(r) {
|
|
1484
|
+
return new RegExp(`^${fr(r)}$`);
|
|
1485
1485
|
}
|
|
1486
|
-
function
|
|
1487
|
-
let e = `${
|
|
1486
|
+
function hr(r) {
|
|
1487
|
+
let e = `${lr}T${fr(r)}`;
|
|
1488
1488
|
const t = [];
|
|
1489
|
-
return t.push(
|
|
1489
|
+
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
1490
1490
|
}
|
|
1491
|
-
function
|
|
1492
|
-
return !!((e === "v4" || !e) &&
|
|
1491
|
+
function Xs(r, e) {
|
|
1492
|
+
return !!((e === "v4" || !e) && zs.test(r) || (e === "v6" || !e) && Bs.test(r));
|
|
1493
1493
|
}
|
|
1494
|
-
function
|
|
1495
|
-
if (!
|
|
1494
|
+
function Ys(r, e) {
|
|
1495
|
+
if (!Ls.test(r))
|
|
1496
1496
|
return !1;
|
|
1497
1497
|
try {
|
|
1498
|
-
const [t] =
|
|
1498
|
+
const [t] = r.split("."), s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), n = JSON.parse(atob(s));
|
|
1499
1499
|
return !(typeof n != "object" || n === null || !n.typ || !n.alg || e && n.alg !== e);
|
|
1500
1500
|
} catch (t) {
|
|
1501
1501
|
return !1;
|
|
1502
1502
|
}
|
|
1503
1503
|
}
|
|
1504
|
-
function
|
|
1505
|
-
return !!((e === "v4" || !e) &&
|
|
1504
|
+
function Qs(r, e) {
|
|
1505
|
+
return !!((e === "v4" || !e) && Ws.test(r) || (e === "v6" || !e) && qs.test(r));
|
|
1506
1506
|
}
|
|
1507
1507
|
class q extends x {
|
|
1508
1508
|
_parse(e) {
|
|
@@ -1514,7 +1514,7 @@ class q extends x {
|
|
|
1514
1514
|
received: a.parsedType
|
|
1515
1515
|
}), _;
|
|
1516
1516
|
}
|
|
1517
|
-
const
|
|
1517
|
+
const s = new j();
|
|
1518
1518
|
let n;
|
|
1519
1519
|
for (const a of this._def.checks)
|
|
1520
1520
|
if (a.kind === "min")
|
|
@@ -1525,7 +1525,7 @@ class q extends x {
|
|
|
1525
1525
|
inclusive: !0,
|
|
1526
1526
|
exact: !1,
|
|
1527
1527
|
message: a.message
|
|
1528
|
-
}),
|
|
1528
|
+
}), s.dirty());
|
|
1529
1529
|
else if (a.kind === "max")
|
|
1530
1530
|
e.data.length > a.value && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1531
1531
|
code: l.too_big,
|
|
@@ -1534,7 +1534,7 @@ class q extends x {
|
|
|
1534
1534
|
inclusive: !0,
|
|
1535
1535
|
exact: !1,
|
|
1536
1536
|
message: a.message
|
|
1537
|
-
}),
|
|
1537
|
+
}), s.dirty());
|
|
1538
1538
|
else if (a.kind === "length") {
|
|
1539
1539
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
1540
1540
|
(i || o) && (n = this._getOrReturnCtx(e, n), i ? h(n, {
|
|
@@ -1551,49 +1551,49 @@ class q extends x {
|
|
|
1551
1551
|
inclusive: !0,
|
|
1552
1552
|
exact: !0,
|
|
1553
1553
|
message: a.message
|
|
1554
|
-
}),
|
|
1554
|
+
}), s.dirty());
|
|
1555
1555
|
} else if (a.kind === "email")
|
|
1556
|
-
|
|
1556
|
+
Vs.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1557
1557
|
validation: "email",
|
|
1558
1558
|
code: l.invalid_string,
|
|
1559
1559
|
message: a.message
|
|
1560
|
-
}),
|
|
1560
|
+
}), s.dirty());
|
|
1561
1561
|
else if (a.kind === "emoji")
|
|
1562
|
-
|
|
1562
|
+
gt || (gt = new RegExp(Us, "u")), gt.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1563
1563
|
validation: "emoji",
|
|
1564
1564
|
code: l.invalid_string,
|
|
1565
1565
|
message: a.message
|
|
1566
|
-
}),
|
|
1566
|
+
}), s.dirty());
|
|
1567
1567
|
else if (a.kind === "uuid")
|
|
1568
|
-
$
|
|
1568
|
+
$s.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1569
1569
|
validation: "uuid",
|
|
1570
1570
|
code: l.invalid_string,
|
|
1571
1571
|
message: a.message
|
|
1572
|
-
}),
|
|
1572
|
+
}), s.dirty());
|
|
1573
1573
|
else if (a.kind === "nanoid")
|
|
1574
|
-
|
|
1574
|
+
Fs.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1575
1575
|
validation: "nanoid",
|
|
1576
1576
|
code: l.invalid_string,
|
|
1577
1577
|
message: a.message
|
|
1578
|
-
}),
|
|
1578
|
+
}), s.dirty());
|
|
1579
1579
|
else if (a.kind === "cuid")
|
|
1580
|
-
|
|
1580
|
+
Zs.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1581
1581
|
validation: "cuid",
|
|
1582
1582
|
code: l.invalid_string,
|
|
1583
1583
|
message: a.message
|
|
1584
|
-
}),
|
|
1584
|
+
}), s.dirty());
|
|
1585
1585
|
else if (a.kind === "cuid2")
|
|
1586
|
-
|
|
1586
|
+
Ms.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1587
1587
|
validation: "cuid2",
|
|
1588
1588
|
code: l.invalid_string,
|
|
1589
1589
|
message: a.message
|
|
1590
|
-
}),
|
|
1590
|
+
}), s.dirty());
|
|
1591
1591
|
else if (a.kind === "ulid")
|
|
1592
|
-
|
|
1592
|
+
Ps.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1593
1593
|
validation: "ulid",
|
|
1594
1594
|
code: l.invalid_string,
|
|
1595
1595
|
message: a.message
|
|
1596
|
-
}),
|
|
1596
|
+
}), s.dirty());
|
|
1597
1597
|
else if (a.kind === "url")
|
|
1598
1598
|
try {
|
|
1599
1599
|
new URL(e.data);
|
|
@@ -1602,71 +1602,71 @@ class q extends x {
|
|
|
1602
1602
|
validation: "url",
|
|
1603
1603
|
code: l.invalid_string,
|
|
1604
1604
|
message: a.message
|
|
1605
|
-
}),
|
|
1605
|
+
}), s.dirty();
|
|
1606
1606
|
}
|
|
1607
1607
|
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1608
1608
|
validation: "regex",
|
|
1609
1609
|
code: l.invalid_string,
|
|
1610
1610
|
message: a.message
|
|
1611
|
-
}),
|
|
1611
|
+
}), s.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, {
|
|
1612
1612
|
code: l.invalid_string,
|
|
1613
1613
|
validation: { includes: a.value, position: a.position },
|
|
1614
1614
|
message: a.message
|
|
1615
|
-
}),
|
|
1615
|
+
}), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1616
1616
|
code: l.invalid_string,
|
|
1617
1617
|
validation: { startsWith: a.value },
|
|
1618
1618
|
message: a.message
|
|
1619
|
-
}),
|
|
1619
|
+
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1620
1620
|
code: l.invalid_string,
|
|
1621
1621
|
validation: { endsWith: a.value },
|
|
1622
1622
|
message: a.message
|
|
1623
|
-
}),
|
|
1623
|
+
}), s.dirty()) : a.kind === "datetime" ? hr(a).test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1624
1624
|
code: l.invalid_string,
|
|
1625
1625
|
validation: "datetime",
|
|
1626
1626
|
message: a.message
|
|
1627
|
-
}),
|
|
1627
|
+
}), s.dirty()) : a.kind === "date" ? Gs.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1628
1628
|
code: l.invalid_string,
|
|
1629
1629
|
validation: "date",
|
|
1630
1630
|
message: a.message
|
|
1631
|
-
}),
|
|
1631
|
+
}), s.dirty()) : a.kind === "time" ? Ks(a).test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1632
1632
|
code: l.invalid_string,
|
|
1633
1633
|
validation: "time",
|
|
1634
1634
|
message: a.message
|
|
1635
|
-
}),
|
|
1635
|
+
}), s.dirty()) : a.kind === "duration" ? Ds.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1636
1636
|
validation: "duration",
|
|
1637
1637
|
code: l.invalid_string,
|
|
1638
1638
|
message: a.message
|
|
1639
|
-
}),
|
|
1639
|
+
}), s.dirty()) : a.kind === "ip" ? Xs(e.data, a.version) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1640
1640
|
validation: "ip",
|
|
1641
1641
|
code: l.invalid_string,
|
|
1642
1642
|
message: a.message
|
|
1643
|
-
}),
|
|
1643
|
+
}), s.dirty()) : a.kind === "jwt" ? Ys(e.data, a.alg) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1644
1644
|
validation: "jwt",
|
|
1645
1645
|
code: l.invalid_string,
|
|
1646
1646
|
message: a.message
|
|
1647
|
-
}),
|
|
1647
|
+
}), s.dirty()) : a.kind === "cidr" ? Qs(e.data, a.version) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1648
1648
|
validation: "cidr",
|
|
1649
1649
|
code: l.invalid_string,
|
|
1650
1650
|
message: a.message
|
|
1651
|
-
}),
|
|
1651
|
+
}), s.dirty()) : a.kind === "base64" ? Hs.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1652
1652
|
validation: "base64",
|
|
1653
1653
|
code: l.invalid_string,
|
|
1654
1654
|
message: a.message
|
|
1655
|
-
}),
|
|
1655
|
+
}), s.dirty()) : a.kind === "base64url" ? Js.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1656
1656
|
validation: "base64url",
|
|
1657
1657
|
code: l.invalid_string,
|
|
1658
1658
|
message: a.message
|
|
1659
|
-
}),
|
|
1660
|
-
return { status:
|
|
1659
|
+
}), s.dirty()) : k.assertNever(a);
|
|
1660
|
+
return { status: s.value, value: e.data };
|
|
1661
1661
|
}
|
|
1662
|
-
_regex(e, t,
|
|
1662
|
+
_regex(e, t, s) {
|
|
1663
1663
|
return this.refinement((n) => e.test(n), d({
|
|
1664
1664
|
validation: t,
|
|
1665
1665
|
code: l.invalid_string
|
|
1666
|
-
}, m.errToObj(
|
|
1666
|
+
}, m.errToObj(s)));
|
|
1667
1667
|
}
|
|
1668
1668
|
_addCheck(e) {
|
|
1669
|
-
return new q(
|
|
1669
|
+
return new q(g(d({}, this._def), {
|
|
1670
1670
|
checks: [...this._def.checks, e]
|
|
1671
1671
|
}));
|
|
1672
1672
|
}
|
|
@@ -1712,7 +1712,7 @@ class q extends x {
|
|
|
1712
1712
|
return this._addCheck(d({ kind: "cidr" }, m.errToObj(e)));
|
|
1713
1713
|
}
|
|
1714
1714
|
datetime(e) {
|
|
1715
|
-
var t,
|
|
1715
|
+
var t, s;
|
|
1716
1716
|
return typeof e == "string" ? this._addCheck({
|
|
1717
1717
|
kind: "datetime",
|
|
1718
1718
|
precision: null,
|
|
@@ -1723,7 +1723,7 @@ class q extends x {
|
|
|
1723
1723
|
kind: "datetime",
|
|
1724
1724
|
precision: typeof (e == null ? void 0 : e.precision) == "undefined" ? null : e == null ? void 0 : e.precision,
|
|
1725
1725
|
offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
|
|
1726
|
-
local: (
|
|
1726
|
+
local: (s = e == null ? void 0 : e.local) !== null && s !== void 0 ? s : !1
|
|
1727
1727
|
}, m.errToObj(e == null ? void 0 : e.message)));
|
|
1728
1728
|
}
|
|
1729
1729
|
date(e) {
|
|
@@ -1792,17 +1792,17 @@ class q extends x {
|
|
|
1792
1792
|
return this.min(1, m.errToObj(e));
|
|
1793
1793
|
}
|
|
1794
1794
|
trim() {
|
|
1795
|
-
return new q(
|
|
1795
|
+
return new q(g(d({}, this._def), {
|
|
1796
1796
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1797
1797
|
}));
|
|
1798
1798
|
}
|
|
1799
1799
|
toLowerCase() {
|
|
1800
|
-
return new q(
|
|
1800
|
+
return new q(g(d({}, this._def), {
|
|
1801
1801
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1802
1802
|
}));
|
|
1803
1803
|
}
|
|
1804
1804
|
toUpperCase() {
|
|
1805
|
-
return new q(
|
|
1805
|
+
return new q(g(d({}, this._def), {
|
|
1806
1806
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1807
1807
|
}));
|
|
1808
1808
|
}
|
|
@@ -1867,16 +1867,16 @@ class q extends x {
|
|
|
1867
1867
|
return e;
|
|
1868
1868
|
}
|
|
1869
1869
|
}
|
|
1870
|
-
q.create = (
|
|
1870
|
+
q.create = (r) => {
|
|
1871
1871
|
var e;
|
|
1872
1872
|
return new q(d({
|
|
1873
1873
|
checks: [],
|
|
1874
|
-
typeName:
|
|
1875
|
-
coerce: (e =
|
|
1876
|
-
}, w(
|
|
1874
|
+
typeName: y.ZodString,
|
|
1875
|
+
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1
|
|
1876
|
+
}, w(r)));
|
|
1877
1877
|
};
|
|
1878
|
-
function en(
|
|
1879
|
-
const t = (
|
|
1878
|
+
function en(r, e) {
|
|
1879
|
+
const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = parseInt(r.toFixed(n).replace(".", "")), i = parseInt(e.toFixed(n).replace(".", ""));
|
|
1880
1880
|
return a % i / Math.pow(10, n);
|
|
1881
1881
|
}
|
|
1882
1882
|
class de extends x {
|
|
@@ -1892,33 +1892,33 @@ class de extends x {
|
|
|
1892
1892
|
received: a.parsedType
|
|
1893
1893
|
}), _;
|
|
1894
1894
|
}
|
|
1895
|
-
let
|
|
1895
|
+
let s;
|
|
1896
1896
|
const n = new j();
|
|
1897
1897
|
for (const a of this._def.checks)
|
|
1898
|
-
a.kind === "int" ? k.isInteger(e.data) || (
|
|
1898
|
+
a.kind === "int" ? k.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1899
1899
|
code: l.invalid_type,
|
|
1900
1900
|
expected: "integer",
|
|
1901
1901
|
received: "float",
|
|
1902
1902
|
message: a.message
|
|
1903
|
-
}), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (
|
|
1903
|
+
}), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1904
1904
|
code: l.too_small,
|
|
1905
1905
|
minimum: a.value,
|
|
1906
1906
|
type: "number",
|
|
1907
1907
|
inclusive: a.inclusive,
|
|
1908
1908
|
exact: !1,
|
|
1909
1909
|
message: a.message
|
|
1910
|
-
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (
|
|
1910
|
+
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1911
1911
|
code: l.too_big,
|
|
1912
1912
|
maximum: a.value,
|
|
1913
1913
|
type: "number",
|
|
1914
1914
|
inclusive: a.inclusive,
|
|
1915
1915
|
exact: !1,
|
|
1916
1916
|
message: a.message
|
|
1917
|
-
}), n.dirty()) : a.kind === "multipleOf" ? en(e.data, a.value) !== 0 && (
|
|
1917
|
+
}), n.dirty()) : a.kind === "multipleOf" ? en(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1918
1918
|
code: l.not_multiple_of,
|
|
1919
1919
|
multipleOf: a.value,
|
|
1920
1920
|
message: a.message
|
|
1921
|
-
}), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (
|
|
1921
|
+
}), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1922
1922
|
code: l.not_finite,
|
|
1923
1923
|
message: a.message
|
|
1924
1924
|
}), n.dirty()) : k.assertNever(a);
|
|
@@ -1936,21 +1936,21 @@ class de extends x {
|
|
|
1936
1936
|
lt(e, t) {
|
|
1937
1937
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1938
1938
|
}
|
|
1939
|
-
setLimit(e, t,
|
|
1940
|
-
return new de(
|
|
1939
|
+
setLimit(e, t, s, n) {
|
|
1940
|
+
return new de(g(d({}, this._def), {
|
|
1941
1941
|
checks: [
|
|
1942
1942
|
...this._def.checks,
|
|
1943
1943
|
{
|
|
1944
1944
|
kind: e,
|
|
1945
1945
|
value: t,
|
|
1946
|
-
inclusive:
|
|
1946
|
+
inclusive: s,
|
|
1947
1947
|
message: m.toString(n)
|
|
1948
1948
|
}
|
|
1949
1949
|
]
|
|
1950
1950
|
}));
|
|
1951
1951
|
}
|
|
1952
1952
|
_addCheck(e) {
|
|
1953
|
-
return new de(
|
|
1953
|
+
return new de(g(d({}, this._def), {
|
|
1954
1954
|
checks: [...this._def.checks, e]
|
|
1955
1955
|
}));
|
|
1956
1956
|
}
|
|
@@ -2035,19 +2035,19 @@ class de extends x {
|
|
|
2035
2035
|
}
|
|
2036
2036
|
get isFinite() {
|
|
2037
2037
|
let e = null, t = null;
|
|
2038
|
-
for (const
|
|
2039
|
-
if (
|
|
2038
|
+
for (const s of this._def.checks) {
|
|
2039
|
+
if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
|
|
2040
2040
|
return !0;
|
|
2041
|
-
|
|
2041
|
+
s.kind === "min" ? (t === null || s.value > t) && (t = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
|
|
2042
2042
|
}
|
|
2043
2043
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
2044
2044
|
}
|
|
2045
2045
|
}
|
|
2046
|
-
de.create = (
|
|
2046
|
+
de.create = (r) => new de(d({
|
|
2047
2047
|
checks: [],
|
|
2048
|
-
typeName:
|
|
2049
|
-
coerce: (
|
|
2050
|
-
}, w(
|
|
2048
|
+
typeName: y.ZodNumber,
|
|
2049
|
+
coerce: (r == null ? void 0 : r.coerce) || !1
|
|
2050
|
+
}, w(r)));
|
|
2051
2051
|
class ue extends x {
|
|
2052
2052
|
constructor() {
|
|
2053
2053
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
@@ -2061,22 +2061,22 @@ class ue extends x {
|
|
|
2061
2061
|
}
|
|
2062
2062
|
if (this._getType(e) !== p.bigint)
|
|
2063
2063
|
return this._getInvalidInput(e);
|
|
2064
|
-
let
|
|
2064
|
+
let s;
|
|
2065
2065
|
const n = new j();
|
|
2066
2066
|
for (const a of this._def.checks)
|
|
2067
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (
|
|
2067
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
2068
2068
|
code: l.too_small,
|
|
2069
2069
|
type: "bigint",
|
|
2070
2070
|
minimum: a.value,
|
|
2071
2071
|
inclusive: a.inclusive,
|
|
2072
2072
|
message: a.message
|
|
2073
|
-
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (
|
|
2073
|
+
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
2074
2074
|
code: l.too_big,
|
|
2075
2075
|
type: "bigint",
|
|
2076
2076
|
maximum: a.value,
|
|
2077
2077
|
inclusive: a.inclusive,
|
|
2078
2078
|
message: a.message
|
|
2079
|
-
}), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (
|
|
2079
|
+
}), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
2080
2080
|
code: l.not_multiple_of,
|
|
2081
2081
|
multipleOf: a.value,
|
|
2082
2082
|
message: a.message
|
|
@@ -2103,21 +2103,21 @@ class ue extends x {
|
|
|
2103
2103
|
lt(e, t) {
|
|
2104
2104
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
2105
2105
|
}
|
|
2106
|
-
setLimit(e, t,
|
|
2107
|
-
return new ue(
|
|
2106
|
+
setLimit(e, t, s, n) {
|
|
2107
|
+
return new ue(g(d({}, this._def), {
|
|
2108
2108
|
checks: [
|
|
2109
2109
|
...this._def.checks,
|
|
2110
2110
|
{
|
|
2111
2111
|
kind: e,
|
|
2112
2112
|
value: t,
|
|
2113
|
-
inclusive:
|
|
2113
|
+
inclusive: s,
|
|
2114
2114
|
message: m.toString(n)
|
|
2115
2115
|
}
|
|
2116
2116
|
]
|
|
2117
2117
|
}));
|
|
2118
2118
|
}
|
|
2119
2119
|
_addCheck(e) {
|
|
2120
|
-
return new ue(
|
|
2120
|
+
return new ue(g(d({}, this._def), {
|
|
2121
2121
|
checks: [...this._def.checks, e]
|
|
2122
2122
|
}));
|
|
2123
2123
|
}
|
|
@@ -2173,31 +2173,31 @@ class ue extends x {
|
|
|
2173
2173
|
return e;
|
|
2174
2174
|
}
|
|
2175
2175
|
}
|
|
2176
|
-
ue.create = (
|
|
2176
|
+
ue.create = (r) => {
|
|
2177
2177
|
var e;
|
|
2178
2178
|
return new ue(d({
|
|
2179
2179
|
checks: [],
|
|
2180
|
-
typeName:
|
|
2181
|
-
coerce: (e =
|
|
2182
|
-
}, w(
|
|
2180
|
+
typeName: y.ZodBigInt,
|
|
2181
|
+
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1
|
|
2182
|
+
}, w(r)));
|
|
2183
2183
|
};
|
|
2184
2184
|
class $e extends x {
|
|
2185
2185
|
_parse(e) {
|
|
2186
2186
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
|
|
2187
|
-
const
|
|
2188
|
-
return h(
|
|
2187
|
+
const s = this._getOrReturnCtx(e);
|
|
2188
|
+
return h(s, {
|
|
2189
2189
|
code: l.invalid_type,
|
|
2190
2190
|
expected: p.boolean,
|
|
2191
|
-
received:
|
|
2191
|
+
received: s.parsedType
|
|
2192
2192
|
}), _;
|
|
2193
2193
|
}
|
|
2194
2194
|
return F(e.data);
|
|
2195
2195
|
}
|
|
2196
2196
|
}
|
|
2197
|
-
$e.create = (
|
|
2198
|
-
typeName:
|
|
2199
|
-
coerce: (
|
|
2200
|
-
}, w(
|
|
2197
|
+
$e.create = (r) => new $e(d({
|
|
2198
|
+
typeName: y.ZodBoolean,
|
|
2199
|
+
coerce: (r == null ? void 0 : r.coerce) || !1
|
|
2200
|
+
}, w(r)));
|
|
2201
2201
|
class ve extends x {
|
|
2202
2202
|
_parse(e) {
|
|
2203
2203
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
@@ -2214,7 +2214,7 @@ class ve extends x {
|
|
|
2214
2214
|
code: l.invalid_date
|
|
2215
2215
|
}), _;
|
|
2216
2216
|
}
|
|
2217
|
-
const
|
|
2217
|
+
const s = new j();
|
|
2218
2218
|
let n;
|
|
2219
2219
|
for (const a of this._def.checks)
|
|
2220
2220
|
a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
@@ -2224,21 +2224,21 @@ class ve extends x {
|
|
|
2224
2224
|
exact: !1,
|
|
2225
2225
|
minimum: a.value,
|
|
2226
2226
|
type: "date"
|
|
2227
|
-
}),
|
|
2227
|
+
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
2228
2228
|
code: l.too_big,
|
|
2229
2229
|
message: a.message,
|
|
2230
2230
|
inclusive: !0,
|
|
2231
2231
|
exact: !1,
|
|
2232
2232
|
maximum: a.value,
|
|
2233
2233
|
type: "date"
|
|
2234
|
-
}),
|
|
2234
|
+
}), s.dirty()) : k.assertNever(a);
|
|
2235
2235
|
return {
|
|
2236
|
-
status:
|
|
2236
|
+
status: s.value,
|
|
2237
2237
|
value: new Date(e.data.getTime())
|
|
2238
2238
|
};
|
|
2239
2239
|
}
|
|
2240
2240
|
_addCheck(e) {
|
|
2241
|
-
return new ve(
|
|
2241
|
+
return new ve(g(d({}, this._def), {
|
|
2242
2242
|
checks: [...this._def.checks, e]
|
|
2243
2243
|
}));
|
|
2244
2244
|
}
|
|
@@ -2269,59 +2269,59 @@ class ve extends x {
|
|
|
2269
2269
|
return e != null ? new Date(e) : null;
|
|
2270
2270
|
}
|
|
2271
2271
|
}
|
|
2272
|
-
ve.create = (
|
|
2272
|
+
ve.create = (r) => new ve(d({
|
|
2273
2273
|
checks: [],
|
|
2274
|
-
coerce: (
|
|
2275
|
-
typeName:
|
|
2276
|
-
}, w(
|
|
2274
|
+
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
2275
|
+
typeName: y.ZodDate
|
|
2276
|
+
}, w(r)));
|
|
2277
2277
|
class at extends x {
|
|
2278
2278
|
_parse(e) {
|
|
2279
2279
|
if (this._getType(e) !== p.symbol) {
|
|
2280
|
-
const
|
|
2281
|
-
return h(
|
|
2280
|
+
const s = this._getOrReturnCtx(e);
|
|
2281
|
+
return h(s, {
|
|
2282
2282
|
code: l.invalid_type,
|
|
2283
2283
|
expected: p.symbol,
|
|
2284
|
-
received:
|
|
2284
|
+
received: s.parsedType
|
|
2285
2285
|
}), _;
|
|
2286
2286
|
}
|
|
2287
2287
|
return F(e.data);
|
|
2288
2288
|
}
|
|
2289
2289
|
}
|
|
2290
|
-
at.create = (
|
|
2291
|
-
typeName:
|
|
2292
|
-
}, w(
|
|
2290
|
+
at.create = (r) => new at(d({
|
|
2291
|
+
typeName: y.ZodSymbol
|
|
2292
|
+
}, w(r)));
|
|
2293
2293
|
class Fe extends x {
|
|
2294
2294
|
_parse(e) {
|
|
2295
2295
|
if (this._getType(e) !== p.undefined) {
|
|
2296
|
-
const
|
|
2297
|
-
return h(
|
|
2296
|
+
const s = this._getOrReturnCtx(e);
|
|
2297
|
+
return h(s, {
|
|
2298
2298
|
code: l.invalid_type,
|
|
2299
2299
|
expected: p.undefined,
|
|
2300
|
-
received:
|
|
2300
|
+
received: s.parsedType
|
|
2301
2301
|
}), _;
|
|
2302
2302
|
}
|
|
2303
2303
|
return F(e.data);
|
|
2304
2304
|
}
|
|
2305
2305
|
}
|
|
2306
|
-
Fe.create = (
|
|
2307
|
-
typeName:
|
|
2308
|
-
}, w(
|
|
2306
|
+
Fe.create = (r) => new Fe(d({
|
|
2307
|
+
typeName: y.ZodUndefined
|
|
2308
|
+
}, w(r)));
|
|
2309
2309
|
class Le extends x {
|
|
2310
2310
|
_parse(e) {
|
|
2311
2311
|
if (this._getType(e) !== p.null) {
|
|
2312
|
-
const
|
|
2313
|
-
return h(
|
|
2312
|
+
const s = this._getOrReturnCtx(e);
|
|
2313
|
+
return h(s, {
|
|
2314
2314
|
code: l.invalid_type,
|
|
2315
2315
|
expected: p.null,
|
|
2316
|
-
received:
|
|
2316
|
+
received: s.parsedType
|
|
2317
2317
|
}), _;
|
|
2318
2318
|
}
|
|
2319
2319
|
return F(e.data);
|
|
2320
2320
|
}
|
|
2321
2321
|
}
|
|
2322
|
-
Le.create = (
|
|
2323
|
-
typeName:
|
|
2324
|
-
}, w(
|
|
2322
|
+
Le.create = (r) => new Le(d({
|
|
2323
|
+
typeName: y.ZodNull
|
|
2324
|
+
}, w(r)));
|
|
2325
2325
|
class Ae extends x {
|
|
2326
2326
|
constructor() {
|
|
2327
2327
|
super(...arguments), this._any = !0;
|
|
@@ -2330,10 +2330,10 @@ class Ae extends x {
|
|
|
2330
2330
|
return F(e.data);
|
|
2331
2331
|
}
|
|
2332
2332
|
}
|
|
2333
|
-
Ae.create = (
|
|
2334
|
-
typeName:
|
|
2335
|
-
}, w(
|
|
2336
|
-
class
|
|
2333
|
+
Ae.create = (r) => new Ae(d({
|
|
2334
|
+
typeName: y.ZodAny
|
|
2335
|
+
}, w(r)));
|
|
2336
|
+
class ge extends x {
|
|
2337
2337
|
constructor() {
|
|
2338
2338
|
super(...arguments), this._unknown = !0;
|
|
2339
2339
|
}
|
|
@@ -2341,9 +2341,9 @@ class ye extends x {
|
|
|
2341
2341
|
return F(e.data);
|
|
2342
2342
|
}
|
|
2343
2343
|
}
|
|
2344
|
-
|
|
2345
|
-
typeName:
|
|
2346
|
-
}, w(
|
|
2344
|
+
ge.create = (r) => new ge(d({
|
|
2345
|
+
typeName: y.ZodUnknown
|
|
2346
|
+
}, w(r)));
|
|
2347
2347
|
class ae extends x {
|
|
2348
2348
|
_parse(e) {
|
|
2349
2349
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2354,28 +2354,28 @@ class ae extends x {
|
|
|
2354
2354
|
}), _;
|
|
2355
2355
|
}
|
|
2356
2356
|
}
|
|
2357
|
-
ae.create = (
|
|
2358
|
-
typeName:
|
|
2359
|
-
}, w(
|
|
2357
|
+
ae.create = (r) => new ae(d({
|
|
2358
|
+
typeName: y.ZodNever
|
|
2359
|
+
}, w(r)));
|
|
2360
2360
|
class it extends x {
|
|
2361
2361
|
_parse(e) {
|
|
2362
2362
|
if (this._getType(e) !== p.undefined) {
|
|
2363
|
-
const
|
|
2364
|
-
return h(
|
|
2363
|
+
const s = this._getOrReturnCtx(e);
|
|
2364
|
+
return h(s, {
|
|
2365
2365
|
code: l.invalid_type,
|
|
2366
2366
|
expected: p.void,
|
|
2367
|
-
received:
|
|
2367
|
+
received: s.parsedType
|
|
2368
2368
|
}), _;
|
|
2369
2369
|
}
|
|
2370
2370
|
return F(e.data);
|
|
2371
2371
|
}
|
|
2372
2372
|
}
|
|
2373
|
-
it.create = (
|
|
2374
|
-
typeName:
|
|
2375
|
-
}, w(
|
|
2373
|
+
it.create = (r) => new it(d({
|
|
2374
|
+
typeName: y.ZodVoid
|
|
2375
|
+
}, w(r)));
|
|
2376
2376
|
class H extends x {
|
|
2377
2377
|
_parse(e) {
|
|
2378
|
-
const { ctx: t, status:
|
|
2378
|
+
const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
|
|
2379
2379
|
if (t.parsedType !== p.array)
|
|
2380
2380
|
return h(t, {
|
|
2381
2381
|
code: l.invalid_type,
|
|
@@ -2392,7 +2392,7 @@ class H extends x {
|
|
|
2392
2392
|
inclusive: !0,
|
|
2393
2393
|
exact: !0,
|
|
2394
2394
|
message: n.exactLength.message
|
|
2395
|
-
}),
|
|
2395
|
+
}), s.dirty());
|
|
2396
2396
|
}
|
|
2397
2397
|
if (n.minLength !== null && t.data.length < n.minLength.value && (h(t, {
|
|
2398
2398
|
code: l.too_small,
|
|
@@ -2401,33 +2401,33 @@ class H extends x {
|
|
|
2401
2401
|
inclusive: !0,
|
|
2402
2402
|
exact: !1,
|
|
2403
2403
|
message: n.minLength.message
|
|
2404
|
-
}),
|
|
2404
|
+
}), s.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (h(t, {
|
|
2405
2405
|
code: l.too_big,
|
|
2406
2406
|
maximum: n.maxLength.value,
|
|
2407
2407
|
type: "array",
|
|
2408
2408
|
inclusive: !0,
|
|
2409
2409
|
exact: !1,
|
|
2410
2410
|
message: n.maxLength.message
|
|
2411
|
-
}),
|
|
2412
|
-
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new Q(t, i, t.path, o)))).then((i) => j.mergeArray(
|
|
2411
|
+
}), s.dirty()), t.common.async)
|
|
2412
|
+
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new Q(t, i, t.path, o)))).then((i) => j.mergeArray(s, i));
|
|
2413
2413
|
const a = [...t.data].map((i, o) => n.type._parseSync(new Q(t, i, t.path, o)));
|
|
2414
|
-
return j.mergeArray(
|
|
2414
|
+
return j.mergeArray(s, a);
|
|
2415
2415
|
}
|
|
2416
2416
|
get element() {
|
|
2417
2417
|
return this._def.type;
|
|
2418
2418
|
}
|
|
2419
2419
|
min(e, t) {
|
|
2420
|
-
return new H(
|
|
2420
|
+
return new H(g(d({}, this._def), {
|
|
2421
2421
|
minLength: { value: e, message: m.toString(t) }
|
|
2422
2422
|
}));
|
|
2423
2423
|
}
|
|
2424
2424
|
max(e, t) {
|
|
2425
|
-
return new H(
|
|
2425
|
+
return new H(g(d({}, this._def), {
|
|
2426
2426
|
maxLength: { value: e, message: m.toString(t) }
|
|
2427
2427
|
}));
|
|
2428
2428
|
}
|
|
2429
2429
|
length(e, t) {
|
|
2430
|
-
return new H(
|
|
2430
|
+
return new H(g(d({}, this._def), {
|
|
2431
2431
|
exactLength: { value: e, message: m.toString(t) }
|
|
2432
2432
|
}));
|
|
2433
2433
|
}
|
|
@@ -2435,28 +2435,28 @@ class H extends x {
|
|
|
2435
2435
|
return this.min(1, e);
|
|
2436
2436
|
}
|
|
2437
2437
|
}
|
|
2438
|
-
H.create = (
|
|
2439
|
-
type:
|
|
2438
|
+
H.create = (r, e) => new H(d({
|
|
2439
|
+
type: r,
|
|
2440
2440
|
minLength: null,
|
|
2441
2441
|
maxLength: null,
|
|
2442
2442
|
exactLength: null,
|
|
2443
|
-
typeName:
|
|
2443
|
+
typeName: y.ZodArray
|
|
2444
2444
|
}, w(e)));
|
|
2445
|
-
function xe(
|
|
2446
|
-
if (
|
|
2445
|
+
function xe(r) {
|
|
2446
|
+
if (r instanceof E) {
|
|
2447
2447
|
const e = {};
|
|
2448
|
-
for (const t in
|
|
2449
|
-
const
|
|
2450
|
-
e[t] = Y.create(xe(
|
|
2448
|
+
for (const t in r.shape) {
|
|
2449
|
+
const s = r.shape[t];
|
|
2450
|
+
e[t] = Y.create(xe(s));
|
|
2451
2451
|
}
|
|
2452
|
-
return new
|
|
2452
|
+
return new E(g(d({}, r._def), {
|
|
2453
2453
|
shape: () => e
|
|
2454
2454
|
}));
|
|
2455
|
-
} else return
|
|
2456
|
-
type: xe(
|
|
2457
|
-
})) :
|
|
2455
|
+
} else return r instanceof H ? new H(g(d({}, r._def), {
|
|
2456
|
+
type: xe(r.element)
|
|
2457
|
+
})) : r instanceof Y ? Y.create(xe(r.unwrap())) : r instanceof fe ? fe.create(xe(r.unwrap())) : r instanceof ee ? ee.create(r.items.map((e) => xe(e))) : r;
|
|
2458
2458
|
}
|
|
2459
|
-
class
|
|
2459
|
+
class E extends x {
|
|
2460
2460
|
constructor() {
|
|
2461
2461
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2462
2462
|
}
|
|
@@ -2475,7 +2475,7 @@ class S extends x {
|
|
|
2475
2475
|
received: u.parsedType
|
|
2476
2476
|
}), _;
|
|
2477
2477
|
}
|
|
2478
|
-
const { status:
|
|
2478
|
+
const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
2479
2479
|
if (!(this._def.catchall instanceof ae && this._def.unknownKeys === "strip"))
|
|
2480
2480
|
for (const u in n.data)
|
|
2481
2481
|
i.includes(u) || o.push(u);
|
|
@@ -2500,7 +2500,7 @@ class S extends x {
|
|
|
2500
2500
|
o.length > 0 && (h(n, {
|
|
2501
2501
|
code: l.unrecognized_keys,
|
|
2502
2502
|
keys: o
|
|
2503
|
-
}),
|
|
2503
|
+
}), s.dirty());
|
|
2504
2504
|
else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2505
2505
|
} else {
|
|
2506
2506
|
const u = this._def.catchall;
|
|
@@ -2516,7 +2516,7 @@ class S extends x {
|
|
|
2516
2516
|
});
|
|
2517
2517
|
}
|
|
2518
2518
|
}
|
|
2519
|
-
return n.common.async ? Promise.resolve().then(() =>
|
|
2519
|
+
return n.common.async ? Promise.resolve().then(() => C(this, null, function* () {
|
|
2520
2520
|
const u = [];
|
|
2521
2521
|
for (const f of c) {
|
|
2522
2522
|
const v = yield f.key, O = yield f.value;
|
|
@@ -2527,18 +2527,18 @@ class S extends x {
|
|
|
2527
2527
|
});
|
|
2528
2528
|
}
|
|
2529
2529
|
return u;
|
|
2530
|
-
})).then((u) => j.mergeObjectSync(
|
|
2530
|
+
})).then((u) => j.mergeObjectSync(s, u)) : j.mergeObjectSync(s, c);
|
|
2531
2531
|
}
|
|
2532
2532
|
get shape() {
|
|
2533
2533
|
return this._def.shape();
|
|
2534
2534
|
}
|
|
2535
2535
|
strict(e) {
|
|
2536
|
-
return m.errToObj, new
|
|
2536
|
+
return m.errToObj, new E(d(g(d({}, this._def), {
|
|
2537
2537
|
unknownKeys: "strict"
|
|
2538
2538
|
}), e !== void 0 ? {
|
|
2539
|
-
errorMap: (t,
|
|
2539
|
+
errorMap: (t, s) => {
|
|
2540
2540
|
var n, a, i, o;
|
|
2541
|
-
const c = (i = (a = (n = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(n, t,
|
|
2541
|
+
const c = (i = (a = (n = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(n, t, s).message) !== null && i !== void 0 ? i : s.defaultError;
|
|
2542
2542
|
return t.code === "unrecognized_keys" ? {
|
|
2543
2543
|
message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o : c
|
|
2544
2544
|
} : {
|
|
@@ -2548,12 +2548,12 @@ class S extends x {
|
|
|
2548
2548
|
} : {}));
|
|
2549
2549
|
}
|
|
2550
2550
|
strip() {
|
|
2551
|
-
return new
|
|
2551
|
+
return new E(g(d({}, this._def), {
|
|
2552
2552
|
unknownKeys: "strip"
|
|
2553
2553
|
}));
|
|
2554
2554
|
}
|
|
2555
2555
|
passthrough() {
|
|
2556
|
-
return new
|
|
2556
|
+
return new E(g(d({}, this._def), {
|
|
2557
2557
|
unknownKeys: "passthrough"
|
|
2558
2558
|
}));
|
|
2559
2559
|
}
|
|
@@ -2575,7 +2575,7 @@ class S extends x {
|
|
|
2575
2575
|
// }) as any;
|
|
2576
2576
|
// };
|
|
2577
2577
|
extend(e) {
|
|
2578
|
-
return new
|
|
2578
|
+
return new E(g(d({}, this._def), {
|
|
2579
2579
|
shape: () => d(d({}, this._def.shape()), e)
|
|
2580
2580
|
}));
|
|
2581
2581
|
}
|
|
@@ -2585,11 +2585,11 @@ class S extends x {
|
|
|
2585
2585
|
* upgrade if you are experiencing issues.
|
|
2586
2586
|
*/
|
|
2587
2587
|
merge(e) {
|
|
2588
|
-
return new
|
|
2588
|
+
return new E({
|
|
2589
2589
|
unknownKeys: e._def.unknownKeys,
|
|
2590
2590
|
catchall: e._def.catchall,
|
|
2591
2591
|
shape: () => d(d({}, this._def.shape()), e._def.shape()),
|
|
2592
|
-
typeName:
|
|
2592
|
+
typeName: y.ZodObject
|
|
2593
2593
|
});
|
|
2594
2594
|
}
|
|
2595
2595
|
// merge<
|
|
@@ -2652,23 +2652,23 @@ class S extends x {
|
|
|
2652
2652
|
// return merged;
|
|
2653
2653
|
// }
|
|
2654
2654
|
catchall(e) {
|
|
2655
|
-
return new
|
|
2655
|
+
return new E(g(d({}, this._def), {
|
|
2656
2656
|
catchall: e
|
|
2657
2657
|
}));
|
|
2658
2658
|
}
|
|
2659
2659
|
pick(e) {
|
|
2660
2660
|
const t = {};
|
|
2661
|
-
return k.objectKeys(e).forEach((
|
|
2662
|
-
e[
|
|
2663
|
-
}), new
|
|
2661
|
+
return k.objectKeys(e).forEach((s) => {
|
|
2662
|
+
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
2663
|
+
}), new E(g(d({}, this._def), {
|
|
2664
2664
|
shape: () => t
|
|
2665
2665
|
}));
|
|
2666
2666
|
}
|
|
2667
2667
|
omit(e) {
|
|
2668
2668
|
const t = {};
|
|
2669
|
-
return k.objectKeys(this.shape).forEach((
|
|
2670
|
-
e[
|
|
2671
|
-
}), new
|
|
2669
|
+
return k.objectKeys(this.shape).forEach((s) => {
|
|
2670
|
+
e[s] || (t[s] = this.shape[s]);
|
|
2671
|
+
}), new E(g(d({}, this._def), {
|
|
2672
2672
|
shape: () => t
|
|
2673
2673
|
}));
|
|
2674
2674
|
}
|
|
@@ -2680,53 +2680,53 @@ class S extends x {
|
|
|
2680
2680
|
}
|
|
2681
2681
|
partial(e) {
|
|
2682
2682
|
const t = {};
|
|
2683
|
-
return k.objectKeys(this.shape).forEach((
|
|
2684
|
-
const n = this.shape[
|
|
2685
|
-
e && !e[
|
|
2686
|
-
}), new
|
|
2683
|
+
return k.objectKeys(this.shape).forEach((s) => {
|
|
2684
|
+
const n = this.shape[s];
|
|
2685
|
+
e && !e[s] ? t[s] = n : t[s] = n.optional();
|
|
2686
|
+
}), new E(g(d({}, this._def), {
|
|
2687
2687
|
shape: () => t
|
|
2688
2688
|
}));
|
|
2689
2689
|
}
|
|
2690
2690
|
required(e) {
|
|
2691
2691
|
const t = {};
|
|
2692
|
-
return k.objectKeys(this.shape).forEach((
|
|
2693
|
-
if (e && !e[
|
|
2694
|
-
t[
|
|
2692
|
+
return k.objectKeys(this.shape).forEach((s) => {
|
|
2693
|
+
if (e && !e[s])
|
|
2694
|
+
t[s] = this.shape[s];
|
|
2695
2695
|
else {
|
|
2696
|
-
let a = this.shape[
|
|
2696
|
+
let a = this.shape[s];
|
|
2697
2697
|
for (; a instanceof Y; )
|
|
2698
2698
|
a = a._def.innerType;
|
|
2699
|
-
t[
|
|
2699
|
+
t[s] = a;
|
|
2700
2700
|
}
|
|
2701
|
-
}), new
|
|
2701
|
+
}), new E(g(d({}, this._def), {
|
|
2702
2702
|
shape: () => t
|
|
2703
2703
|
}));
|
|
2704
2704
|
}
|
|
2705
2705
|
keyof() {
|
|
2706
|
-
return
|
|
2706
|
+
return pr(k.objectKeys(this.shape));
|
|
2707
2707
|
}
|
|
2708
2708
|
}
|
|
2709
|
-
|
|
2710
|
-
shape: () =>
|
|
2709
|
+
E.create = (r, e) => new E(d({
|
|
2710
|
+
shape: () => r,
|
|
2711
2711
|
unknownKeys: "strip",
|
|
2712
2712
|
catchall: ae.create(),
|
|
2713
|
-
typeName:
|
|
2713
|
+
typeName: y.ZodObject
|
|
2714
2714
|
}, w(e)));
|
|
2715
|
-
|
|
2716
|
-
shape: () =>
|
|
2715
|
+
E.strictCreate = (r, e) => new E(d({
|
|
2716
|
+
shape: () => r,
|
|
2717
2717
|
unknownKeys: "strict",
|
|
2718
2718
|
catchall: ae.create(),
|
|
2719
|
-
typeName:
|
|
2719
|
+
typeName: y.ZodObject
|
|
2720
2720
|
}, w(e)));
|
|
2721
|
-
|
|
2722
|
-
shape:
|
|
2721
|
+
E.lazycreate = (r, e) => new E(d({
|
|
2722
|
+
shape: r,
|
|
2723
2723
|
unknownKeys: "strip",
|
|
2724
2724
|
catchall: ae.create(),
|
|
2725
|
-
typeName:
|
|
2725
|
+
typeName: y.ZodObject
|
|
2726
2726
|
}, w(e)));
|
|
2727
2727
|
class De extends x {
|
|
2728
2728
|
_parse(e) {
|
|
2729
|
-
const { ctx: t } = this._processInputParams(e),
|
|
2729
|
+
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
2730
2730
|
function n(a) {
|
|
2731
2731
|
for (const o of a)
|
|
2732
2732
|
if (o.result.status === "valid")
|
|
@@ -2741,9 +2741,9 @@ class De extends x {
|
|
|
2741
2741
|
}), _;
|
|
2742
2742
|
}
|
|
2743
2743
|
if (t.common.async)
|
|
2744
|
-
return Promise.all(
|
|
2745
|
-
const i =
|
|
2746
|
-
common:
|
|
2744
|
+
return Promise.all(s.map((a) => C(this, null, function* () {
|
|
2745
|
+
const i = g(d({}, t), {
|
|
2746
|
+
common: g(d({}, t.common), {
|
|
2747
2747
|
issues: []
|
|
2748
2748
|
}),
|
|
2749
2749
|
parent: null
|
|
@@ -2760,9 +2760,9 @@ class De extends x {
|
|
|
2760
2760
|
{
|
|
2761
2761
|
let a;
|
|
2762
2762
|
const i = [];
|
|
2763
|
-
for (const c of
|
|
2764
|
-
const u =
|
|
2765
|
-
common:
|
|
2763
|
+
for (const c of s) {
|
|
2764
|
+
const u = g(d({}, t), {
|
|
2765
|
+
common: g(d({}, t.common), {
|
|
2766
2766
|
issues: []
|
|
2767
2767
|
}),
|
|
2768
2768
|
parent: null
|
|
@@ -2788,11 +2788,11 @@ class De extends x {
|
|
|
2788
2788
|
return this._def.options;
|
|
2789
2789
|
}
|
|
2790
2790
|
}
|
|
2791
|
-
De.create = (
|
|
2792
|
-
options:
|
|
2793
|
-
typeName:
|
|
2791
|
+
De.create = (r, e) => new De(d({
|
|
2792
|
+
options: r,
|
|
2793
|
+
typeName: y.ZodUnion
|
|
2794
2794
|
}, w(e)));
|
|
2795
|
-
const
|
|
2795
|
+
const se = (r) => r instanceof ze ? se(r.schema) : r instanceof J ? se(r.innerType()) : r instanceof We ? [r.value] : r instanceof le ? r.options : r instanceof Be ? k.objectValues(r.enum) : r instanceof qe ? se(r._def.innerType) : r instanceof Fe ? [void 0] : r instanceof Le ? [null] : r instanceof Y ? [void 0, ...se(r.unwrap())] : r instanceof fe ? [null, ...se(r.unwrap())] : r instanceof Zt || r instanceof Je ? se(r.unwrap()) : r instanceof He ? se(r._def.innerType) : [];
|
|
2796
2796
|
class dt extends x {
|
|
2797
2797
|
_parse(e) {
|
|
2798
2798
|
const { ctx: t } = this._processInputParams(e);
|
|
@@ -2802,7 +2802,7 @@ class dt extends x {
|
|
|
2802
2802
|
expected: p.object,
|
|
2803
2803
|
received: t.parsedType
|
|
2804
2804
|
}), _;
|
|
2805
|
-
const
|
|
2805
|
+
const s = this.discriminator, n = t.data[s], a = this.optionsMap.get(n);
|
|
2806
2806
|
return a ? t.common.async ? a._parseAsync({
|
|
2807
2807
|
data: t.data,
|
|
2808
2808
|
path: t.path,
|
|
@@ -2814,7 +2814,7 @@ class dt extends x {
|
|
|
2814
2814
|
}) : (h(t, {
|
|
2815
2815
|
code: l.invalid_union_discriminator,
|
|
2816
2816
|
options: Array.from(this.optionsMap.keys()),
|
|
2817
|
-
path: [
|
|
2817
|
+
path: [s]
|
|
2818
2818
|
}), _);
|
|
2819
2819
|
}
|
|
2820
2820
|
get discriminator() {
|
|
@@ -2834,10 +2834,10 @@ class dt extends x {
|
|
|
2834
2834
|
* @param types an array of object schemas
|
|
2835
2835
|
* @param params
|
|
2836
2836
|
*/
|
|
2837
|
-
static create(e, t,
|
|
2837
|
+
static create(e, t, s) {
|
|
2838
2838
|
const n = /* @__PURE__ */ new Map();
|
|
2839
2839
|
for (const a of t) {
|
|
2840
|
-
const i =
|
|
2840
|
+
const i = se(a.shape[e]);
|
|
2841
2841
|
if (!i.length)
|
|
2842
2842
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2843
2843
|
for (const o of i) {
|
|
@@ -2847,121 +2847,121 @@ class dt extends x {
|
|
|
2847
2847
|
}
|
|
2848
2848
|
}
|
|
2849
2849
|
return new dt(d({
|
|
2850
|
-
typeName:
|
|
2850
|
+
typeName: y.ZodDiscriminatedUnion,
|
|
2851
2851
|
discriminator: e,
|
|
2852
2852
|
options: t,
|
|
2853
2853
|
optionsMap: n
|
|
2854
|
-
}, w(
|
|
2854
|
+
}, w(s)));
|
|
2855
2855
|
}
|
|
2856
2856
|
}
|
|
2857
|
-
function Ot(
|
|
2858
|
-
const t = ne(
|
|
2859
|
-
if (
|
|
2860
|
-
return { valid: !0, data:
|
|
2861
|
-
if (t === p.object &&
|
|
2862
|
-
const n = k.objectKeys(e), a = k.objectKeys(
|
|
2857
|
+
function Ot(r, e) {
|
|
2858
|
+
const t = ne(r), s = ne(e);
|
|
2859
|
+
if (r === e)
|
|
2860
|
+
return { valid: !0, data: r };
|
|
2861
|
+
if (t === p.object && s === p.object) {
|
|
2862
|
+
const n = k.objectKeys(e), a = k.objectKeys(r).filter((o) => n.indexOf(o) !== -1), i = d(d({}, r), e);
|
|
2863
2863
|
for (const o of a) {
|
|
2864
|
-
const c = Ot(
|
|
2864
|
+
const c = Ot(r[o], e[o]);
|
|
2865
2865
|
if (!c.valid)
|
|
2866
2866
|
return { valid: !1 };
|
|
2867
2867
|
i[o] = c.data;
|
|
2868
2868
|
}
|
|
2869
2869
|
return { valid: !0, data: i };
|
|
2870
|
-
} else if (t === p.array &&
|
|
2871
|
-
if (
|
|
2870
|
+
} else if (t === p.array && s === p.array) {
|
|
2871
|
+
if (r.length !== e.length)
|
|
2872
2872
|
return { valid: !1 };
|
|
2873
2873
|
const n = [];
|
|
2874
|
-
for (let a = 0; a <
|
|
2875
|
-
const i =
|
|
2874
|
+
for (let a = 0; a < r.length; a++) {
|
|
2875
|
+
const i = r[a], o = e[a], c = Ot(i, o);
|
|
2876
2876
|
if (!c.valid)
|
|
2877
2877
|
return { valid: !1 };
|
|
2878
2878
|
n.push(c.data);
|
|
2879
2879
|
}
|
|
2880
2880
|
return { valid: !0, data: n };
|
|
2881
|
-
} else return t === p.date &&
|
|
2881
|
+
} else return t === p.date && s === p.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
2882
2882
|
}
|
|
2883
2883
|
class Ve extends x {
|
|
2884
2884
|
_parse(e) {
|
|
2885
|
-
const { status: t, ctx:
|
|
2885
|
+
const { status: t, ctx: s } = this._processInputParams(e), n = (a, i) => {
|
|
2886
2886
|
if (At(a) || At(i))
|
|
2887
2887
|
return _;
|
|
2888
2888
|
const o = Ot(a.value, i.value);
|
|
2889
|
-
return o.valid ? ((Ct(a) || Ct(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(
|
|
2889
|
+
return o.valid ? ((Ct(a) || Ct(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
|
|
2890
2890
|
code: l.invalid_intersection_types
|
|
2891
2891
|
}), _);
|
|
2892
2892
|
};
|
|
2893
|
-
return
|
|
2893
|
+
return s.common.async ? Promise.all([
|
|
2894
2894
|
this._def.left._parseAsync({
|
|
2895
|
-
data:
|
|
2896
|
-
path:
|
|
2897
|
-
parent:
|
|
2895
|
+
data: s.data,
|
|
2896
|
+
path: s.path,
|
|
2897
|
+
parent: s
|
|
2898
2898
|
}),
|
|
2899
2899
|
this._def.right._parseAsync({
|
|
2900
|
-
data:
|
|
2901
|
-
path:
|
|
2902
|
-
parent:
|
|
2900
|
+
data: s.data,
|
|
2901
|
+
path: s.path,
|
|
2902
|
+
parent: s
|
|
2903
2903
|
})
|
|
2904
2904
|
]).then(([a, i]) => n(a, i)) : n(this._def.left._parseSync({
|
|
2905
|
-
data:
|
|
2906
|
-
path:
|
|
2907
|
-
parent:
|
|
2905
|
+
data: s.data,
|
|
2906
|
+
path: s.path,
|
|
2907
|
+
parent: s
|
|
2908
2908
|
}), this._def.right._parseSync({
|
|
2909
|
-
data:
|
|
2910
|
-
path:
|
|
2911
|
-
parent:
|
|
2909
|
+
data: s.data,
|
|
2910
|
+
path: s.path,
|
|
2911
|
+
parent: s
|
|
2912
2912
|
}));
|
|
2913
2913
|
}
|
|
2914
2914
|
}
|
|
2915
|
-
Ve.create = (
|
|
2916
|
-
left:
|
|
2915
|
+
Ve.create = (r, e, t) => new Ve(d({
|
|
2916
|
+
left: r,
|
|
2917
2917
|
right: e,
|
|
2918
|
-
typeName:
|
|
2918
|
+
typeName: y.ZodIntersection
|
|
2919
2919
|
}, w(t)));
|
|
2920
2920
|
class ee extends x {
|
|
2921
2921
|
_parse(e) {
|
|
2922
|
-
const { status: t, ctx:
|
|
2923
|
-
if (
|
|
2924
|
-
return h(
|
|
2922
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2923
|
+
if (s.parsedType !== p.array)
|
|
2924
|
+
return h(s, {
|
|
2925
2925
|
code: l.invalid_type,
|
|
2926
2926
|
expected: p.array,
|
|
2927
|
-
received:
|
|
2927
|
+
received: s.parsedType
|
|
2928
2928
|
}), _;
|
|
2929
|
-
if (
|
|
2930
|
-
return h(
|
|
2929
|
+
if (s.data.length < this._def.items.length)
|
|
2930
|
+
return h(s, {
|
|
2931
2931
|
code: l.too_small,
|
|
2932
2932
|
minimum: this._def.items.length,
|
|
2933
2933
|
inclusive: !0,
|
|
2934
2934
|
exact: !1,
|
|
2935
2935
|
type: "array"
|
|
2936
2936
|
}), _;
|
|
2937
|
-
!this._def.rest &&
|
|
2937
|
+
!this._def.rest && s.data.length > this._def.items.length && (h(s, {
|
|
2938
2938
|
code: l.too_big,
|
|
2939
2939
|
maximum: this._def.items.length,
|
|
2940
2940
|
inclusive: !0,
|
|
2941
2941
|
exact: !1,
|
|
2942
2942
|
type: "array"
|
|
2943
2943
|
}), t.dirty());
|
|
2944
|
-
const a = [...
|
|
2944
|
+
const a = [...s.data].map((i, o) => {
|
|
2945
2945
|
const c = this._def.items[o] || this._def.rest;
|
|
2946
|
-
return c ? c._parse(new Q(
|
|
2946
|
+
return c ? c._parse(new Q(s, i, s.path, o)) : null;
|
|
2947
2947
|
}).filter((i) => !!i);
|
|
2948
|
-
return
|
|
2948
|
+
return s.common.async ? Promise.all(a).then((i) => j.mergeArray(t, i)) : j.mergeArray(t, a);
|
|
2949
2949
|
}
|
|
2950
2950
|
get items() {
|
|
2951
2951
|
return this._def.items;
|
|
2952
2952
|
}
|
|
2953
2953
|
rest(e) {
|
|
2954
|
-
return new ee(
|
|
2954
|
+
return new ee(g(d({}, this._def), {
|
|
2955
2955
|
rest: e
|
|
2956
2956
|
}));
|
|
2957
2957
|
}
|
|
2958
2958
|
}
|
|
2959
|
-
ee.create = (
|
|
2960
|
-
if (!Array.isArray(
|
|
2959
|
+
ee.create = (r, e) => {
|
|
2960
|
+
if (!Array.isArray(r))
|
|
2961
2961
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2962
2962
|
return new ee(d({
|
|
2963
|
-
items:
|
|
2964
|
-
typeName:
|
|
2963
|
+
items: r,
|
|
2964
|
+
typeName: y.ZodTuple,
|
|
2965
2965
|
rest: null
|
|
2966
2966
|
}, w(e)));
|
|
2967
2967
|
};
|
|
@@ -2973,34 +2973,34 @@ class Ue extends x {
|
|
|
2973
2973
|
return this._def.valueType;
|
|
2974
2974
|
}
|
|
2975
2975
|
_parse(e) {
|
|
2976
|
-
const { status: t, ctx:
|
|
2977
|
-
if (
|
|
2978
|
-
return h(
|
|
2976
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2977
|
+
if (s.parsedType !== p.object)
|
|
2978
|
+
return h(s, {
|
|
2979
2979
|
code: l.invalid_type,
|
|
2980
2980
|
expected: p.object,
|
|
2981
|
-
received:
|
|
2981
|
+
received: s.parsedType
|
|
2982
2982
|
}), _;
|
|
2983
2983
|
const n = [], a = this._def.keyType, i = this._def.valueType;
|
|
2984
|
-
for (const o in
|
|
2984
|
+
for (const o in s.data)
|
|
2985
2985
|
n.push({
|
|
2986
|
-
key: a._parse(new Q(
|
|
2987
|
-
value: i._parse(new Q(
|
|
2988
|
-
alwaysSet: o in
|
|
2986
|
+
key: a._parse(new Q(s, o, s.path, o)),
|
|
2987
|
+
value: i._parse(new Q(s, s.data[o], s.path, o)),
|
|
2988
|
+
alwaysSet: o in s.data
|
|
2989
2989
|
});
|
|
2990
|
-
return
|
|
2990
|
+
return s.common.async ? j.mergeObjectAsync(t, n) : j.mergeObjectSync(t, n);
|
|
2991
2991
|
}
|
|
2992
2992
|
get element() {
|
|
2993
2993
|
return this._def.valueType;
|
|
2994
2994
|
}
|
|
2995
|
-
static create(e, t,
|
|
2995
|
+
static create(e, t, s) {
|
|
2996
2996
|
return t instanceof x ? new Ue(d({
|
|
2997
2997
|
keyType: e,
|
|
2998
2998
|
valueType: t,
|
|
2999
|
-
typeName:
|
|
3000
|
-
}, w(
|
|
2999
|
+
typeName: y.ZodRecord
|
|
3000
|
+
}, w(s))) : new Ue(d({
|
|
3001
3001
|
keyType: q.create(),
|
|
3002
3002
|
valueType: e,
|
|
3003
|
-
typeName:
|
|
3003
|
+
typeName: y.ZodRecord
|
|
3004
3004
|
}, w(t)));
|
|
3005
3005
|
}
|
|
3006
3006
|
}
|
|
@@ -3012,20 +3012,20 @@ class ot extends x {
|
|
|
3012
3012
|
return this._def.valueType;
|
|
3013
3013
|
}
|
|
3014
3014
|
_parse(e) {
|
|
3015
|
-
const { status: t, ctx:
|
|
3016
|
-
if (
|
|
3017
|
-
return h(
|
|
3015
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3016
|
+
if (s.parsedType !== p.map)
|
|
3017
|
+
return h(s, {
|
|
3018
3018
|
code: l.invalid_type,
|
|
3019
3019
|
expected: p.map,
|
|
3020
|
-
received:
|
|
3020
|
+
received: s.parsedType
|
|
3021
3021
|
}), _;
|
|
3022
|
-
const n = this._def.keyType, a = this._def.valueType, i = [...
|
|
3023
|
-
key: n._parse(new Q(
|
|
3024
|
-
value: a._parse(new Q(
|
|
3022
|
+
const n = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], u) => ({
|
|
3023
|
+
key: n._parse(new Q(s, o, s.path, [u, "key"])),
|
|
3024
|
+
value: a._parse(new Q(s, c, s.path, [u, "value"]))
|
|
3025
3025
|
}));
|
|
3026
|
-
if (
|
|
3026
|
+
if (s.common.async) {
|
|
3027
3027
|
const o = /* @__PURE__ */ new Map();
|
|
3028
|
-
return Promise.resolve().then(() =>
|
|
3028
|
+
return Promise.resolve().then(() => C(this, null, function* () {
|
|
3029
3029
|
for (const c of i) {
|
|
3030
3030
|
const u = yield c.key, f = yield c.value;
|
|
3031
3031
|
if (u.status === "aborted" || f.status === "aborted")
|
|
@@ -3046,29 +3046,29 @@ class ot extends x {
|
|
|
3046
3046
|
}
|
|
3047
3047
|
}
|
|
3048
3048
|
}
|
|
3049
|
-
ot.create = (
|
|
3049
|
+
ot.create = (r, e, t) => new ot(d({
|
|
3050
3050
|
valueType: e,
|
|
3051
|
-
keyType:
|
|
3052
|
-
typeName:
|
|
3051
|
+
keyType: r,
|
|
3052
|
+
typeName: y.ZodMap
|
|
3053
3053
|
}, w(t)));
|
|
3054
3054
|
class _e extends x {
|
|
3055
3055
|
_parse(e) {
|
|
3056
|
-
const { status: t, ctx:
|
|
3057
|
-
if (
|
|
3058
|
-
return h(
|
|
3056
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3057
|
+
if (s.parsedType !== p.set)
|
|
3058
|
+
return h(s, {
|
|
3059
3059
|
code: l.invalid_type,
|
|
3060
3060
|
expected: p.set,
|
|
3061
|
-
received:
|
|
3061
|
+
received: s.parsedType
|
|
3062
3062
|
}), _;
|
|
3063
3063
|
const n = this._def;
|
|
3064
|
-
n.minSize !== null &&
|
|
3064
|
+
n.minSize !== null && s.data.size < n.minSize.value && (h(s, {
|
|
3065
3065
|
code: l.too_small,
|
|
3066
3066
|
minimum: n.minSize.value,
|
|
3067
3067
|
type: "set",
|
|
3068
3068
|
inclusive: !0,
|
|
3069
3069
|
exact: !1,
|
|
3070
3070
|
message: n.minSize.message
|
|
3071
|
-
}), t.dirty()), n.maxSize !== null &&
|
|
3071
|
+
}), t.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (h(s, {
|
|
3072
3072
|
code: l.too_big,
|
|
3073
3073
|
maximum: n.maxSize.value,
|
|
3074
3074
|
type: "set",
|
|
@@ -3086,16 +3086,16 @@ class _e extends x {
|
|
|
3086
3086
|
}
|
|
3087
3087
|
return { status: t.value, value: u };
|
|
3088
3088
|
}
|
|
3089
|
-
const o = [...
|
|
3090
|
-
return
|
|
3089
|
+
const o = [...s.data.values()].map((c, u) => a._parse(new Q(s, c, s.path, u)));
|
|
3090
|
+
return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
3091
3091
|
}
|
|
3092
3092
|
min(e, t) {
|
|
3093
|
-
return new _e(
|
|
3093
|
+
return new _e(g(d({}, this._def), {
|
|
3094
3094
|
minSize: { value: e, message: m.toString(t) }
|
|
3095
3095
|
}));
|
|
3096
3096
|
}
|
|
3097
3097
|
max(e, t) {
|
|
3098
|
-
return new _e(
|
|
3098
|
+
return new _e(g(d({}, this._def), {
|
|
3099
3099
|
maxSize: { value: e, message: m.toString(t) }
|
|
3100
3100
|
}));
|
|
3101
3101
|
}
|
|
@@ -3106,11 +3106,11 @@ class _e extends x {
|
|
|
3106
3106
|
return this.min(1, e);
|
|
3107
3107
|
}
|
|
3108
3108
|
}
|
|
3109
|
-
_e.create = (
|
|
3110
|
-
valueType:
|
|
3109
|
+
_e.create = (r, e) => new _e(d({
|
|
3110
|
+
valueType: r,
|
|
3111
3111
|
minSize: null,
|
|
3112
3112
|
maxSize: null,
|
|
3113
|
-
typeName:
|
|
3113
|
+
typeName: y.ZodSet
|
|
3114
3114
|
}, w(e)));
|
|
3115
3115
|
class Te extends x {
|
|
3116
3116
|
constructor() {
|
|
@@ -3124,14 +3124,14 @@ class Te extends x {
|
|
|
3124
3124
|
expected: p.function,
|
|
3125
3125
|
received: t.parsedType
|
|
3126
3126
|
}), _;
|
|
3127
|
-
function
|
|
3128
|
-
return
|
|
3127
|
+
function s(o, c) {
|
|
3128
|
+
return st({
|
|
3129
3129
|
data: o,
|
|
3130
3130
|
path: t.path,
|
|
3131
3131
|
errorMaps: [
|
|
3132
3132
|
t.common.contextualErrorMap,
|
|
3133
3133
|
t.schemaErrorMap,
|
|
3134
|
-
|
|
3134
|
+
rt(),
|
|
3135
3135
|
Ee
|
|
3136
3136
|
].filter((u) => !!u),
|
|
3137
3137
|
issueData: {
|
|
@@ -3141,13 +3141,13 @@ class Te extends x {
|
|
|
3141
3141
|
});
|
|
3142
3142
|
}
|
|
3143
3143
|
function n(o, c) {
|
|
3144
|
-
return
|
|
3144
|
+
return st({
|
|
3145
3145
|
data: o,
|
|
3146
3146
|
path: t.path,
|
|
3147
3147
|
errorMaps: [
|
|
3148
3148
|
t.common.contextualErrorMap,
|
|
3149
3149
|
t.schemaErrorMap,
|
|
3150
|
-
|
|
3150
|
+
rt(),
|
|
3151
3151
|
Ee
|
|
3152
3152
|
].filter((u) => !!u),
|
|
3153
3153
|
issueData: {
|
|
@@ -3160,9 +3160,9 @@ class Te extends x {
|
|
|
3160
3160
|
if (this._def.returns instanceof Ce) {
|
|
3161
3161
|
const o = this;
|
|
3162
3162
|
return F(function(...c) {
|
|
3163
|
-
return
|
|
3163
|
+
return C(this, null, function* () {
|
|
3164
3164
|
const u = new z([]), f = yield o._def.args.parseAsync(c, a).catch((R) => {
|
|
3165
|
-
throw u.addIssue(
|
|
3165
|
+
throw u.addIssue(s(c, R)), u;
|
|
3166
3166
|
}), v = yield Reflect.apply(i, this, f);
|
|
3167
3167
|
return yield o._def.returns._def.type.parseAsync(v, a).catch((R) => {
|
|
3168
3168
|
throw u.addIssue(n(v, R)), u;
|
|
@@ -3174,7 +3174,7 @@ class Te extends x {
|
|
|
3174
3174
|
return F(function(...c) {
|
|
3175
3175
|
const u = o._def.args.safeParse(c, a);
|
|
3176
3176
|
if (!u.success)
|
|
3177
|
-
throw new z([
|
|
3177
|
+
throw new z([s(c, u.error)]);
|
|
3178
3178
|
const f = Reflect.apply(i, this, u.data), v = o._def.returns.safeParse(f, a);
|
|
3179
3179
|
if (!v.success)
|
|
3180
3180
|
throw new z([n(f, v.error)]);
|
|
@@ -3189,12 +3189,12 @@ class Te extends x {
|
|
|
3189
3189
|
return this._def.returns;
|
|
3190
3190
|
}
|
|
3191
3191
|
args(...e) {
|
|
3192
|
-
return new Te(
|
|
3193
|
-
args: ee.create(e).rest(
|
|
3192
|
+
return new Te(g(d({}, this._def), {
|
|
3193
|
+
args: ee.create(e).rest(ge.create())
|
|
3194
3194
|
}));
|
|
3195
3195
|
}
|
|
3196
3196
|
returns(e) {
|
|
3197
|
-
return new Te(
|
|
3197
|
+
return new Te(g(d({}, this._def), {
|
|
3198
3198
|
returns: e
|
|
3199
3199
|
}));
|
|
3200
3200
|
}
|
|
@@ -3204,12 +3204,12 @@ class Te extends x {
|
|
|
3204
3204
|
strictImplement(e) {
|
|
3205
3205
|
return this.parse(e);
|
|
3206
3206
|
}
|
|
3207
|
-
static create(e, t,
|
|
3207
|
+
static create(e, t, s) {
|
|
3208
3208
|
return new Te(d({
|
|
3209
|
-
args: e || ee.create([]).rest(
|
|
3210
|
-
returns: t ||
|
|
3211
|
-
typeName:
|
|
3212
|
-
}, w(
|
|
3209
|
+
args: e || ee.create([]).rest(ge.create()),
|
|
3210
|
+
returns: t || ge.create(),
|
|
3211
|
+
typeName: y.ZodFunction
|
|
3212
|
+
}, w(s)));
|
|
3213
3213
|
}
|
|
3214
3214
|
}
|
|
3215
3215
|
class ze extends x {
|
|
@@ -3221,9 +3221,9 @@ class ze extends x {
|
|
|
3221
3221
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
3222
3222
|
}
|
|
3223
3223
|
}
|
|
3224
|
-
ze.create = (
|
|
3225
|
-
getter:
|
|
3226
|
-
typeName:
|
|
3224
|
+
ze.create = (r, e) => new ze(d({
|
|
3225
|
+
getter: r,
|
|
3226
|
+
typeName: y.ZodLazy
|
|
3227
3227
|
}, w(e)));
|
|
3228
3228
|
class We extends x {
|
|
3229
3229
|
_parse(e) {
|
|
@@ -3241,14 +3241,14 @@ class We extends x {
|
|
|
3241
3241
|
return this._def.value;
|
|
3242
3242
|
}
|
|
3243
3243
|
}
|
|
3244
|
-
We.create = (
|
|
3245
|
-
value:
|
|
3246
|
-
typeName:
|
|
3244
|
+
We.create = (r, e) => new We(d({
|
|
3245
|
+
value: r,
|
|
3246
|
+
typeName: y.ZodLiteral
|
|
3247
3247
|
}, w(e)));
|
|
3248
|
-
function
|
|
3248
|
+
function pr(r, e) {
|
|
3249
3249
|
return new le(d({
|
|
3250
|
-
values:
|
|
3251
|
-
typeName:
|
|
3250
|
+
values: r,
|
|
3251
|
+
typeName: y.ZodEnum
|
|
3252
3252
|
}, w(e)));
|
|
3253
3253
|
}
|
|
3254
3254
|
class le extends x {
|
|
@@ -3257,19 +3257,19 @@ class le extends x {
|
|
|
3257
3257
|
}
|
|
3258
3258
|
_parse(e) {
|
|
3259
3259
|
if (typeof e.data != "string") {
|
|
3260
|
-
const t = this._getOrReturnCtx(e),
|
|
3260
|
+
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
3261
3261
|
return h(t, {
|
|
3262
|
-
expected: k.joinValues(
|
|
3262
|
+
expected: k.joinValues(s),
|
|
3263
3263
|
received: t.parsedType,
|
|
3264
3264
|
code: l.invalid_type
|
|
3265
3265
|
}), _;
|
|
3266
3266
|
}
|
|
3267
|
-
if (nt(this, Ze) ||
|
|
3268
|
-
const t = this._getOrReturnCtx(e),
|
|
3267
|
+
if (nt(this, Ze) || ur(this, Ze, new Set(this._def.values)), !nt(this, Ze).has(e.data)) {
|
|
3268
|
+
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
3269
3269
|
return h(t, {
|
|
3270
3270
|
received: t.data,
|
|
3271
3271
|
code: l.invalid_enum_value,
|
|
3272
|
-
options:
|
|
3272
|
+
options: s
|
|
3273
3273
|
}), _;
|
|
3274
3274
|
}
|
|
3275
3275
|
return F(e.data);
|
|
@@ -3299,29 +3299,29 @@ class le extends x {
|
|
|
3299
3299
|
return le.create(e, d(d({}, this._def), t));
|
|
3300
3300
|
}
|
|
3301
3301
|
exclude(e, t = this._def) {
|
|
3302
|
-
return le.create(this.options.filter((
|
|
3302
|
+
return le.create(this.options.filter((s) => !e.includes(s)), d(d({}, this._def), t));
|
|
3303
3303
|
}
|
|
3304
3304
|
}
|
|
3305
3305
|
Ze = /* @__PURE__ */ new WeakMap();
|
|
3306
|
-
le.create =
|
|
3306
|
+
le.create = pr;
|
|
3307
3307
|
class Be extends x {
|
|
3308
3308
|
constructor() {
|
|
3309
3309
|
super(...arguments), Me.set(this, void 0);
|
|
3310
3310
|
}
|
|
3311
3311
|
_parse(e) {
|
|
3312
|
-
const t = k.getValidEnumValues(this._def.values),
|
|
3313
|
-
if (
|
|
3312
|
+
const t = k.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
3313
|
+
if (s.parsedType !== p.string && s.parsedType !== p.number) {
|
|
3314
3314
|
const n = k.objectValues(t);
|
|
3315
|
-
return h(
|
|
3315
|
+
return h(s, {
|
|
3316
3316
|
expected: k.joinValues(n),
|
|
3317
|
-
received:
|
|
3317
|
+
received: s.parsedType,
|
|
3318
3318
|
code: l.invalid_type
|
|
3319
3319
|
}), _;
|
|
3320
3320
|
}
|
|
3321
|
-
if (nt(this, Me) ||
|
|
3321
|
+
if (nt(this, Me) || ur(this, Me, new Set(k.getValidEnumValues(this._def.values))), !nt(this, Me).has(e.data)) {
|
|
3322
3322
|
const n = k.objectValues(t);
|
|
3323
|
-
return h(
|
|
3324
|
-
received:
|
|
3323
|
+
return h(s, {
|
|
3324
|
+
received: s.data,
|
|
3325
3325
|
code: l.invalid_enum_value,
|
|
3326
3326
|
options: n
|
|
3327
3327
|
}), _;
|
|
@@ -3333,9 +3333,9 @@ class Be extends x {
|
|
|
3333
3333
|
}
|
|
3334
3334
|
}
|
|
3335
3335
|
Me = /* @__PURE__ */ new WeakMap();
|
|
3336
|
-
Be.create = (
|
|
3337
|
-
values:
|
|
3338
|
-
typeName:
|
|
3336
|
+
Be.create = (r, e) => new Be(d({
|
|
3337
|
+
values: r,
|
|
3338
|
+
typeName: y.ZodNativeEnum
|
|
3339
3339
|
}, w(e)));
|
|
3340
3340
|
class Ce extends x {
|
|
3341
3341
|
unwrap() {
|
|
@@ -3349,43 +3349,43 @@ class Ce extends x {
|
|
|
3349
3349
|
expected: p.promise,
|
|
3350
3350
|
received: t.parsedType
|
|
3351
3351
|
}), _;
|
|
3352
|
-
const
|
|
3353
|
-
return F(
|
|
3352
|
+
const s = t.parsedType === p.promise ? t.data : Promise.resolve(t.data);
|
|
3353
|
+
return F(s.then((n) => this._def.type.parseAsync(n, {
|
|
3354
3354
|
path: t.path,
|
|
3355
3355
|
errorMap: t.common.contextualErrorMap
|
|
3356
3356
|
})));
|
|
3357
3357
|
}
|
|
3358
3358
|
}
|
|
3359
|
-
Ce.create = (
|
|
3360
|
-
type:
|
|
3361
|
-
typeName:
|
|
3359
|
+
Ce.create = (r, e) => new Ce(d({
|
|
3360
|
+
type: r,
|
|
3361
|
+
typeName: y.ZodPromise
|
|
3362
3362
|
}, w(e)));
|
|
3363
3363
|
class J extends x {
|
|
3364
3364
|
innerType() {
|
|
3365
3365
|
return this._def.schema;
|
|
3366
3366
|
}
|
|
3367
3367
|
sourceType() {
|
|
3368
|
-
return this._def.schema._def.typeName ===
|
|
3368
|
+
return this._def.schema._def.typeName === y.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
3369
3369
|
}
|
|
3370
3370
|
_parse(e) {
|
|
3371
|
-
const { status: t, ctx:
|
|
3371
|
+
const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null, a = {
|
|
3372
3372
|
addIssue: (i) => {
|
|
3373
|
-
h(
|
|
3373
|
+
h(s, i), i.fatal ? t.abort() : t.dirty();
|
|
3374
3374
|
},
|
|
3375
3375
|
get path() {
|
|
3376
|
-
return
|
|
3376
|
+
return s.path;
|
|
3377
3377
|
}
|
|
3378
3378
|
};
|
|
3379
3379
|
if (a.addIssue = a.addIssue.bind(a), n.type === "preprocess") {
|
|
3380
|
-
const i = n.transform(
|
|
3381
|
-
if (
|
|
3382
|
-
return Promise.resolve(i).then((o) =>
|
|
3380
|
+
const i = n.transform(s.data, a);
|
|
3381
|
+
if (s.common.async)
|
|
3382
|
+
return Promise.resolve(i).then((o) => C(this, null, function* () {
|
|
3383
3383
|
if (t.value === "aborted")
|
|
3384
3384
|
return _;
|
|
3385
3385
|
const c = yield this._def.schema._parseAsync({
|
|
3386
3386
|
data: o,
|
|
3387
|
-
path:
|
|
3388
|
-
parent:
|
|
3387
|
+
path: s.path,
|
|
3388
|
+
parent: s
|
|
3389
3389
|
});
|
|
3390
3390
|
return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ? ke(c.value) : c;
|
|
3391
3391
|
}));
|
|
@@ -3394,8 +3394,8 @@ class J extends x {
|
|
|
3394
3394
|
return _;
|
|
3395
3395
|
const o = this._def.schema._parseSync({
|
|
3396
3396
|
data: i,
|
|
3397
|
-
path:
|
|
3398
|
-
parent:
|
|
3397
|
+
path: s.path,
|
|
3398
|
+
parent: s
|
|
3399
3399
|
});
|
|
3400
3400
|
return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ? ke(o.value) : o;
|
|
3401
3401
|
}
|
|
@@ -3403,49 +3403,49 @@ class J extends x {
|
|
|
3403
3403
|
if (n.type === "refinement") {
|
|
3404
3404
|
const i = (o) => {
|
|
3405
3405
|
const c = n.refinement(o, a);
|
|
3406
|
-
if (
|
|
3406
|
+
if (s.common.async)
|
|
3407
3407
|
return Promise.resolve(c);
|
|
3408
3408
|
if (c instanceof Promise)
|
|
3409
3409
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3410
3410
|
return o;
|
|
3411
3411
|
};
|
|
3412
|
-
if (
|
|
3412
|
+
if (s.common.async === !1) {
|
|
3413
3413
|
const o = this._def.schema._parseSync({
|
|
3414
|
-
data:
|
|
3415
|
-
path:
|
|
3416
|
-
parent:
|
|
3414
|
+
data: s.data,
|
|
3415
|
+
path: s.path,
|
|
3416
|
+
parent: s
|
|
3417
3417
|
});
|
|
3418
3418
|
return o.status === "aborted" ? _ : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
3419
3419
|
} else
|
|
3420
|
-
return this._def.schema._parseAsync({ data:
|
|
3420
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? _ : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
3421
3421
|
}
|
|
3422
3422
|
if (n.type === "transform")
|
|
3423
|
-
if (
|
|
3423
|
+
if (s.common.async === !1) {
|
|
3424
3424
|
const i = this._def.schema._parseSync({
|
|
3425
|
-
data:
|
|
3426
|
-
path:
|
|
3427
|
-
parent:
|
|
3425
|
+
data: s.data,
|
|
3426
|
+
path: s.path,
|
|
3427
|
+
parent: s
|
|
3428
3428
|
});
|
|
3429
|
-
if (!
|
|
3429
|
+
if (!ye(i))
|
|
3430
3430
|
return i;
|
|
3431
3431
|
const o = n.transform(i.value, a);
|
|
3432
3432
|
if (o instanceof Promise)
|
|
3433
3433
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3434
3434
|
return { status: t.value, value: o };
|
|
3435
3435
|
} else
|
|
3436
|
-
return this._def.schema._parseAsync({ data:
|
|
3436
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => ye(i) ? Promise.resolve(n.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
3437
3437
|
k.assertNever(n);
|
|
3438
3438
|
}
|
|
3439
3439
|
}
|
|
3440
|
-
J.create = (
|
|
3441
|
-
schema:
|
|
3442
|
-
typeName:
|
|
3440
|
+
J.create = (r, e, t) => new J(d({
|
|
3441
|
+
schema: r,
|
|
3442
|
+
typeName: y.ZodEffects,
|
|
3443
3443
|
effect: e
|
|
3444
3444
|
}, w(t)));
|
|
3445
|
-
J.createWithPreprocess = (
|
|
3445
|
+
J.createWithPreprocess = (r, e, t) => new J(d({
|
|
3446
3446
|
schema: e,
|
|
3447
|
-
effect: { type: "preprocess", transform:
|
|
3448
|
-
typeName:
|
|
3447
|
+
effect: { type: "preprocess", transform: r },
|
|
3448
|
+
typeName: y.ZodEffects
|
|
3449
3449
|
}, w(t)));
|
|
3450
3450
|
class Y extends x {
|
|
3451
3451
|
_parse(e) {
|
|
@@ -3455,9 +3455,9 @@ class Y extends x {
|
|
|
3455
3455
|
return this._def.innerType;
|
|
3456
3456
|
}
|
|
3457
3457
|
}
|
|
3458
|
-
Y.create = (
|
|
3459
|
-
innerType:
|
|
3460
|
-
typeName:
|
|
3458
|
+
Y.create = (r, e) => new Y(d({
|
|
3459
|
+
innerType: r,
|
|
3460
|
+
typeName: y.ZodOptional
|
|
3461
3461
|
}, w(e)));
|
|
3462
3462
|
class fe extends x {
|
|
3463
3463
|
_parse(e) {
|
|
@@ -3467,16 +3467,16 @@ class fe extends x {
|
|
|
3467
3467
|
return this._def.innerType;
|
|
3468
3468
|
}
|
|
3469
3469
|
}
|
|
3470
|
-
fe.create = (
|
|
3471
|
-
innerType:
|
|
3472
|
-
typeName:
|
|
3470
|
+
fe.create = (r, e) => new fe(d({
|
|
3471
|
+
innerType: r,
|
|
3472
|
+
typeName: y.ZodNullable
|
|
3473
3473
|
}, w(e)));
|
|
3474
3474
|
class qe extends x {
|
|
3475
3475
|
_parse(e) {
|
|
3476
3476
|
const { ctx: t } = this._processInputParams(e);
|
|
3477
|
-
let
|
|
3478
|
-
return t.parsedType === p.undefined && (
|
|
3479
|
-
data:
|
|
3477
|
+
let s = t.data;
|
|
3478
|
+
return t.parsedType === p.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
|
|
3479
|
+
data: s,
|
|
3480
3480
|
path: t.path,
|
|
3481
3481
|
parent: t
|
|
3482
3482
|
});
|
|
@@ -3485,37 +3485,37 @@ class qe extends x {
|
|
|
3485
3485
|
return this._def.innerType;
|
|
3486
3486
|
}
|
|
3487
3487
|
}
|
|
3488
|
-
qe.create = (
|
|
3489
|
-
innerType:
|
|
3490
|
-
typeName:
|
|
3488
|
+
qe.create = (r, e) => new qe(d({
|
|
3489
|
+
innerType: r,
|
|
3490
|
+
typeName: y.ZodDefault,
|
|
3491
3491
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
3492
3492
|
}, w(e)));
|
|
3493
3493
|
class He extends x {
|
|
3494
3494
|
_parse(e) {
|
|
3495
|
-
const { ctx: t } = this._processInputParams(e),
|
|
3496
|
-
common:
|
|
3495
|
+
const { ctx: t } = this._processInputParams(e), s = g(d({}, t), {
|
|
3496
|
+
common: g(d({}, t.common), {
|
|
3497
3497
|
issues: []
|
|
3498
3498
|
})
|
|
3499
3499
|
}), n = this._def.innerType._parse({
|
|
3500
|
-
data:
|
|
3501
|
-
path:
|
|
3502
|
-
parent: d({},
|
|
3500
|
+
data: s.data,
|
|
3501
|
+
path: s.path,
|
|
3502
|
+
parent: d({}, s)
|
|
3503
3503
|
});
|
|
3504
3504
|
return Pe(n) ? n.then((a) => ({
|
|
3505
3505
|
status: "valid",
|
|
3506
3506
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
3507
3507
|
get error() {
|
|
3508
|
-
return new z(
|
|
3508
|
+
return new z(s.common.issues);
|
|
3509
3509
|
},
|
|
3510
|
-
input:
|
|
3510
|
+
input: s.data
|
|
3511
3511
|
})
|
|
3512
3512
|
})) : {
|
|
3513
3513
|
status: "valid",
|
|
3514
3514
|
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
3515
3515
|
get error() {
|
|
3516
|
-
return new z(
|
|
3516
|
+
return new z(s.common.issues);
|
|
3517
3517
|
},
|
|
3518
|
-
input:
|
|
3518
|
+
input: s.data
|
|
3519
3519
|
})
|
|
3520
3520
|
};
|
|
3521
3521
|
}
|
|
@@ -3523,33 +3523,33 @@ class He extends x {
|
|
|
3523
3523
|
return this._def.innerType;
|
|
3524
3524
|
}
|
|
3525
3525
|
}
|
|
3526
|
-
He.create = (
|
|
3527
|
-
innerType:
|
|
3528
|
-
typeName:
|
|
3526
|
+
He.create = (r, e) => new He(d({
|
|
3527
|
+
innerType: r,
|
|
3528
|
+
typeName: y.ZodCatch,
|
|
3529
3529
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
3530
3530
|
}, w(e)));
|
|
3531
3531
|
class ct extends x {
|
|
3532
3532
|
_parse(e) {
|
|
3533
3533
|
if (this._getType(e) !== p.nan) {
|
|
3534
|
-
const
|
|
3535
|
-
return h(
|
|
3534
|
+
const s = this._getOrReturnCtx(e);
|
|
3535
|
+
return h(s, {
|
|
3536
3536
|
code: l.invalid_type,
|
|
3537
3537
|
expected: p.nan,
|
|
3538
|
-
received:
|
|
3538
|
+
received: s.parsedType
|
|
3539
3539
|
}), _;
|
|
3540
3540
|
}
|
|
3541
3541
|
return { status: "valid", value: e.data };
|
|
3542
3542
|
}
|
|
3543
3543
|
}
|
|
3544
|
-
ct.create = (
|
|
3545
|
-
typeName:
|
|
3546
|
-
}, w(
|
|
3544
|
+
ct.create = (r) => new ct(d({
|
|
3545
|
+
typeName: y.ZodNaN
|
|
3546
|
+
}, w(r)));
|
|
3547
3547
|
const tn = Symbol("zod_brand");
|
|
3548
3548
|
class Zt extends x {
|
|
3549
3549
|
_parse(e) {
|
|
3550
|
-
const { ctx: t } = this._processInputParams(e),
|
|
3550
|
+
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
3551
3551
|
return this._def.type._parse({
|
|
3552
|
-
data:
|
|
3552
|
+
data: s,
|
|
3553
3553
|
path: t.path,
|
|
3554
3554
|
parent: t
|
|
3555
3555
|
});
|
|
@@ -3560,33 +3560,33 @@ class Zt extends x {
|
|
|
3560
3560
|
}
|
|
3561
3561
|
class Ke extends x {
|
|
3562
3562
|
_parse(e) {
|
|
3563
|
-
const { status: t, ctx:
|
|
3564
|
-
if (
|
|
3565
|
-
return
|
|
3563
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3564
|
+
if (s.common.async)
|
|
3565
|
+
return C(this, null, function* () {
|
|
3566
3566
|
const a = yield this._def.in._parseAsync({
|
|
3567
|
-
data:
|
|
3568
|
-
path:
|
|
3569
|
-
parent:
|
|
3567
|
+
data: s.data,
|
|
3568
|
+
path: s.path,
|
|
3569
|
+
parent: s
|
|
3570
3570
|
});
|
|
3571
3571
|
return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(), ke(a.value)) : this._def.out._parseAsync({
|
|
3572
3572
|
data: a.value,
|
|
3573
|
-
path:
|
|
3574
|
-
parent:
|
|
3573
|
+
path: s.path,
|
|
3574
|
+
parent: s
|
|
3575
3575
|
});
|
|
3576
3576
|
});
|
|
3577
3577
|
{
|
|
3578
3578
|
const n = this._def.in._parseSync({
|
|
3579
|
-
data:
|
|
3580
|
-
path:
|
|
3581
|
-
parent:
|
|
3579
|
+
data: s.data,
|
|
3580
|
+
path: s.path,
|
|
3581
|
+
parent: s
|
|
3582
3582
|
});
|
|
3583
3583
|
return n.status === "aborted" ? _ : n.status === "dirty" ? (t.dirty(), {
|
|
3584
3584
|
status: "dirty",
|
|
3585
3585
|
value: n.value
|
|
3586
3586
|
}) : this._def.out._parseSync({
|
|
3587
3587
|
data: n.value,
|
|
3588
|
-
path:
|
|
3589
|
-
parent:
|
|
3588
|
+
path: s.path,
|
|
3589
|
+
parent: s
|
|
3590
3590
|
});
|
|
3591
3591
|
}
|
|
3592
3592
|
}
|
|
@@ -3594,70 +3594,70 @@ class Ke extends x {
|
|
|
3594
3594
|
return new Ke({
|
|
3595
3595
|
in: e,
|
|
3596
3596
|
out: t,
|
|
3597
|
-
typeName:
|
|
3597
|
+
typeName: y.ZodPipeline
|
|
3598
3598
|
});
|
|
3599
3599
|
}
|
|
3600
3600
|
}
|
|
3601
3601
|
class Je extends x {
|
|
3602
3602
|
_parse(e) {
|
|
3603
|
-
const t = this._def.innerType._parse(e),
|
|
3604
|
-
return Pe(t) ? t.then((n) =>
|
|
3603
|
+
const t = this._def.innerType._parse(e), s = (n) => (ye(n) && (n.value = Object.freeze(n.value)), n);
|
|
3604
|
+
return Pe(t) ? t.then((n) => s(n)) : s(t);
|
|
3605
3605
|
}
|
|
3606
3606
|
unwrap() {
|
|
3607
3607
|
return this._def.innerType;
|
|
3608
3608
|
}
|
|
3609
3609
|
}
|
|
3610
|
-
Je.create = (
|
|
3611
|
-
innerType:
|
|
3612
|
-
typeName:
|
|
3610
|
+
Je.create = (r, e) => new Je(d({
|
|
3611
|
+
innerType: r,
|
|
3612
|
+
typeName: y.ZodReadonly
|
|
3613
3613
|
}, w(e)));
|
|
3614
|
-
function Jt(
|
|
3615
|
-
const t = typeof
|
|
3614
|
+
function Jt(r, e) {
|
|
3615
|
+
const t = typeof r == "function" ? r(e) : typeof r == "string" ? { message: r } : r;
|
|
3616
3616
|
return typeof t == "string" ? { message: t } : t;
|
|
3617
3617
|
}
|
|
3618
|
-
function
|
|
3619
|
-
return
|
|
3618
|
+
function mr(r, e = {}, t) {
|
|
3619
|
+
return r ? Ae.create().superRefine((s, n) => {
|
|
3620
3620
|
var a, i;
|
|
3621
|
-
const o = s
|
|
3621
|
+
const o = r(s);
|
|
3622
3622
|
if (o instanceof Promise)
|
|
3623
3623
|
return o.then((c) => {
|
|
3624
3624
|
var u, f;
|
|
3625
3625
|
if (!c) {
|
|
3626
|
-
const v = Jt(e,
|
|
3627
|
-
n.addIssue(
|
|
3626
|
+
const v = Jt(e, s), O = (f = (u = v.fatal) !== null && u !== void 0 ? u : t) !== null && f !== void 0 ? f : !0;
|
|
3627
|
+
n.addIssue(g(d({ code: "custom" }, v), { fatal: O }));
|
|
3628
3628
|
}
|
|
3629
3629
|
});
|
|
3630
3630
|
if (!o) {
|
|
3631
|
-
const c = Jt(e,
|
|
3632
|
-
n.addIssue(
|
|
3631
|
+
const c = Jt(e, s), u = (i = (a = c.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
|
|
3632
|
+
n.addIssue(g(d({ code: "custom" }, c), { fatal: u }));
|
|
3633
3633
|
}
|
|
3634
3634
|
}) : Ae.create();
|
|
3635
3635
|
}
|
|
3636
|
-
const
|
|
3637
|
-
object:
|
|
3636
|
+
const rn = {
|
|
3637
|
+
object: E.lazycreate
|
|
3638
3638
|
};
|
|
3639
|
-
var
|
|
3640
|
-
(function(
|
|
3641
|
-
|
|
3642
|
-
})(
|
|
3643
|
-
const
|
|
3644
|
-
message: `Input not instance of ${
|
|
3645
|
-
}) =>
|
|
3646
|
-
string: (
|
|
3647
|
-
number: (
|
|
3648
|
-
boolean: (
|
|
3639
|
+
var y;
|
|
3640
|
+
(function(r) {
|
|
3641
|
+
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
3642
|
+
})(y || (y = {}));
|
|
3643
|
+
const sn = (r, e = {
|
|
3644
|
+
message: `Input not instance of ${r.name}`
|
|
3645
|
+
}) => mr((t) => t instanceof r, e), gr = q.create, yr = de.create, nn = ct.create, an = ue.create, vr = $e.create, on = ve.create, cn = at.create, dn = Fe.create, un = Le.create, ln = Ae.create, fn = ge.create, hn = ae.create, pn = it.create, mn = H.create, gn = E.create, yn = E.strictCreate, vn = De.create, _n = dt.create, bn = Ve.create, wn = ee.create, xn = Ue.create, kn = ot.create, Tn = _e.create, Sn = Te.create, En = ze.create, An = We.create, Cn = le.create, On = Be.create, In = Ce.create, Gt = J.create, Nn = Y.create, jn = fe.create, Rn = J.createWithPreprocess, Zn = Ke.create, Mn = () => gr().optional(), Pn = () => yr().optional(), $n = () => vr().optional(), Fn = {
|
|
3646
|
+
string: (r) => q.create(g(d({}, r), { coerce: !0 })),
|
|
3647
|
+
number: (r) => de.create(g(d({}, r), { coerce: !0 })),
|
|
3648
|
+
boolean: (r) => $e.create(g(d({}, r), {
|
|
3649
3649
|
coerce: !0
|
|
3650
3650
|
})),
|
|
3651
|
-
bigint: (
|
|
3652
|
-
date: (
|
|
3651
|
+
bigint: (r) => ue.create(g(d({}, r), { coerce: !0 })),
|
|
3652
|
+
date: (r) => ve.create(g(d({}, r), { coerce: !0 }))
|
|
3653
3653
|
}, Ln = _;
|
|
3654
|
-
var
|
|
3654
|
+
var S = /* @__PURE__ */ Object.freeze({
|
|
3655
3655
|
__proto__: null,
|
|
3656
3656
|
defaultErrorMap: Ee,
|
|
3657
|
-
setErrorMap:
|
|
3658
|
-
getErrorMap:
|
|
3659
|
-
makeIssue:
|
|
3660
|
-
EMPTY_PATH:
|
|
3657
|
+
setErrorMap: js,
|
|
3658
|
+
getErrorMap: rt,
|
|
3659
|
+
makeIssue: st,
|
|
3660
|
+
EMPTY_PATH: Rs,
|
|
3661
3661
|
addIssueToContext: h,
|
|
3662
3662
|
ParseStatus: j,
|
|
3663
3663
|
INVALID: _,
|
|
@@ -3665,7 +3665,7 @@ var C = /* @__PURE__ */ Object.freeze({
|
|
|
3665
3665
|
OK: F,
|
|
3666
3666
|
isAborted: At,
|
|
3667
3667
|
isDirty: Ct,
|
|
3668
|
-
isValid:
|
|
3668
|
+
isValid: ye,
|
|
3669
3669
|
isAsync: Pe,
|
|
3670
3670
|
get util() {
|
|
3671
3671
|
return k;
|
|
@@ -3676,7 +3676,7 @@ var C = /* @__PURE__ */ Object.freeze({
|
|
|
3676
3676
|
ZodParsedType: p,
|
|
3677
3677
|
getParsedType: ne,
|
|
3678
3678
|
ZodType: x,
|
|
3679
|
-
datetimeRegex:
|
|
3679
|
+
datetimeRegex: hr,
|
|
3680
3680
|
ZodString: q,
|
|
3681
3681
|
ZodNumber: de,
|
|
3682
3682
|
ZodBigInt: ue,
|
|
@@ -3686,11 +3686,11 @@ var C = /* @__PURE__ */ Object.freeze({
|
|
|
3686
3686
|
ZodUndefined: Fe,
|
|
3687
3687
|
ZodNull: Le,
|
|
3688
3688
|
ZodAny: Ae,
|
|
3689
|
-
ZodUnknown:
|
|
3689
|
+
ZodUnknown: ge,
|
|
3690
3690
|
ZodNever: ae,
|
|
3691
3691
|
ZodVoid: it,
|
|
3692
3692
|
ZodArray: H,
|
|
3693
|
-
ZodObject:
|
|
3693
|
+
ZodObject: E,
|
|
3694
3694
|
ZodUnion: De,
|
|
3695
3695
|
ZodDiscriminatedUnion: dt,
|
|
3696
3696
|
ZodIntersection: Ve,
|
|
@@ -3715,24 +3715,24 @@ var C = /* @__PURE__ */ Object.freeze({
|
|
|
3715
3715
|
ZodBranded: Zt,
|
|
3716
3716
|
ZodPipeline: Ke,
|
|
3717
3717
|
ZodReadonly: Je,
|
|
3718
|
-
custom:
|
|
3718
|
+
custom: mr,
|
|
3719
3719
|
Schema: x,
|
|
3720
3720
|
ZodSchema: x,
|
|
3721
|
-
late:
|
|
3721
|
+
late: rn,
|
|
3722
3722
|
get ZodFirstPartyTypeKind() {
|
|
3723
|
-
return
|
|
3723
|
+
return y;
|
|
3724
3724
|
},
|
|
3725
3725
|
coerce: Fn,
|
|
3726
3726
|
any: ln,
|
|
3727
3727
|
array: mn,
|
|
3728
3728
|
bigint: an,
|
|
3729
|
-
boolean:
|
|
3729
|
+
boolean: vr,
|
|
3730
3730
|
date: on,
|
|
3731
3731
|
discriminatedUnion: _n,
|
|
3732
3732
|
effect: Gt,
|
|
3733
3733
|
enum: Cn,
|
|
3734
3734
|
function: Sn,
|
|
3735
|
-
instanceof:
|
|
3735
|
+
instanceof: sn,
|
|
3736
3736
|
intersection: bn,
|
|
3737
3737
|
lazy: En,
|
|
3738
3738
|
literal: An,
|
|
@@ -3742,8 +3742,8 @@ var C = /* @__PURE__ */ Object.freeze({
|
|
|
3742
3742
|
never: hn,
|
|
3743
3743
|
null: un,
|
|
3744
3744
|
nullable: jn,
|
|
3745
|
-
number:
|
|
3746
|
-
object:
|
|
3745
|
+
number: yr,
|
|
3746
|
+
object: gn,
|
|
3747
3747
|
oboolean: $n,
|
|
3748
3748
|
onumber: Pn,
|
|
3749
3749
|
optional: Nn,
|
|
@@ -3753,8 +3753,8 @@ var C = /* @__PURE__ */ Object.freeze({
|
|
|
3753
3753
|
promise: In,
|
|
3754
3754
|
record: xn,
|
|
3755
3755
|
set: Tn,
|
|
3756
|
-
strictObject:
|
|
3757
|
-
string:
|
|
3756
|
+
strictObject: yn,
|
|
3757
|
+
string: gr,
|
|
3758
3758
|
symbol: cn,
|
|
3759
3759
|
transformer: Gt,
|
|
3760
3760
|
tuple: wn,
|
|
@@ -3764,18 +3764,18 @@ var C = /* @__PURE__ */ Object.freeze({
|
|
|
3764
3764
|
void: pn,
|
|
3765
3765
|
NEVER: Ln,
|
|
3766
3766
|
ZodIssueCode: l,
|
|
3767
|
-
quotelessJson:
|
|
3767
|
+
quotelessJson: Ns,
|
|
3768
3768
|
ZodError: z
|
|
3769
3769
|
});
|
|
3770
|
-
const Dn =
|
|
3771
|
-
language:
|
|
3772
|
-
disableMarkedForExport:
|
|
3770
|
+
const Dn = S.object({
|
|
3771
|
+
language: S.enum(["typescript", "javascript"]).optional(),
|
|
3772
|
+
disableMarkedForExport: S.boolean().optional()
|
|
3773
3773
|
}).and(
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
framework:
|
|
3777
|
-
model:
|
|
3778
|
-
styling:
|
|
3774
|
+
S.union([
|
|
3775
|
+
S.object({
|
|
3776
|
+
framework: S.literal("react"),
|
|
3777
|
+
model: S.string().optional(),
|
|
3778
|
+
styling: S.enum([
|
|
3779
3779
|
"plain_css",
|
|
3780
3780
|
"css_modules",
|
|
3781
3781
|
"styled_components",
|
|
@@ -3784,22 +3784,28 @@ const Dn = C.object({
|
|
|
3784
3784
|
"scss",
|
|
3785
3785
|
"inline_styles"
|
|
3786
3786
|
]),
|
|
3787
|
-
uiLibrary:
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3787
|
+
uiLibrary: S.enum(["mui", "antd", "radix", "shadcn"]).optional(),
|
|
3788
|
+
responsivePages: S.array(
|
|
3789
|
+
S.object({
|
|
3790
|
+
name: S.string(),
|
|
3791
|
+
framesId: S.array(S.string())
|
|
3792
|
+
})
|
|
3793
|
+
).optional(),
|
|
3794
|
+
enableUILibraryTheming: S.boolean().optional(),
|
|
3795
|
+
enableCompactStructure: S.boolean().optional(),
|
|
3796
|
+
enableDisplayScreenModelId: S.boolean().optional(),
|
|
3797
|
+
enableGeneratePackageLock: S.boolean().optional(),
|
|
3798
|
+
enableAutoSplit: S.boolean().optional(),
|
|
3799
|
+
autoSplitThreshold: S.number().optional()
|
|
3794
3800
|
}),
|
|
3795
|
-
|
|
3796
|
-
framework:
|
|
3797
|
-
styling:
|
|
3798
|
-
enableTranslation:
|
|
3801
|
+
S.object({
|
|
3802
|
+
framework: S.literal("html"),
|
|
3803
|
+
styling: S.enum(["plain_css", "inline_styles", "tailwind"]),
|
|
3804
|
+
enableTranslation: S.boolean().optional()
|
|
3799
3805
|
})
|
|
3800
3806
|
])
|
|
3801
|
-
), Vn = (
|
|
3802
|
-
const e = Dn.safeParse(
|
|
3807
|
+
), Vn = (r) => {
|
|
3808
|
+
const e = Dn.safeParse(r);
|
|
3803
3809
|
if (e.success === !1) {
|
|
3804
3810
|
const t = new Error("Invalid codegen settings");
|
|
3805
3811
|
throw t.cause = e.error, t;
|
|
@@ -3811,20 +3817,20 @@ const Dn = C.object({
|
|
|
3811
3817
|
"COMPONENT",
|
|
3812
3818
|
"COMPONENT_SET",
|
|
3813
3819
|
"GROUP"
|
|
3814
|
-
]), Un = (
|
|
3815
|
-
const t =
|
|
3820
|
+
]), Un = (r, e) => {
|
|
3821
|
+
const t = cr(r.document, e);
|
|
3816
3822
|
if (!t)
|
|
3817
3823
|
return {
|
|
3818
3824
|
isValid: !1,
|
|
3819
3825
|
reason: "There is no node with the given id"
|
|
3820
3826
|
};
|
|
3821
3827
|
if (t.type === "CANVAS") {
|
|
3822
|
-
const
|
|
3828
|
+
const s = t.children.filter(
|
|
3823
3829
|
(n) => Kt.has(n.type)
|
|
3824
3830
|
);
|
|
3825
|
-
return
|
|
3831
|
+
return s.length === 1 ? {
|
|
3826
3832
|
isValid: !0,
|
|
3827
|
-
node:
|
|
3833
|
+
node: s[0],
|
|
3828
3834
|
note: "Selected node is a page with a single valid children - returning it instead"
|
|
3829
3835
|
} : {
|
|
3830
3836
|
isValid: !1,
|
|
@@ -3836,7 +3842,7 @@ const Dn = C.object({
|
|
|
3836
3842
|
reason: "Selected node type is not supported"
|
|
3837
3843
|
};
|
|
3838
3844
|
};
|
|
3839
|
-
var I, Ge, be,
|
|
3845
|
+
var I, Ge, be, _r, It;
|
|
3840
3846
|
class Yn {
|
|
3841
3847
|
constructor({
|
|
3842
3848
|
auth: e,
|
|
@@ -3859,9 +3865,9 @@ class Yn {
|
|
|
3859
3865
|
};
|
|
3860
3866
|
return P(this, I) && (e.Authorization = `Bearer ${P(this, I).token}`, "teamId" in P(this, I) && (e["X-Team-Id"] = P(this, I).teamId)), e;
|
|
3861
3867
|
}
|
|
3862
|
-
generateCode(
|
|
3863
|
-
return
|
|
3864
|
-
e.figmaToken && (yield Ye(this, be,
|
|
3868
|
+
generateCode(s) {
|
|
3869
|
+
return C(this, arguments, function* (e, t = {}) {
|
|
3870
|
+
e.figmaToken && (yield Ye(this, be, _r).call(this, e.fileKey, e.figmaToken, e.nodesId));
|
|
3865
3871
|
const n = Vn(e.settings);
|
|
3866
3872
|
let a = e.tracking;
|
|
3867
3873
|
P(this, I) && "userId" in P(this, I) && P(this, I).userId && (a != null && a.externalId || (a = { externalId: P(this, I).userId }));
|
|
@@ -3893,8 +3899,8 @@ class Yn {
|
|
|
3893
3899
|
* This API is experimental and may change or be removed in future releases.
|
|
3894
3900
|
* Link2Code (l2c) flow.
|
|
3895
3901
|
*/
|
|
3896
|
-
generateLink2Code(
|
|
3897
|
-
return
|
|
3902
|
+
generateLink2Code(s) {
|
|
3903
|
+
return C(this, arguments, function* (e, t = {}) {
|
|
3898
3904
|
let n = e.tracking;
|
|
3899
3905
|
P(this, I) && "userId" in P(this, I) && P(this, I).userId && (n != null && n.externalId || (n = { externalId: P(this, I).userId }));
|
|
3900
3906
|
const a = {
|
|
@@ -3906,11 +3912,11 @@ class Yn {
|
|
|
3906
3912
|
});
|
|
3907
3913
|
}
|
|
3908
3914
|
}
|
|
3909
|
-
I = new WeakMap(), Ge = new WeakMap(), be = new WeakSet(),
|
|
3910
|
-
return
|
|
3915
|
+
I = new WeakMap(), Ge = new WeakMap(), be = new WeakSet(), _r = function(e, t, s) {
|
|
3916
|
+
return C(this, null, function* () {
|
|
3911
3917
|
let n;
|
|
3912
3918
|
try {
|
|
3913
|
-
n = yield
|
|
3919
|
+
n = yield Is({
|
|
3914
3920
|
fileKey: e,
|
|
3915
3921
|
authToken: t,
|
|
3916
3922
|
params: {
|
|
@@ -3920,7 +3926,7 @@ I = new WeakMap(), Ge = new WeakMap(), be = new WeakSet(), _s = function(e, t, r
|
|
|
3920
3926
|
} catch (o) {
|
|
3921
3927
|
return;
|
|
3922
3928
|
}
|
|
3923
|
-
const i =
|
|
3929
|
+
const i = s.map(
|
|
3924
3930
|
(o) => Un(n, o)
|
|
3925
3931
|
).find(
|
|
3926
3932
|
(o) => !o.isValid
|
|
@@ -3931,14 +3937,14 @@ I = new WeakMap(), Ge = new WeakMap(), be = new WeakSet(), _s = function(e, t, r
|
|
|
3931
3937
|
reason: i.reason
|
|
3932
3938
|
});
|
|
3933
3939
|
});
|
|
3934
|
-
}, It = function(e, t,
|
|
3935
|
-
return
|
|
3940
|
+
}, It = function(e, t, s, n) {
|
|
3941
|
+
return C(this, null, function* () {
|
|
3936
3942
|
var f, v, O, R, L, W, te, he, ie;
|
|
3937
3943
|
if (this.hasAuth() === !1)
|
|
3938
3944
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
3939
3945
|
const a = {}, i = yield fetch(`${P(this, Ge)}${e}`, {
|
|
3940
3946
|
method: "POST",
|
|
3941
|
-
headers:
|
|
3947
|
+
headers: g(d({}, this.headers), {
|
|
3942
3948
|
Accept: "text/event-stream"
|
|
3943
3949
|
}),
|
|
3944
3950
|
body: JSON.stringify(t)
|
|
@@ -3992,36 +3998,36 @@ I = new WeakMap(), Ge = new WeakMap(), be = new WeakSet(), _s = function(e, t, r
|
|
|
3992
3998
|
}
|
|
3993
3999
|
switch (b.type) {
|
|
3994
4000
|
case "queueing": {
|
|
3995
|
-
typeof
|
|
4001
|
+
typeof s == "function" ? s(b) : (v = s.onQueueing) == null || v.call(s);
|
|
3996
4002
|
break;
|
|
3997
4003
|
}
|
|
3998
4004
|
case "start": {
|
|
3999
|
-
a.sessionId = b.sessionId, typeof
|
|
4005
|
+
a.sessionId = b.sessionId, typeof s == "function" ? s(b) : (O = s.onStart) == null || O.call(s, { sessionId: b.sessionId });
|
|
4000
4006
|
break;
|
|
4001
4007
|
}
|
|
4002
4008
|
case "pre_codegen": {
|
|
4003
|
-
n === "codegen" && (typeof
|
|
4009
|
+
n === "codegen" && (typeof s == "function" ? s(b) : (R = s.onPreCodegen) == null || R.call(s, {
|
|
4004
4010
|
message: b.message
|
|
4005
4011
|
}));
|
|
4006
4012
|
break;
|
|
4007
4013
|
}
|
|
4008
4014
|
case "assets_uploaded": {
|
|
4009
|
-
typeof
|
|
4015
|
+
typeof s == "function" ? s(b) : (L = s.onAssetsUploaded) == null || L.call(s);
|
|
4010
4016
|
break;
|
|
4011
4017
|
}
|
|
4012
4018
|
case "assets_list": {
|
|
4013
|
-
a.assets = b.payload.assets, typeof
|
|
4019
|
+
a.assets = b.payload.assets, typeof s == "function" ? s(b) : (W = s.onAssetsList) == null || W.call(s, b.payload);
|
|
4014
4020
|
break;
|
|
4015
4021
|
}
|
|
4016
4022
|
case "figma_metadata": {
|
|
4017
|
-
n === "codegen" && (a.figmaFileName = b.figmaFileName, a.figmaSelectedFrameName = b.figmaSelectedFrameName, typeof
|
|
4023
|
+
n === "codegen" && (a.figmaFileName = b.figmaFileName, a.figmaSelectedFrameName = b.figmaSelectedFrameName, typeof s == "function" ? s(b) : (te = s.onFigmaMetadata) == null || te.call(s, {
|
|
4018
4024
|
figmaFileName: b.figmaFileName,
|
|
4019
4025
|
figmaSelectedFrameName: b.figmaSelectedFrameName
|
|
4020
4026
|
}));
|
|
4021
4027
|
break;
|
|
4022
4028
|
}
|
|
4023
4029
|
case "generating_code": {
|
|
4024
|
-
b.payload.status === "success" && (a.files = b.payload.files), typeof
|
|
4030
|
+
b.payload.status === "success" && (a.files = b.payload.files), typeof s == "function" ? s(b) : (he = s.onGeneratingCode) == null || he.call(s, {
|
|
4025
4031
|
status: b.payload.status,
|
|
4026
4032
|
progress: b.payload.progress,
|
|
4027
4033
|
files: b.payload.files
|
|
@@ -4030,7 +4036,7 @@ I = new WeakMap(), Ge = new WeakMap(), be = new WeakSet(), _s = function(e, t, r
|
|
|
4030
4036
|
}
|
|
4031
4037
|
case "codegen_completed":
|
|
4032
4038
|
case "generation_completed": {
|
|
4033
|
-
typeof
|
|
4039
|
+
typeof s == "function" ? s(b) : (ie = s.onCodegenCompleted) == null || ie.call(s);
|
|
4034
4040
|
break;
|
|
4035
4041
|
}
|
|
4036
4042
|
case "error":
|
|
@@ -4059,50 +4065,50 @@ I = new WeakMap(), Ge = new WeakMap(), be = new WeakSet(), _s = function(e, t, r
|
|
|
4059
4065
|
});
|
|
4060
4066
|
});
|
|
4061
4067
|
};
|
|
4062
|
-
const Qn = (
|
|
4068
|
+
const Qn = (r) => {
|
|
4063
4069
|
var e;
|
|
4064
|
-
if (!
|
|
4070
|
+
if (!r)
|
|
4065
4071
|
return [!1, "", ""];
|
|
4066
4072
|
try {
|
|
4067
|
-
const t = new URL(
|
|
4073
|
+
const t = new URL(r), s = t.pathname;
|
|
4068
4074
|
if (t.origin !== "https://www.figma.com")
|
|
4069
4075
|
return [!1, "", ""];
|
|
4070
4076
|
const n = t.toString();
|
|
4071
|
-
if (
|
|
4077
|
+
if (r !== n)
|
|
4072
4078
|
return [!1, "", ""];
|
|
4073
|
-
const a = ((e = t.searchParams.get("node-id")) != null ? e : "").replace(/-/g, ":"), i =
|
|
4074
|
-
return [(
|
|
4079
|
+
const a = ((e = t.searchParams.get("node-id")) != null ? e : "").replace(/-/g, ":"), i = s.split("/")[2];
|
|
4080
|
+
return [(s.startsWith("/file/") && t.searchParams.get("type") !== "whiteboard" || s.startsWith("/design/")) && i.length === 22, i, a];
|
|
4075
4081
|
} catch (t) {
|
|
4076
4082
|
return [!1, "", ""];
|
|
4077
4083
|
}
|
|
4078
4084
|
}, ea = ({
|
|
4079
|
-
fileKey:
|
|
4085
|
+
fileKey: r,
|
|
4080
4086
|
nodeId: e,
|
|
4081
4087
|
duplicate: t
|
|
4082
4088
|
}) => {
|
|
4083
|
-
const
|
|
4084
|
-
return
|
|
4089
|
+
const s = new URL("https://www.figma.com");
|
|
4090
|
+
return s.pathname = `design/${r}`, t && (s.pathname = `${s.pathname}/duplicate`), e && s.searchParams.set("node-id", e.replace(":", "-")), s;
|
|
4085
4091
|
};
|
|
4086
4092
|
class ta extends Error {
|
|
4087
4093
|
constructor(e, t) {
|
|
4088
4094
|
super(e), this.response = t;
|
|
4089
4095
|
}
|
|
4090
4096
|
}
|
|
4091
|
-
const
|
|
4092
|
-
files:
|
|
4097
|
+
const ra = ({
|
|
4098
|
+
files: r,
|
|
4093
4099
|
screenPath: e = "src/screens"
|
|
4094
4100
|
}) => {
|
|
4095
|
-
const t = {},
|
|
4101
|
+
const t = {}, s = /* @__PURE__ */ new Set();
|
|
4096
4102
|
function n(a) {
|
|
4097
|
-
if (
|
|
4103
|
+
if (s.has(a) || !r[a])
|
|
4098
4104
|
return;
|
|
4099
|
-
|
|
4105
|
+
s.add(a), t[a] = r[a], zn(r[a].content).forEach((o) => {
|
|
4100
4106
|
try {
|
|
4101
4107
|
const c = Wn(a, o);
|
|
4102
4108
|
if (c.startsWith("src/")) {
|
|
4103
4109
|
const u = c.split("/").slice(0, -1).join("/");
|
|
4104
|
-
Bn(
|
|
4105
|
-
|
|
4110
|
+
Bn(r, u).forEach((v) => {
|
|
4111
|
+
s.has(v) || n(v);
|
|
4106
4112
|
});
|
|
4107
4113
|
}
|
|
4108
4114
|
} catch (c) {
|
|
@@ -4113,45 +4119,45 @@ const sa = ({
|
|
|
4113
4119
|
}
|
|
4114
4120
|
});
|
|
4115
4121
|
}
|
|
4116
|
-
return Object.entries(
|
|
4122
|
+
return Object.entries(r).forEach(([a, i]) => {
|
|
4117
4123
|
a.startsWith(e) ? n(a) : a.startsWith("src/") || (t[a] = i);
|
|
4118
4124
|
}), t;
|
|
4119
4125
|
};
|
|
4120
|
-
function zn(
|
|
4121
|
-
const e = /import.*?["']([^"']+)["']/g, t = /export.*from\s+["']([^"']+)["']/g,
|
|
4126
|
+
function zn(r) {
|
|
4127
|
+
const e = /import.*?["']([^"']+)["']/g, t = /export.*from\s+["']([^"']+)["']/g, s = [];
|
|
4122
4128
|
let n;
|
|
4123
|
-
for (; (n = e.exec(
|
|
4124
|
-
|
|
4125
|
-
for (; (n = t.exec(
|
|
4126
|
-
|
|
4127
|
-
return [...new Set(
|
|
4129
|
+
for (; (n = e.exec(r)) !== null; )
|
|
4130
|
+
s.push(n[1]);
|
|
4131
|
+
for (; (n = t.exec(r)) !== null; )
|
|
4132
|
+
s.push(n[1]);
|
|
4133
|
+
return [...new Set(s)];
|
|
4128
4134
|
}
|
|
4129
|
-
function Wn(
|
|
4135
|
+
function Wn(r, e) {
|
|
4130
4136
|
if (!e.startsWith("."))
|
|
4131
4137
|
return e;
|
|
4132
|
-
const t =
|
|
4133
|
-
for (const a of
|
|
4138
|
+
const t = r.split("/").slice(0, -1), s = e.split("/"), n = [...t];
|
|
4139
|
+
for (const a of s)
|
|
4134
4140
|
a === ".." ? n.pop() : a !== "." && n.push(a);
|
|
4135
4141
|
return n.join("/");
|
|
4136
4142
|
}
|
|
4137
|
-
function Bn(
|
|
4138
|
-
return Object.keys(
|
|
4143
|
+
function Bn(r, e) {
|
|
4144
|
+
return Object.keys(r).filter((t) => t.startsWith(e));
|
|
4139
4145
|
}
|
|
4140
|
-
function
|
|
4146
|
+
function br(r, e, t) {
|
|
4141
4147
|
return new ReadableStream({
|
|
4142
|
-
start(
|
|
4143
|
-
t.call(
|
|
4144
|
-
n.type === "error" ||
|
|
4148
|
+
start(s) {
|
|
4149
|
+
t.call(r, e, (n) => {
|
|
4150
|
+
n.type === "error" || s.enqueue(n), (n.type === "aborted" || n.type === "error") && s.close();
|
|
4145
4151
|
}).then((n) => {
|
|
4146
|
-
|
|
4152
|
+
s.enqueue({
|
|
4147
4153
|
type: "done",
|
|
4148
4154
|
payload: {
|
|
4149
4155
|
tokenUsage: n.tokenUsage,
|
|
4150
4156
|
sessionId: n.sessionId
|
|
4151
4157
|
}
|
|
4152
|
-
}),
|
|
4158
|
+
}), s.close();
|
|
4153
4159
|
}).catch((n) => {
|
|
4154
|
-
|
|
4160
|
+
s.enqueue({
|
|
4155
4161
|
type: "error",
|
|
4156
4162
|
payload: {
|
|
4157
4163
|
name: "name" in n ? n.name : "Unknown error",
|
|
@@ -4160,23 +4166,23 @@ function bs(s, e, t) {
|
|
|
4160
4166
|
detail: "detail" in n ? n.detail : void 0,
|
|
4161
4167
|
errorPayload: "payload" in n ? n.payload : void 0
|
|
4162
4168
|
}
|
|
4163
|
-
}),
|
|
4169
|
+
}), s.close();
|
|
4164
4170
|
});
|
|
4165
4171
|
}
|
|
4166
4172
|
});
|
|
4167
4173
|
}
|
|
4168
|
-
const qn = (
|
|
4169
|
-
|
|
4174
|
+
const qn = (r, e) => br(
|
|
4175
|
+
r,
|
|
4170
4176
|
e,
|
|
4171
|
-
|
|
4177
|
+
r.generateCode
|
|
4172
4178
|
);
|
|
4173
|
-
function
|
|
4174
|
-
return
|
|
4179
|
+
function wr(r) {
|
|
4180
|
+
return C(this, null, function* () {
|
|
4175
4181
|
var i, o, c, u;
|
|
4176
|
-
const [e, t] =
|
|
4177
|
-
if (
|
|
4178
|
-
return new Response(JSON.stringify(
|
|
4179
|
-
status: ((o =
|
|
4182
|
+
const [e, t] = r.tee(), s = yield e.getReader().read();
|
|
4183
|
+
if (s.done || !s.value || s.value.type === "error" && ((i = s.value.payload) != null && i.status))
|
|
4184
|
+
return new Response(JSON.stringify(s.value), {
|
|
4185
|
+
status: ((o = s.value) == null ? void 0 : o.type) === "error" && (u = (c = s.value.payload) == null ? void 0 : c.status) != null ? u : 500,
|
|
4180
4186
|
headers: {
|
|
4181
4187
|
"Content-Type": "application/json"
|
|
4182
4188
|
}
|
|
@@ -4204,44 +4210,44 @@ data: ${JSON.stringify(
|
|
|
4204
4210
|
});
|
|
4205
4211
|
});
|
|
4206
4212
|
}
|
|
4207
|
-
const
|
|
4208
|
-
const t = qn(
|
|
4209
|
-
return
|
|
4210
|
-
}), Hn = (
|
|
4211
|
-
|
|
4213
|
+
const sa = (r, e) => C(void 0, null, function* () {
|
|
4214
|
+
const t = qn(r, e);
|
|
4215
|
+
return wr(t);
|
|
4216
|
+
}), Hn = (r, e) => br(
|
|
4217
|
+
r,
|
|
4212
4218
|
e,
|
|
4213
|
-
|
|
4214
|
-
), na = (
|
|
4215
|
-
const t = Hn(
|
|
4216
|
-
return
|
|
4219
|
+
r.generateLink2Code
|
|
4220
|
+
), na = (r, e) => C(void 0, null, function* () {
|
|
4221
|
+
const t = Hn(r, e);
|
|
4222
|
+
return wr(t);
|
|
4217
4223
|
});
|
|
4218
4224
|
export {
|
|
4219
4225
|
Yn as Anima,
|
|
4220
4226
|
oe as CodegenError,
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4227
|
+
Ar as FigmaTokenIssue,
|
|
4228
|
+
Ir as NotFound,
|
|
4229
|
+
Cr as RateLimitExceeded,
|
|
4230
|
+
Or as RequestTooLarge,
|
|
4225
4231
|
ta as ResponseError,
|
|
4226
|
-
|
|
4227
|
-
|
|
4232
|
+
jr as UnknownFigmaApiException,
|
|
4233
|
+
sa as createCodegenResponseEventStream,
|
|
4228
4234
|
qn as createCodegenStream,
|
|
4229
4235
|
na as createLink2CodeResponseEventStream,
|
|
4230
4236
|
Hn as createLink2CodeStream,
|
|
4231
|
-
|
|
4237
|
+
cr as findChildrenNode,
|
|
4232
4238
|
ea as formatToFigmaLink,
|
|
4233
4239
|
Kn as getFigmaApiErrorType,
|
|
4234
|
-
|
|
4240
|
+
Is as getFigmaFile,
|
|
4235
4241
|
Xn as getFileNodes,
|
|
4236
|
-
|
|
4237
|
-
|
|
4242
|
+
ra as getRelatedScreenFiles,
|
|
4243
|
+
Zr as isFigmaTokenIssue,
|
|
4238
4244
|
Un as isNodeCodegenCompatible,
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4245
|
+
Nr as isNotFound,
|
|
4246
|
+
Rr as isRateLimitExceeded,
|
|
4247
|
+
Mr as isRequestTooLarge,
|
|
4242
4248
|
Gn as isUnknownFigmaApiException,
|
|
4243
4249
|
Qn as isValidFigmaUrl,
|
|
4244
4250
|
Vn as validateSettings,
|
|
4245
|
-
|
|
4251
|
+
rr as wrapFigmaApiError
|
|
4246
4252
|
};
|
|
4247
4253
|
//# sourceMappingURL=index.js.map
|