@animaapp/anima-sdk-react 0.6.7 → 0.6.9
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 +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1029 -1021
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var ia = Object.defineProperty, oa = Object.defineProperties;
|
|
2
|
+
var ca = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var zs = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var Ks = (t, e, n) => e in t ?
|
|
4
|
+
var ua = Object.prototype.hasOwnProperty, da = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Ks = (t, e, n) => e in t ? ia(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Ke = (t, e) => {
|
|
6
6
|
for (var n in e || (e = {}))
|
|
7
|
-
|
|
7
|
+
ua.call(e, n) && Ks(t, n, e[n]);
|
|
8
8
|
if (zs)
|
|
9
9
|
for (var n of zs(e))
|
|
10
|
-
|
|
10
|
+
da.call(e, n) && Ks(t, n, e[n]);
|
|
11
11
|
return t;
|
|
12
|
-
}, Bs = (t, e) =>
|
|
12
|
+
}, Bs = (t, e) => oa(t, ca(e));
|
|
13
13
|
var Ie = (t, e, n) => new Promise((s, r) => {
|
|
14
14
|
var a = (c) => {
|
|
15
15
|
try {
|
|
@@ -26,22 +26,22 @@ var Ie = (t, e, n) => new Promise((s, r) => {
|
|
|
26
26
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
27
27
|
o((n = n.apply(t, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import Gt, { useState as
|
|
30
|
-
const
|
|
29
|
+
import Gt, { useState as la, useCallback as rn, createContext as fa, useEffect as ha, useLayoutEffect as pa, useContext as ma, useRef as Be, useMemo as ya, useDebugValue as ga } from "react";
|
|
30
|
+
const va = (t) => {
|
|
31
31
|
let e = "";
|
|
32
32
|
const n = new Uint8Array(t), s = n.byteLength;
|
|
33
33
|
for (let r = 0; r < s; r++)
|
|
34
34
|
e += String.fromCharCode(n[r]);
|
|
35
35
|
return btoa(e);
|
|
36
36
|
};
|
|
37
|
-
var
|
|
37
|
+
var _a = Object.defineProperty, ba = Object.defineProperties, wa = Object.getOwnPropertyDescriptors, qs = Object.getOwnPropertySymbols, ka = Object.prototype.hasOwnProperty, Ea = Object.prototype.propertyIsEnumerable, Hs = (t, e, n) => e in t ? _a(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, d = (t, e) => {
|
|
38
38
|
for (var n in e || (e = {}))
|
|
39
|
-
|
|
39
|
+
ka.call(e, n) && Hs(t, n, e[n]);
|
|
40
40
|
if (qs)
|
|
41
41
|
for (var n of qs(e))
|
|
42
|
-
|
|
42
|
+
Ea.call(e, n) && Hs(t, n, e[n]);
|
|
43
43
|
return t;
|
|
44
|
-
},
|
|
44
|
+
}, x = (t, e) => ba(t, wa(e)), ke = (t, e, n) => new Promise((s, r) => {
|
|
45
45
|
var a = (c) => {
|
|
46
46
|
try {
|
|
47
47
|
o(n.next(c));
|
|
@@ -68,7 +68,7 @@ class Gs extends Error {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
const xa = "Figma Token Issue";
|
|
71
|
-
class
|
|
71
|
+
class Sa extends Error {
|
|
72
72
|
constructor({
|
|
73
73
|
fileKey: e,
|
|
74
74
|
reason: n,
|
|
@@ -77,59 +77,59 @@ class Ea extends Error {
|
|
|
77
77
|
super(xa), this.fileKey = e, this.reason = n, this.cause = s;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
const
|
|
81
|
-
class
|
|
80
|
+
const Oa = "Rate Limit Exceeded";
|
|
81
|
+
class Ta extends Error {
|
|
82
82
|
constructor({ fileKey: e, cause: n }) {
|
|
83
|
-
super(
|
|
83
|
+
super(Oa), this.fileKey = e, this.cause = n;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
const
|
|
87
|
-
class
|
|
86
|
+
const Ca = "Request Too Large";
|
|
87
|
+
class Aa extends Error {
|
|
88
88
|
constructor({ fileKey: e, cause: n }) {
|
|
89
|
-
super(
|
|
89
|
+
super(Ca), this.fileKey = e, this.cause = n;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
const
|
|
93
|
-
class
|
|
92
|
+
const Na = "Not Found";
|
|
93
|
+
class Ra extends Error {
|
|
94
94
|
constructor({ fileKey: e, cause: n }) {
|
|
95
|
-
super(
|
|
95
|
+
super(Na), this.fileKey = e, this.cause = n;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
const
|
|
99
|
-
class
|
|
98
|
+
const Pa = "Unknown Figma API Exception";
|
|
99
|
+
class Ia extends Error {
|
|
100
100
|
constructor({ fileKey: e, cause: n }) {
|
|
101
|
-
super(
|
|
101
|
+
super(Pa), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = n;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
const
|
|
104
|
+
const ja = (t, e) => {
|
|
105
105
|
var n;
|
|
106
106
|
if (((n = t == null ? void 0 : t.cause) == null ? void 0 : n.message) === "Fetch Error") {
|
|
107
107
|
const { err: s, status: r } = t.cause.body;
|
|
108
108
|
if (r === 403)
|
|
109
|
-
return new
|
|
109
|
+
return new Sa({
|
|
110
110
|
fileKey: e,
|
|
111
111
|
reason: s,
|
|
112
112
|
cause: t
|
|
113
113
|
});
|
|
114
114
|
if (r === 429)
|
|
115
|
-
return new
|
|
115
|
+
return new Ta({ fileKey: e, cause: t });
|
|
116
116
|
if (r === 404)
|
|
117
|
-
return new
|
|
117
|
+
return new Ra({ fileKey: e, cause: t });
|
|
118
118
|
if (r === 400 && s.includes("Request too large"))
|
|
119
|
-
return new
|
|
119
|
+
return new Aa({ fileKey: e, cause: t });
|
|
120
120
|
}
|
|
121
|
-
return new
|
|
121
|
+
return new Ia({ fileKey: e, cause: t });
|
|
122
122
|
};
|
|
123
|
-
var
|
|
123
|
+
var Za = Object.defineProperty, Da = Object.defineProperties, Ma = Object.getOwnPropertyDescriptors, Js = Object.getOwnPropertySymbols, La = Object.prototype.hasOwnProperty, $a = Object.prototype.propertyIsEnumerable, Xs = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), Tr = (t) => {
|
|
124
124
|
throw TypeError(t);
|
|
125
|
-
}, Ys = (t, e, n) => e in t ?
|
|
125
|
+
}, Ys = (t, e, n) => e in t ? Za(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, ae = (t, e) => {
|
|
126
126
|
for (var n in e || (e = {}))
|
|
127
|
-
|
|
127
|
+
La.call(e, n) && Ys(t, n, e[n]);
|
|
128
128
|
if (Js)
|
|
129
129
|
for (var n of Js(e))
|
|
130
|
-
|
|
130
|
+
$a.call(e, n) && Ys(t, n, e[n]);
|
|
131
131
|
return t;
|
|
132
|
-
}, Ts = (t, e) =>
|
|
132
|
+
}, Ts = (t, e) => Da(t, Ma(e)), Cs = (t, e, n) => e.has(t) || Tr("Cannot " + n), j = (t, e, n) => (Cs(t, e, "read from private field"), n ? n.call(t) : e.get(t)), de = (t, e, n) => e.has(t) ? Tr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), J = (t, e, n, s) => (Cs(t, e, "write to private field"), e.set(t, n), n), _e = (t, e, n) => (Cs(t, e, "access private method"), n), B = (t, e, n) => new Promise((s, r) => {
|
|
133
133
|
var a = (c) => {
|
|
134
134
|
try {
|
|
135
135
|
o(n.next(c));
|
|
@@ -144,21 +144,21 @@ var ja = Object.defineProperty, Za = Object.defineProperties, Da = Object.getOwn
|
|
|
144
144
|
}
|
|
145
145
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
146
146
|
o((n = n.apply(t, e)).next());
|
|
147
|
-
}), Fa = (t, e, n) => (e = t[Xs("asyncIterator")]) ? e.call(t) : (t = t[Xs("iterator")](), e = {}, n = (s, r) => (r = t[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = r.call(t, a), c = a.done, Promise.resolve(a.value).then((u) => i({ value: u, done: c }), o)))), n("next"), n("return"), e),
|
|
148
|
-
function
|
|
147
|
+
}), Fa = (t, e, n) => (e = t[Xs("asyncIterator")]) ? e.call(t) : (t = t[Xs("iterator")](), e = {}, n = (s, r) => (r = t[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = r.call(t, a), c = a.done, Promise.resolve(a.value).then((u) => i({ value: u, done: c }), o)))), n("next"), n("return"), e), Wa = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
148
|
+
function Ua(t) {
|
|
149
149
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
150
150
|
}
|
|
151
151
|
var Bn = { exports: {} }, Va = Bn.exports, Qs;
|
|
152
|
-
function
|
|
152
|
+
function za() {
|
|
153
153
|
return Qs || (Qs = 1, function(t, e) {
|
|
154
154
|
(function(n, s) {
|
|
155
155
|
t.exports = s();
|
|
156
156
|
})(Va, function() {
|
|
157
|
-
var n = typeof Promise == "function", s = typeof self == "object" ? self :
|
|
158
|
-
function
|
|
159
|
-
var
|
|
160
|
-
if (
|
|
161
|
-
return
|
|
157
|
+
var n = typeof Promise == "function", s = typeof self == "object" ? self : Wa, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", h = r && typeof Symbol.iterator != "undefined", p = r && typeof Symbol.toStringTag != "undefined", k = i && typeof Set.prototype.entries == "function", g = a && typeof Map.prototype.entries == "function", b = k && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), m = g && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), _ = h && typeof Array.prototype[Symbol.iterator] == "function", l = _ && Object.getPrototypeOf([][Symbol.iterator]()), A = h && typeof String.prototype[Symbol.iterator] == "function", I = A && Object.getPrototypeOf(""[Symbol.iterator]()), V = 8, M = -1;
|
|
158
|
+
function z(Z) {
|
|
159
|
+
var P = typeof Z;
|
|
160
|
+
if (P !== "object")
|
|
161
|
+
return P;
|
|
162
162
|
if (Z === null)
|
|
163
163
|
return "null";
|
|
164
164
|
if (Z === s)
|
|
@@ -189,14 +189,14 @@ function Ua() {
|
|
|
189
189
|
if (typeof Se == "string")
|
|
190
190
|
return Se;
|
|
191
191
|
var F = Object.getPrototypeOf(Z);
|
|
192
|
-
return F === RegExp.prototype ? "RegExp" : F === Date.prototype ? "Date" : n && F === Promise.prototype ? "Promise" : i && F === Set.prototype ? "Set" : a && F === Map.prototype ? "Map" : c && F === WeakSet.prototype ? "WeakSet" : o && F === WeakMap.prototype ? "WeakMap" : u && F === DataView.prototype ? "DataView" : a && F ===
|
|
192
|
+
return F === RegExp.prototype ? "RegExp" : F === Date.prototype ? "Date" : n && F === Promise.prototype ? "Promise" : i && F === Set.prototype ? "Set" : a && F === Map.prototype ? "Map" : c && F === WeakSet.prototype ? "WeakSet" : o && F === WeakMap.prototype ? "WeakMap" : u && F === DataView.prototype ? "DataView" : a && F === m ? "Map Iterator" : i && F === b ? "Set Iterator" : _ && F === l ? "Array Iterator" : A && F === I ? "String Iterator" : F === null ? "Object" : Object.prototype.toString.call(Z).slice(V, M);
|
|
193
193
|
}
|
|
194
|
-
return
|
|
194
|
+
return z;
|
|
195
195
|
});
|
|
196
196
|
}(Bn)), Bn.exports;
|
|
197
197
|
}
|
|
198
|
-
var
|
|
199
|
-
const
|
|
198
|
+
var Ka = za();
|
|
199
|
+
const Ba = /* @__PURE__ */ Ua(Ka), As = typeof Buffer != "undefined", qa = As && typeof Buffer.from != "undefined", Ha = As ? (
|
|
200
200
|
/**
|
|
201
201
|
* is value is Buffer?
|
|
202
202
|
*
|
|
@@ -217,7 +217,7 @@ const Ka = /* @__PURE__ */ Wa(za), As = typeof Buffer != "undefined", Ba = As &&
|
|
|
217
217
|
function() {
|
|
218
218
|
return !1;
|
|
219
219
|
}
|
|
220
|
-
),
|
|
220
|
+
), Ga = qa ? (
|
|
221
221
|
/**
|
|
222
222
|
* copy Buffer
|
|
223
223
|
*
|
|
@@ -253,16 +253,16 @@ const Ka = /* @__PURE__ */ Wa(za), As = typeof Buffer != "undefined", Ba = As &&
|
|
|
253
253
|
}
|
|
254
254
|
);
|
|
255
255
|
function mt(t) {
|
|
256
|
-
return
|
|
256
|
+
return Ha(t) ? "Buffer" : Ba(t);
|
|
257
257
|
}
|
|
258
|
-
const
|
|
258
|
+
const Ja = /* @__PURE__ */ new Set([
|
|
259
259
|
"Arguments",
|
|
260
260
|
"Array",
|
|
261
261
|
"Map",
|
|
262
262
|
"Object",
|
|
263
263
|
"Set"
|
|
264
264
|
]);
|
|
265
|
-
function
|
|
265
|
+
function Xa(t, e, n = null) {
|
|
266
266
|
switch (n || mt(t)) {
|
|
267
267
|
case "Arguments":
|
|
268
268
|
case "Array":
|
|
@@ -275,7 +275,7 @@ function Ja(t, e, n = null) {
|
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
function qn(t) {
|
|
278
|
-
return
|
|
278
|
+
return Ja.has(t);
|
|
279
279
|
}
|
|
280
280
|
function er(t, e, n, s = null) {
|
|
281
281
|
switch (s || mt(t)) {
|
|
@@ -293,29 +293,29 @@ function er(t, e, n, s = null) {
|
|
|
293
293
|
}
|
|
294
294
|
return t;
|
|
295
295
|
}
|
|
296
|
-
const
|
|
297
|
-
function ei(t) {
|
|
298
|
-
return t.slice(0);
|
|
299
|
-
}
|
|
296
|
+
const Ya = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, Qa = typeof global != "undefined" && global !== null && global.Object === Object && global, ei = typeof self != "undefined" && self !== null && self.Object === Object && self, Rn = Ya || Qa || ei || Function("return this")();
|
|
300
297
|
function ti(t) {
|
|
301
|
-
return
|
|
298
|
+
return t.slice(0);
|
|
302
299
|
}
|
|
303
300
|
function ni(t) {
|
|
304
|
-
return new
|
|
301
|
+
return new Boolean(t.valueOf());
|
|
305
302
|
}
|
|
306
303
|
function si(t) {
|
|
307
|
-
return
|
|
304
|
+
return new DataView(t.buffer);
|
|
308
305
|
}
|
|
309
306
|
function ri(t) {
|
|
310
|
-
return
|
|
307
|
+
return Ga(t);
|
|
311
308
|
}
|
|
312
309
|
function ai(t) {
|
|
313
|
-
return new
|
|
310
|
+
return new Date(t.getTime());
|
|
314
311
|
}
|
|
315
312
|
function ii(t) {
|
|
316
|
-
return new
|
|
313
|
+
return new Number(t);
|
|
317
314
|
}
|
|
318
315
|
function oi(t) {
|
|
316
|
+
return new RegExp(t.source, t.flags);
|
|
317
|
+
}
|
|
318
|
+
function ci(t) {
|
|
319
319
|
return new String(t);
|
|
320
320
|
}
|
|
321
321
|
function Ce(t, e) {
|
|
@@ -327,25 +327,25 @@ function Q(t) {
|
|
|
327
327
|
function tr() {
|
|
328
328
|
return [];
|
|
329
329
|
}
|
|
330
|
-
function
|
|
330
|
+
function ui() {
|
|
331
331
|
return /* @__PURE__ */ new Map();
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function di() {
|
|
334
334
|
return {};
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function li() {
|
|
337
337
|
return /* @__PURE__ */ new Set();
|
|
338
338
|
}
|
|
339
|
-
const
|
|
339
|
+
const fi = /* @__PURE__ */ new Map([
|
|
340
340
|
// deep copy
|
|
341
|
-
["ArrayBuffer",
|
|
342
|
-
["Boolean",
|
|
343
|
-
["Buffer",
|
|
344
|
-
["DataView",
|
|
345
|
-
["Date",
|
|
346
|
-
["Number",
|
|
347
|
-
["RegExp",
|
|
348
|
-
["String",
|
|
341
|
+
["ArrayBuffer", ti],
|
|
342
|
+
["Boolean", ni],
|
|
343
|
+
["Buffer", ri],
|
|
344
|
+
["DataView", si],
|
|
345
|
+
["Date", ai],
|
|
346
|
+
["Number", ii],
|
|
347
|
+
["RegExp", oi],
|
|
348
|
+
["String", ci],
|
|
349
349
|
// typed arrays
|
|
350
350
|
// TODO: pass bound function
|
|
351
351
|
["Float32Array", Ce],
|
|
@@ -379,9 +379,9 @@ const li = /* @__PURE__ */ new Map([
|
|
|
379
379
|
// NOTE: return empty value, because recursively copy later.
|
|
380
380
|
["Arguments", tr],
|
|
381
381
|
["Array", tr],
|
|
382
|
-
["Map",
|
|
383
|
-
["Object",
|
|
384
|
-
["Set",
|
|
382
|
+
["Map", ui],
|
|
383
|
+
["Object", di],
|
|
384
|
+
["Set", li]
|
|
385
385
|
// NOTE: type-detect returns following types
|
|
386
386
|
// 'Location'
|
|
387
387
|
// 'Document'
|
|
@@ -393,11 +393,11 @@ const li = /* @__PURE__ */ new Map([
|
|
|
393
393
|
// TODO: is type-detect never return 'object'?
|
|
394
394
|
// 'object'
|
|
395
395
|
]);
|
|
396
|
-
function
|
|
396
|
+
function hi() {
|
|
397
397
|
}
|
|
398
|
-
function Hn(t, e = null, n =
|
|
398
|
+
function Hn(t, e = null, n = hi) {
|
|
399
399
|
arguments.length === 2 && typeof e == "function" && (n = e, e = null);
|
|
400
|
-
const s = e || mt(t), r =
|
|
400
|
+
const s = e || mt(t), r = fi.get(s);
|
|
401
401
|
if (s === "Object") {
|
|
402
402
|
const a = n(t, s);
|
|
403
403
|
if (a !== void 0)
|
|
@@ -439,7 +439,7 @@ function Gn(t, e, n, s, r) {
|
|
|
439
439
|
break;
|
|
440
440
|
}
|
|
441
441
|
for (let c of o) {
|
|
442
|
-
const u =
|
|
442
|
+
const u = Xa(t, c, a);
|
|
443
443
|
if (s.has(u))
|
|
444
444
|
er(e, c, n.get(u), a);
|
|
445
445
|
else {
|
|
@@ -459,33 +459,33 @@ function Gn(t, e, n, s, r) {
|
|
|
459
459
|
}
|
|
460
460
|
return e;
|
|
461
461
|
}
|
|
462
|
-
const
|
|
463
|
-
var an, He, on, Jn,
|
|
464
|
-
class
|
|
462
|
+
const pi = (t) => new Promise((e) => setTimeout(e, t));
|
|
463
|
+
var an, He, on, Jn, Cr;
|
|
464
|
+
class mi {
|
|
465
465
|
constructor({ maxAttempts: e = 3, func: n }) {
|
|
466
466
|
de(this, Jn), de(this, an), de(this, He), de(this, on), J(this, an, e), J(this, on, n), J(this, He, 0);
|
|
467
467
|
}
|
|
468
468
|
run() {
|
|
469
|
-
return
|
|
469
|
+
return B(this, null, function* () {
|
|
470
470
|
try {
|
|
471
|
-
return yield
|
|
471
|
+
return yield j(this, on).call(this);
|
|
472
472
|
} catch (e) {
|
|
473
|
-
if (J(this, He,
|
|
473
|
+
if (J(this, He, j(this, He) + 1), j(this, He) > j(this, an))
|
|
474
474
|
throw console.error("Max attempts reached"), e;
|
|
475
|
-
const n = _e(this, Jn,
|
|
476
|
-
return yield
|
|
475
|
+
const n = _e(this, Jn, Cr).call(this);
|
|
476
|
+
return yield pi(n), yield this.run();
|
|
477
477
|
}
|
|
478
478
|
});
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
an = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), on = /* @__PURE__ */ new WeakMap(), Jn = /* @__PURE__ */ new WeakSet(),
|
|
482
|
-
return
|
|
481
|
+
an = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), on = /* @__PURE__ */ new WeakMap(), Jn = /* @__PURE__ */ new WeakSet(), Cr = function() {
|
|
482
|
+
return j(this, He) * 1e3 * 1.5;
|
|
483
483
|
};
|
|
484
|
-
function
|
|
484
|
+
function yi() {
|
|
485
485
|
return typeof CompressionStream != "undefined";
|
|
486
486
|
}
|
|
487
|
-
function
|
|
488
|
-
return
|
|
487
|
+
function gi(t) {
|
|
488
|
+
return B(this, null, function* () {
|
|
489
489
|
const e = new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")), n = [];
|
|
490
490
|
try {
|
|
491
491
|
for (var s = Fa(e), r, a, i; r = !(a = yield s.next()).done; r = !1) {
|
|
@@ -502,16 +502,16 @@ function yi(t) {
|
|
|
502
502
|
throw i[0];
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
return yield
|
|
505
|
+
return yield vi(n);
|
|
506
506
|
});
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
return
|
|
508
|
+
function vi(t) {
|
|
509
|
+
return B(this, null, function* () {
|
|
510
510
|
const e = yield new Blob(t).arrayBuffer();
|
|
511
511
|
return new Uint8Array(e);
|
|
512
512
|
});
|
|
513
513
|
}
|
|
514
|
-
class
|
|
514
|
+
class _i extends Error {
|
|
515
515
|
constructor({ resource: e, api: n, args: s, cause: r }) {
|
|
516
516
|
if (super(`API Error on resource "${e}" at api "${n}"`), this.causeProperties = {}, this.name = "API Error", this.resource = e, this.api = n, this.cause = r, this.args = s, r instanceof Error)
|
|
517
517
|
for (const [i, o] of Object.entries(r))
|
|
@@ -544,13 +544,13 @@ class nr extends Error {
|
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
|
-
class
|
|
547
|
+
class Et extends Error {
|
|
548
548
|
constructor(e = {}) {
|
|
549
549
|
const { canceled: n = !1 } = e;
|
|
550
550
|
super("Abort Error"), this.name = "Abort Error", this.canceled = n;
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
|
-
class
|
|
553
|
+
class bi extends Error {
|
|
554
554
|
constructor(e) {
|
|
555
555
|
super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
|
|
556
556
|
}
|
|
@@ -560,7 +560,7 @@ class Pn extends Error {
|
|
|
560
560
|
super(e), this.name = "Request Validation Error";
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function Ar() {
|
|
564
564
|
return Array.from(
|
|
565
565
|
{ length: 32 },
|
|
566
566
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
@@ -569,9 +569,9 @@ function Cr() {
|
|
|
569
569
|
function Xn() {
|
|
570
570
|
return Math.floor(Date.now() / 1e3).toString();
|
|
571
571
|
}
|
|
572
|
-
const
|
|
573
|
-
var Ge, ne, ge, Yn, Qn,
|
|
574
|
-
class
|
|
572
|
+
const wi = 5 * 60 * 1e3, ki = 1 * 1e3;
|
|
573
|
+
var Ge, ne, ge, Yn, Qn, xt;
|
|
574
|
+
class Ei {
|
|
575
575
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: n }) {
|
|
576
576
|
de(this, ge), de(this, Ge), de(this, ne), this.baseAddress = n, J(this, Ge, e), J(this, ne, {}), this.plugins = [];
|
|
577
577
|
}
|
|
@@ -588,51 +588,51 @@ class ki {
|
|
|
588
588
|
return J(this, ne, e), this;
|
|
589
589
|
}
|
|
590
590
|
get(e) {
|
|
591
|
-
return
|
|
591
|
+
return B(this, arguments, function* (n, s = {}) {
|
|
592
592
|
const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
|
|
593
593
|
let o = a != null ? a : this.headers;
|
|
594
|
-
const c = kt(
|
|
595
|
-
return J(this, ne, {}), c.extraHeaders && (o = ae(ae({}, o), c.extraHeaders)), c.requestValidation && (o = Ts(ae({}, o), { "X-Request-Nonce":
|
|
594
|
+
const c = kt(j(this, ne));
|
|
595
|
+
return J(this, ne, {}), c.extraHeaders && (o = ae(ae({}, o), c.extraHeaders)), c.requestValidation && (o = Ts(ae({}, o), { "X-Request-Nonce": Ar(), "X-Request-Timestamp": Xn() })), c.async ? yield _e(this, ge, Qn).call(this, `${i}${n}`, c.async, { headers: o }) : yield _e(this, ge, Yn).call(this, `${i}${n}`, c, { headers: o });
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
598
|
post(e, n) {
|
|
599
|
-
return
|
|
600
|
-
const i = kt(
|
|
601
|
-
return J(this, ne, {}), _e(this, ge,
|
|
599
|
+
return B(this, arguments, function* (s, r, a = {}) {
|
|
600
|
+
const i = kt(j(this, ne));
|
|
601
|
+
return J(this, ne, {}), _e(this, ge, xt).call(this, s, "POST", r, a, i);
|
|
602
602
|
});
|
|
603
603
|
}
|
|
604
604
|
put(e, n) {
|
|
605
|
-
return
|
|
606
|
-
const i = kt(
|
|
607
|
-
return J(this, ne, {}), _e(this, ge,
|
|
605
|
+
return B(this, arguments, function* (s, r, a = {}) {
|
|
606
|
+
const i = kt(j(this, ne));
|
|
607
|
+
return J(this, ne, {}), _e(this, ge, xt).call(this, s, "PUT", r, a, i);
|
|
608
608
|
});
|
|
609
609
|
}
|
|
610
610
|
delete(e, n) {
|
|
611
|
-
return
|
|
612
|
-
const i = kt(
|
|
613
|
-
return J(this, ne, {}), _e(this, ge,
|
|
611
|
+
return B(this, arguments, function* (s, r, a = {}) {
|
|
612
|
+
const i = kt(j(this, ne));
|
|
613
|
+
return J(this, ne, {}), _e(this, ge, xt).call(this, s, "DELETE", r, a, i);
|
|
614
614
|
});
|
|
615
615
|
}
|
|
616
616
|
patch(e, n) {
|
|
617
|
-
return
|
|
618
|
-
const i = kt(
|
|
619
|
-
return J(this, ne, {}), _e(this, ge,
|
|
617
|
+
return B(this, arguments, function* (s, r, a = {}) {
|
|
618
|
+
const i = kt(j(this, ne));
|
|
619
|
+
return J(this, ne, {}), _e(this, ge, xt).call(this, s, "PATCH", r, a, i);
|
|
620
620
|
});
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
623
|
Ge = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakSet(), Yn = function(t, e, n) {
|
|
624
|
-
return
|
|
625
|
-
const s = () =>
|
|
624
|
+
return B(this, null, function* () {
|
|
625
|
+
const s = () => B(this, null, function* () {
|
|
626
626
|
var c, u;
|
|
627
627
|
try {
|
|
628
|
-
return yield
|
|
628
|
+
return yield j(this, Ge).call(this, t, ae(ae({}, n), e.abortSignal && { signal: e.abortSignal }));
|
|
629
629
|
} catch (h) {
|
|
630
|
-
throw h instanceof Error && h.name === "AbortError" ? new
|
|
630
|
+
throw h instanceof Error && h.name === "AbortError" ? new Et({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : h;
|
|
631
631
|
}
|
|
632
632
|
}), { headers: r } = n != null ? n : {}, a = (c, u) => {
|
|
633
633
|
var h, p;
|
|
634
634
|
return ((h = c == null ? void 0 : c.headers) == null ? void 0 : h.get(u)) || ((p = c == null ? void 0 : c.headersObject) == null ? void 0 : p[u]) || "";
|
|
635
|
-
}, i = (c) =>
|
|
635
|
+
}, i = (c) => B(this, null, function* () {
|
|
636
636
|
var u;
|
|
637
637
|
if (!c.ok) {
|
|
638
638
|
const p = yield c.text().catch();
|
|
@@ -650,8 +650,8 @@ Ge = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
650
650
|
const p = a(c, "x-response-nonce"), k = r == null ? void 0 : r["X-Request-Nonce"];
|
|
651
651
|
if (!p || p !== k)
|
|
652
652
|
throw new Pn("Response nonce mismatch");
|
|
653
|
-
const
|
|
654
|
-
if (isNaN(
|
|
653
|
+
const g = Number(a(c, "x-response-timestamp")), b = Number(Xn()), m = 60 * 60 * 24;
|
|
654
|
+
if (isNaN(g) || Math.abs(b - g) > m)
|
|
655
655
|
throw new Pn("Invalid response timestamp");
|
|
656
656
|
} catch (p) {
|
|
657
657
|
const k = p instanceof Error ? p.message : "Request validation failed";
|
|
@@ -665,7 +665,7 @@ Ge = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
665
665
|
return h;
|
|
666
666
|
});
|
|
667
667
|
if (e.retry) {
|
|
668
|
-
const c = yield new
|
|
668
|
+
const c = yield new mi({
|
|
669
669
|
maxAttempts: e.retry,
|
|
670
670
|
func: s
|
|
671
671
|
}).run();
|
|
@@ -675,19 +675,19 @@ Ge = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
675
675
|
return yield i(o);
|
|
676
676
|
});
|
|
677
677
|
}, Qn = function(t, e, n) {
|
|
678
|
-
return
|
|
678
|
+
return B(this, null, function* () {
|
|
679
679
|
var s, r;
|
|
680
680
|
const {
|
|
681
681
|
onProgress: a,
|
|
682
682
|
abortSignal: i,
|
|
683
|
-
pollingInterval: o = () =>
|
|
684
|
-
maxTimeout: c =
|
|
683
|
+
pollingInterval: o = () => ki,
|
|
684
|
+
maxTimeout: c = wi
|
|
685
685
|
} = e, u = `${t}/async`, h = `${t}/async/job`;
|
|
686
686
|
let p;
|
|
687
687
|
try {
|
|
688
|
-
p = yield
|
|
688
|
+
p = yield j(this, Ge).call(this, u, ae(ae({}, n), i && { signal: i }));
|
|
689
689
|
} catch (b) {
|
|
690
|
-
throw b instanceof Error && b.name === "AbortError" ? new
|
|
690
|
+
throw b instanceof Error && b.name === "AbortError" ? new Et({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : b;
|
|
691
691
|
}
|
|
692
692
|
if (!p.ok) {
|
|
693
693
|
const b = yield p.text().catch();
|
|
@@ -700,55 +700,55 @@ Ge = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
700
700
|
body: b
|
|
701
701
|
});
|
|
702
702
|
}
|
|
703
|
-
const k = yield p.json(), { job_id:
|
|
704
|
-
if (!
|
|
703
|
+
const k = yield p.json(), { job_id: g } = k;
|
|
704
|
+
if (!g)
|
|
705
705
|
throw new Error("Job ID not found in response");
|
|
706
|
-
return new Promise((b,
|
|
707
|
-
const
|
|
708
|
-
|
|
709
|
-
}, c),
|
|
706
|
+
return new Promise((b, m) => B(this, null, function* () {
|
|
707
|
+
const _ = setTimeout(() => {
|
|
708
|
+
m(new Error("Job timed out"));
|
|
709
|
+
}, c), l = (A = 0) => B(this, null, function* () {
|
|
710
710
|
if (i != null && i.aborted) {
|
|
711
|
-
clearTimeout(
|
|
712
|
-
|
|
713
|
-
}).catch((
|
|
714
|
-
|
|
711
|
+
clearTimeout(_), j(this, Ge).call(this, `${h}/${g}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
712
|
+
m(new Et({ canceled: !0 }));
|
|
713
|
+
}).catch((I) => {
|
|
714
|
+
m(new Et({ canceled: !1 }));
|
|
715
715
|
});
|
|
716
716
|
return;
|
|
717
717
|
}
|
|
718
718
|
try {
|
|
719
|
-
const
|
|
720
|
-
if (
|
|
721
|
-
clearTimeout(
|
|
722
|
-
const
|
|
723
|
-
b(
|
|
724
|
-
} else if (
|
|
725
|
-
clearTimeout(
|
|
719
|
+
const I = yield (yield j(this, Ge).call(this, `${h}/${g}`, { headers: this.headers })).json();
|
|
720
|
+
if (I.status === "success") {
|
|
721
|
+
clearTimeout(_);
|
|
722
|
+
const V = I.response_json;
|
|
723
|
+
b(V);
|
|
724
|
+
} else if (I.status === "failed")
|
|
725
|
+
clearTimeout(_), m(new bi(I.response_json));
|
|
726
726
|
else {
|
|
727
|
-
a && a(
|
|
728
|
-
const
|
|
729
|
-
setTimeout(() =>
|
|
727
|
+
a && a(I.response_json);
|
|
728
|
+
const V = o(A);
|
|
729
|
+
setTimeout(() => l(A + 1), V);
|
|
730
730
|
}
|
|
731
|
-
} catch (
|
|
732
|
-
|
|
731
|
+
} catch (I) {
|
|
732
|
+
m(I);
|
|
733
733
|
}
|
|
734
734
|
});
|
|
735
|
-
|
|
735
|
+
l();
|
|
736
736
|
}));
|
|
737
737
|
});
|
|
738
|
-
},
|
|
739
|
-
return
|
|
738
|
+
}, xt = function(t, e, n, s, r) {
|
|
739
|
+
return B(this, null, function* () {
|
|
740
740
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
741
741
|
let c = i != null ? i : this.headers;
|
|
742
|
-
r.extraHeaders && (c = ae(ae({}, c), r.extraHeaders)), r.requestValidation && (c = Ts(ae({}, c), { "X-Request-Nonce":
|
|
742
|
+
r.extraHeaders && (c = ae(ae({}, c), r.extraHeaders)), r.requestValidation && (c = Ts(ae({}, c), { "X-Request-Nonce": Ar(), "X-Request-Timestamp": Xn() }));
|
|
743
743
|
let u = n;
|
|
744
|
-
return typeof FormData != "undefined" && n instanceof FormData ? delete c["Content-Type"] : (u = s.skipBodyJsonStringify ? n : JSON.stringify(n), r.compress &&
|
|
744
|
+
return typeof FormData != "undefined" && n instanceof FormData ? delete c["Content-Type"] : (u = s.skipBodyJsonStringify ? n : JSON.stringify(n), r.compress && yi() && (c["Content-Encoding"] = "gzip", u = yield gi(u))), r.async ? yield _e(this, ge, Qn).call(this, `${o}${t}`, r.async, {
|
|
745
745
|
method: e,
|
|
746
746
|
headers: c,
|
|
747
747
|
body: u
|
|
748
748
|
}) : yield _e(this, ge, Yn).call(this, `${o}${t}`, r, { method: e, headers: c, body: u });
|
|
749
749
|
});
|
|
750
750
|
};
|
|
751
|
-
const sr = (t, e, n, s) => t instanceof
|
|
751
|
+
const sr = (t, e, n, s) => t instanceof Et ? t : new _i({ resource: e, api: String(n), args: s, cause: t }), In = (t, e) => new Proxy(e, {
|
|
752
752
|
get(n, s) {
|
|
753
753
|
return (...r) => {
|
|
754
754
|
var a;
|
|
@@ -775,28 +775,28 @@ class xi {
|
|
|
775
775
|
de(this, St), this.resourceName = "Files", J(this, St, e);
|
|
776
776
|
}
|
|
777
777
|
get(e) {
|
|
778
|
-
return
|
|
778
|
+
return B(this, arguments, function* ({ fileKey: n, params: s = {} }) {
|
|
779
779
|
const r = new URLSearchParams(ae({
|
|
780
780
|
plugin_data: "857346721138427857"
|
|
781
781
|
}, s)).toString(), a = `v1/files/${n}?${r}`;
|
|
782
|
-
return yield
|
|
782
|
+
return yield j(this, St).get(a);
|
|
783
783
|
});
|
|
784
784
|
}
|
|
785
785
|
getImageFills(e) {
|
|
786
|
-
return
|
|
786
|
+
return B(this, arguments, function* ({ fileKey: n }) {
|
|
787
787
|
var s, r;
|
|
788
788
|
const a = `v1/files/${n}/images`;
|
|
789
|
-
return (r = (s = (yield
|
|
789
|
+
return (r = (s = (yield j(this, St).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
|
|
790
790
|
});
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
793
|
St = /* @__PURE__ */ new WeakMap();
|
|
794
|
-
const
|
|
794
|
+
const Si = (t, e, n) => {
|
|
795
795
|
const s = e.sort();
|
|
796
796
|
return `${t}-${s.join("-")}-${n}`;
|
|
797
|
-
},
|
|
798
|
-
var ve, es,
|
|
799
|
-
class
|
|
797
|
+
}, Oi = (t) => t ? t.ts > Date.now() - 1e3 * 30 : !1;
|
|
798
|
+
var ve, es, Nr;
|
|
799
|
+
class Ti {
|
|
800
800
|
constructor(e) {
|
|
801
801
|
de(this, es), de(this, ve), this.resourceName = "Images", J(this, ve, e);
|
|
802
802
|
}
|
|
@@ -805,54 +805,54 @@ class Oi {
|
|
|
805
805
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
806
806
|
*/
|
|
807
807
|
get(e) {
|
|
808
|
-
return
|
|
809
|
-
const i =
|
|
810
|
-
if (
|
|
808
|
+
return B(this, arguments, function* ({ fileKey: n, nodeIds: s, format: r = "jpg", scale: a }) {
|
|
809
|
+
const i = Si(n, s, r), o = j(this, ve).cache.images.entries.get(i);
|
|
810
|
+
if (Oi(o))
|
|
811
811
|
return o.result;
|
|
812
|
-
o &&
|
|
813
|
-
const c =
|
|
812
|
+
o && j(this, ve).cache.images.entries.delete(i);
|
|
813
|
+
const c = j(this, ve).cache.images.pendingRequests.get(i);
|
|
814
814
|
if (c)
|
|
815
815
|
return c;
|
|
816
|
-
const u = _e(this, es,
|
|
817
|
-
|
|
816
|
+
const u = _e(this, es, Nr).call(this, i, n, s, r, a);
|
|
817
|
+
j(this, ve).cache.images.pendingRequests.set(i, u);
|
|
818
818
|
try {
|
|
819
819
|
return yield u;
|
|
820
820
|
} finally {
|
|
821
|
-
|
|
821
|
+
j(this, ve).cache.images.pendingRequests.delete(i);
|
|
822
822
|
}
|
|
823
823
|
});
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
|
-
ve = /* @__PURE__ */ new WeakMap(), es = /* @__PURE__ */ new WeakSet(),
|
|
827
|
-
return
|
|
828
|
-
const a = yield
|
|
826
|
+
ve = /* @__PURE__ */ new WeakMap(), es = /* @__PURE__ */ new WeakSet(), Nr = function(t, e, n, s, r) {
|
|
827
|
+
return B(this, null, function* () {
|
|
828
|
+
const a = yield j(this, ve).get(
|
|
829
829
|
`v1/images/${e}?ids=${n}&format=${s}${r ? `&scale=${r}` : ""}`
|
|
830
830
|
);
|
|
831
|
-
return
|
|
831
|
+
return j(this, ve).cache.images.entries.set(t, {
|
|
832
832
|
result: a,
|
|
833
833
|
ts: Date.now()
|
|
834
834
|
}), a;
|
|
835
835
|
});
|
|
836
836
|
};
|
|
837
837
|
var cn;
|
|
838
|
-
class
|
|
838
|
+
class Ci {
|
|
839
839
|
constructor(e) {
|
|
840
840
|
de(this, cn), this.resourceName = "Nodes", J(this, cn, e);
|
|
841
841
|
}
|
|
842
842
|
get(e) {
|
|
843
|
-
return
|
|
843
|
+
return B(this, arguments, function* ({ fileKey: n, nodeIds: s, params: r = {} }) {
|
|
844
844
|
const a = Ts(ae({}, r), {
|
|
845
845
|
ids: s.join(",")
|
|
846
846
|
}), i = new URLSearchParams(ae({
|
|
847
847
|
plugin_data: "857346721138427857"
|
|
848
848
|
}, a)).toString(), o = `v1/files/${n}/nodes?${i}`;
|
|
849
|
-
return yield
|
|
849
|
+
return yield j(this, cn).get(o);
|
|
850
850
|
});
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
853
|
cn = /* @__PURE__ */ new WeakMap();
|
|
854
854
|
var je;
|
|
855
|
-
class
|
|
855
|
+
class Ai extends Ei {
|
|
856
856
|
constructor({
|
|
857
857
|
baseAddress: e = "https://api.figma.com/",
|
|
858
858
|
fetch: n = globalThis.fetch.bind(globalThis)
|
|
@@ -862,7 +862,7 @@ class Ci extends ki {
|
|
|
862
862
|
entries: /* @__PURE__ */ new Map(),
|
|
863
863
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
864
864
|
}
|
|
865
|
-
}, this.files = In(this, new xi(this)), this.nodes = In(this, new
|
|
865
|
+
}, this.files = In(this, new xi(this)), this.nodes = In(this, new Ci(this)), this.images = In(this, new Ti(this));
|
|
866
866
|
}
|
|
867
867
|
set token(e) {
|
|
868
868
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
@@ -870,20 +870,20 @@ class Ci extends ki {
|
|
|
870
870
|
J(this, je, e);
|
|
871
871
|
}
|
|
872
872
|
get token() {
|
|
873
|
-
return
|
|
873
|
+
return j(this, je);
|
|
874
874
|
}
|
|
875
875
|
get headers() {
|
|
876
876
|
const e = {
|
|
877
877
|
"Content-Type": "application/json"
|
|
878
878
|
};
|
|
879
|
-
return
|
|
879
|
+
return j(this, je).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = j(this, je) : j(this, je).startsWith("figu_") && (e.Authorization = `Bearer ${j(this, je)}`), e;
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
882
|
je = /* @__PURE__ */ new WeakMap();
|
|
883
|
-
const
|
|
883
|
+
const Ni = (t) => ke(void 0, [t], function* ({
|
|
884
884
|
fileKey: e,
|
|
885
885
|
authToken: n,
|
|
886
|
-
figmaRestApi: s = new
|
|
886
|
+
figmaRestApi: s = new Ai(),
|
|
887
887
|
params: r = {},
|
|
888
888
|
signal: a
|
|
889
889
|
}) {
|
|
@@ -896,10 +896,10 @@ const Ai = (t) => ke(void 0, [t], function* ({
|
|
|
896
896
|
params: r
|
|
897
897
|
});
|
|
898
898
|
} catch (i) {
|
|
899
|
-
throw i instanceof Error && i.name === "AbortError" ? i : (console.error(i),
|
|
899
|
+
throw i instanceof Error && i.name === "AbortError" ? i : (console.error(i), ja(i, e));
|
|
900
900
|
}
|
|
901
901
|
});
|
|
902
|
-
var
|
|
902
|
+
var N;
|
|
903
903
|
(function(t) {
|
|
904
904
|
t.assertEqual = (r) => r;
|
|
905
905
|
function e(r) {
|
|
@@ -934,12 +934,12 @@ var A;
|
|
|
934
934
|
return r.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
935
935
|
}
|
|
936
936
|
t.joinValues = s, t.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
|
|
937
|
-
})(
|
|
937
|
+
})(N || (N = {}));
|
|
938
938
|
var ts;
|
|
939
939
|
(function(t) {
|
|
940
940
|
t.mergeShapes = (e, n) => d(d({}, e), n);
|
|
941
941
|
})(ts || (ts = {}));
|
|
942
|
-
const
|
|
942
|
+
const v = N.arrayToEnum([
|
|
943
943
|
"string",
|
|
944
944
|
"nan",
|
|
945
945
|
"number",
|
|
@@ -963,25 +963,25 @@ const _ = A.arrayToEnum([
|
|
|
963
963
|
]), Ne = (t) => {
|
|
964
964
|
switch (typeof t) {
|
|
965
965
|
case "undefined":
|
|
966
|
-
return
|
|
966
|
+
return v.undefined;
|
|
967
967
|
case "string":
|
|
968
|
-
return
|
|
968
|
+
return v.string;
|
|
969
969
|
case "number":
|
|
970
|
-
return isNaN(t) ?
|
|
970
|
+
return isNaN(t) ? v.nan : v.number;
|
|
971
971
|
case "boolean":
|
|
972
|
-
return
|
|
972
|
+
return v.boolean;
|
|
973
973
|
case "function":
|
|
974
|
-
return
|
|
974
|
+
return v.function;
|
|
975
975
|
case "bigint":
|
|
976
|
-
return
|
|
976
|
+
return v.bigint;
|
|
977
977
|
case "symbol":
|
|
978
|
-
return
|
|
978
|
+
return v.symbol;
|
|
979
979
|
case "object":
|
|
980
|
-
return Array.isArray(t) ?
|
|
980
|
+
return Array.isArray(t) ? v.array : t === null ? v.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? v.promise : typeof Map != "undefined" && t instanceof Map ? v.map : typeof Set != "undefined" && t instanceof Set ? v.set : typeof Date != "undefined" && t instanceof Date ? v.date : v.object;
|
|
981
981
|
default:
|
|
982
|
-
return
|
|
982
|
+
return v.unknown;
|
|
983
983
|
}
|
|
984
|
-
}, f =
|
|
984
|
+
}, f = N.arrayToEnum([
|
|
985
985
|
"invalid_type",
|
|
986
986
|
"invalid_literal",
|
|
987
987
|
"custom",
|
|
@@ -998,7 +998,7 @@ const _ = A.arrayToEnum([
|
|
|
998
998
|
"invalid_intersection_types",
|
|
999
999
|
"not_multiple_of",
|
|
1000
1000
|
"not_finite"
|
|
1001
|
-
]),
|
|
1001
|
+
]), Ri = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
1002
1002
|
class ie extends Error {
|
|
1003
1003
|
get errors() {
|
|
1004
1004
|
return this.issues;
|
|
@@ -1043,7 +1043,7 @@ class ie extends Error {
|
|
|
1043
1043
|
return this.message;
|
|
1044
1044
|
}
|
|
1045
1045
|
get message() {
|
|
1046
|
-
return JSON.stringify(this.issues,
|
|
1046
|
+
return JSON.stringify(this.issues, N.jsonStringifyReplacer, 2);
|
|
1047
1047
|
}
|
|
1048
1048
|
get isEmpty() {
|
|
1049
1049
|
return this.issues.length === 0;
|
|
@@ -1063,22 +1063,22 @@ const yt = (t, e) => {
|
|
|
1063
1063
|
let n;
|
|
1064
1064
|
switch (t.code) {
|
|
1065
1065
|
case f.invalid_type:
|
|
1066
|
-
t.received ===
|
|
1066
|
+
t.received === v.undefined ? n = "Required" : n = `Expected ${t.expected}, received ${t.received}`;
|
|
1067
1067
|
break;
|
|
1068
1068
|
case f.invalid_literal:
|
|
1069
|
-
n = `Invalid literal value, expected ${JSON.stringify(t.expected,
|
|
1069
|
+
n = `Invalid literal value, expected ${JSON.stringify(t.expected, N.jsonStringifyReplacer)}`;
|
|
1070
1070
|
break;
|
|
1071
1071
|
case f.unrecognized_keys:
|
|
1072
|
-
n = `Unrecognized key(s) in object: ${
|
|
1072
|
+
n = `Unrecognized key(s) in object: ${N.joinValues(t.keys, ", ")}`;
|
|
1073
1073
|
break;
|
|
1074
1074
|
case f.invalid_union:
|
|
1075
1075
|
n = "Invalid input";
|
|
1076
1076
|
break;
|
|
1077
1077
|
case f.invalid_union_discriminator:
|
|
1078
|
-
n = `Invalid discriminator value. Expected ${
|
|
1078
|
+
n = `Invalid discriminator value. Expected ${N.joinValues(t.options)}`;
|
|
1079
1079
|
break;
|
|
1080
1080
|
case f.invalid_enum_value:
|
|
1081
|
-
n = `Invalid enum value. Expected ${
|
|
1081
|
+
n = `Invalid enum value. Expected ${N.joinValues(t.options)}, received '${t.received}'`;
|
|
1082
1082
|
break;
|
|
1083
1083
|
case f.invalid_arguments:
|
|
1084
1084
|
n = "Invalid function arguments";
|
|
@@ -1090,7 +1090,7 @@ const yt = (t, e) => {
|
|
|
1090
1090
|
n = "Invalid date";
|
|
1091
1091
|
break;
|
|
1092
1092
|
case f.invalid_string:
|
|
1093
|
-
typeof t.validation == "object" ? "includes" in t.validation ? (n = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (n = `${n} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? n = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? n = `Invalid input: must end with "${t.validation.endsWith}"` :
|
|
1093
|
+
typeof t.validation == "object" ? "includes" in t.validation ? (n = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (n = `${n} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? n = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? n = `Invalid input: must end with "${t.validation.endsWith}"` : N.assertNever(t.validation) : t.validation !== "regex" ? n = `Invalid ${t.validation}` : n = "Invalid";
|
|
1094
1094
|
break;
|
|
1095
1095
|
case f.too_small:
|
|
1096
1096
|
t.type === "array" ? n = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? n = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? n = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? n = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : n = "Invalid input";
|
|
@@ -1111,23 +1111,23 @@ const yt = (t, e) => {
|
|
|
1111
1111
|
n = "Number must be finite";
|
|
1112
1112
|
break;
|
|
1113
1113
|
default:
|
|
1114
|
-
n = e.defaultError,
|
|
1114
|
+
n = e.defaultError, N.assertNever(t);
|
|
1115
1115
|
}
|
|
1116
1116
|
return { message: n };
|
|
1117
1117
|
};
|
|
1118
|
-
let
|
|
1119
|
-
function
|
|
1120
|
-
|
|
1118
|
+
let Rr = yt;
|
|
1119
|
+
function Pi(t) {
|
|
1120
|
+
Rr = t;
|
|
1121
1121
|
}
|
|
1122
1122
|
function ln() {
|
|
1123
|
-
return
|
|
1123
|
+
return Rr;
|
|
1124
1124
|
}
|
|
1125
1125
|
const fn = (t) => {
|
|
1126
|
-
const { data: e, path: n, errorMaps: s, issueData: r } = t, a = [...n, ...r.path || []], i =
|
|
1126
|
+
const { data: e, path: n, errorMaps: s, issueData: r } = t, a = [...n, ...r.path || []], i = x(d({}, r), {
|
|
1127
1127
|
path: a
|
|
1128
1128
|
});
|
|
1129
1129
|
if (r.message !== void 0)
|
|
1130
|
-
return
|
|
1130
|
+
return x(d({}, r), {
|
|
1131
1131
|
path: a,
|
|
1132
1132
|
message: r.message
|
|
1133
1133
|
});
|
|
@@ -1135,12 +1135,12 @@ const fn = (t) => {
|
|
|
1135
1135
|
const c = s.filter((u) => !!u).slice().reverse();
|
|
1136
1136
|
for (const u of c)
|
|
1137
1137
|
o = u(i, { data: e, defaultError: o }).message;
|
|
1138
|
-
return
|
|
1138
|
+
return x(d({}, r), {
|
|
1139
1139
|
path: a,
|
|
1140
1140
|
message: o
|
|
1141
1141
|
});
|
|
1142
|
-
},
|
|
1143
|
-
function
|
|
1142
|
+
}, Ii = [];
|
|
1143
|
+
function y(t, e) {
|
|
1144
1144
|
const n = ln(), s = fn({
|
|
1145
1145
|
issueData: e,
|
|
1146
1146
|
data: t.data,
|
|
@@ -1208,7 +1208,7 @@ function pn(t, e, n, s) {
|
|
|
1208
1208
|
if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1209
1209
|
return e.get(t);
|
|
1210
1210
|
}
|
|
1211
|
-
function
|
|
1211
|
+
function Pr(t, e, n, s, r) {
|
|
1212
1212
|
if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1213
1213
|
return e.set(t, n), n;
|
|
1214
1214
|
}
|
|
@@ -1217,7 +1217,7 @@ var w;
|
|
|
1217
1217
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
1218
1218
|
})(w || (w = {}));
|
|
1219
1219
|
var Ot, Tt;
|
|
1220
|
-
class
|
|
1220
|
+
class Ee {
|
|
1221
1221
|
constructor(e, n, s, r) {
|
|
1222
1222
|
this._cachedPath = [], this.parent = e, this.data = n, this._path = s, this._key = r;
|
|
1223
1223
|
}
|
|
@@ -1387,7 +1387,7 @@ class T {
|
|
|
1387
1387
|
_refinement(e) {
|
|
1388
1388
|
return new ye({
|
|
1389
1389
|
schema: this,
|
|
1390
|
-
typeName:
|
|
1390
|
+
typeName: E.ZodEffects,
|
|
1391
1391
|
effect: { type: "refinement", refinement: e }
|
|
1392
1392
|
});
|
|
1393
1393
|
}
|
|
@@ -1423,37 +1423,37 @@ class T {
|
|
|
1423
1423
|
return Mt.create(this, e, this._def);
|
|
1424
1424
|
}
|
|
1425
1425
|
transform(e) {
|
|
1426
|
-
return new ye(
|
|
1426
|
+
return new ye(x(d({}, O(this._def)), {
|
|
1427
1427
|
schema: this,
|
|
1428
|
-
typeName:
|
|
1428
|
+
typeName: E.ZodEffects,
|
|
1429
1429
|
effect: { type: "transform", transform: e }
|
|
1430
1430
|
}));
|
|
1431
1431
|
}
|
|
1432
1432
|
default(e) {
|
|
1433
1433
|
const n = typeof e == "function" ? e : () => e;
|
|
1434
|
-
return new
|
|
1434
|
+
return new Ut(x(d({}, O(this._def)), {
|
|
1435
1435
|
innerType: this,
|
|
1436
1436
|
defaultValue: n,
|
|
1437
|
-
typeName:
|
|
1437
|
+
typeName: E.ZodDefault
|
|
1438
1438
|
}));
|
|
1439
1439
|
}
|
|
1440
1440
|
brand() {
|
|
1441
1441
|
return new Ns(d({
|
|
1442
|
-
typeName:
|
|
1442
|
+
typeName: E.ZodBranded,
|
|
1443
1443
|
type: this
|
|
1444
1444
|
}, O(this._def)));
|
|
1445
1445
|
}
|
|
1446
1446
|
catch(e) {
|
|
1447
1447
|
const n = typeof e == "function" ? e : () => e;
|
|
1448
|
-
return new
|
|
1448
|
+
return new Vt(x(d({}, O(this._def)), {
|
|
1449
1449
|
innerType: this,
|
|
1450
1450
|
catchValue: n,
|
|
1451
|
-
typeName:
|
|
1451
|
+
typeName: E.ZodCatch
|
|
1452
1452
|
}));
|
|
1453
1453
|
}
|
|
1454
1454
|
describe(e) {
|
|
1455
1455
|
const n = this.constructor;
|
|
1456
|
-
return new n(
|
|
1456
|
+
return new n(x(d({}, this._def), {
|
|
1457
1457
|
description: e
|
|
1458
1458
|
}));
|
|
1459
1459
|
}
|
|
@@ -1470,26 +1470,26 @@ class T {
|
|
|
1470
1470
|
return this.safeParse(null).success;
|
|
1471
1471
|
}
|
|
1472
1472
|
}
|
|
1473
|
-
const
|
|
1473
|
+
const ji = /^c[^\s-]{8,}$/i, Zi = /^[0-9a-z]+$/, Di = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Mi = /^[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, Li = /^[a-z0-9_-]{21}$/i, $i = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Fi = /^[-+]?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)?)??$/, Wi = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ui = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1474
1474
|
let jn;
|
|
1475
|
-
const Vi = /^(?:(?: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])$/,
|
|
1476
|
-
function
|
|
1475
|
+
const Vi = /^(?:(?: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])$/, zi = /^(?:(?: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])$/, Ki = /^(([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]))$/, Bi = /^(([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])$/, qi = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Hi = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Ir = "((\\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])))", Gi = new RegExp(`^${Ir}$`);
|
|
1476
|
+
function jr(t) {
|
|
1477
1477
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
1478
1478
|
return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
1479
1479
|
}
|
|
1480
|
-
function
|
|
1481
|
-
return new RegExp(`^${
|
|
1480
|
+
function Ji(t) {
|
|
1481
|
+
return new RegExp(`^${jr(t)}$`);
|
|
1482
1482
|
}
|
|
1483
|
-
function
|
|
1484
|
-
let e = `${
|
|
1483
|
+
function Zr(t) {
|
|
1484
|
+
let e = `${Ir}T${jr(t)}`;
|
|
1485
1485
|
const n = [];
|
|
1486
1486
|
return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
|
|
1487
1487
|
}
|
|
1488
|
-
function Ji(t, e) {
|
|
1489
|
-
return !!((e === "v4" || !e) && Vi.test(t) || (e === "v6" || !e) && zi.test(t));
|
|
1490
|
-
}
|
|
1491
1488
|
function Xi(t, e) {
|
|
1492
|
-
|
|
1489
|
+
return !!((e === "v4" || !e) && Vi.test(t) || (e === "v6" || !e) && Ki.test(t));
|
|
1490
|
+
}
|
|
1491
|
+
function Yi(t, e) {
|
|
1492
|
+
if (!$i.test(t))
|
|
1493
1493
|
return !1;
|
|
1494
1494
|
try {
|
|
1495
1495
|
const [n] = t.split("."), s = n.replace(/-/g, "+").replace(/_/g, "/").padEnd(n.length + (4 - n.length % 4) % 4, "="), r = JSON.parse(atob(s));
|
|
@@ -1498,16 +1498,16 @@ function Xi(t, e) {
|
|
|
1498
1498
|
return !1;
|
|
1499
1499
|
}
|
|
1500
1500
|
}
|
|
1501
|
-
function
|
|
1502
|
-
return !!((e === "v4" || !e) &&
|
|
1501
|
+
function Qi(t, e) {
|
|
1502
|
+
return !!((e === "v4" || !e) && zi.test(t) || (e === "v6" || !e) && Bi.test(t));
|
|
1503
1503
|
}
|
|
1504
1504
|
class pe extends T {
|
|
1505
1505
|
_parse(e) {
|
|
1506
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
1506
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== v.string) {
|
|
1507
1507
|
const r = this._getOrReturnCtx(e);
|
|
1508
|
-
return
|
|
1508
|
+
return y(r, {
|
|
1509
1509
|
code: f.invalid_type,
|
|
1510
|
-
expected:
|
|
1510
|
+
expected: v.string,
|
|
1511
1511
|
received: r.parsedType
|
|
1512
1512
|
}), S;
|
|
1513
1513
|
}
|
|
@@ -1515,7 +1515,7 @@ class pe extends T {
|
|
|
1515
1515
|
let s;
|
|
1516
1516
|
for (const r of this._def.checks)
|
|
1517
1517
|
if (r.kind === "min")
|
|
1518
|
-
e.data.length < r.value && (s = this._getOrReturnCtx(e, s),
|
|
1518
|
+
e.data.length < r.value && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1519
1519
|
code: f.too_small,
|
|
1520
1520
|
minimum: r.value,
|
|
1521
1521
|
type: "string",
|
|
@@ -1524,7 +1524,7 @@ class pe extends T {
|
|
|
1524
1524
|
message: r.message
|
|
1525
1525
|
}), n.dirty());
|
|
1526
1526
|
else if (r.kind === "max")
|
|
1527
|
-
e.data.length > r.value && (s = this._getOrReturnCtx(e, s),
|
|
1527
|
+
e.data.length > r.value && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1528
1528
|
code: f.too_big,
|
|
1529
1529
|
maximum: r.value,
|
|
1530
1530
|
type: "string",
|
|
@@ -1534,14 +1534,14 @@ class pe extends T {
|
|
|
1534
1534
|
}), n.dirty());
|
|
1535
1535
|
else if (r.kind === "length") {
|
|
1536
1536
|
const a = e.data.length > r.value, i = e.data.length < r.value;
|
|
1537
|
-
(a || i) && (s = this._getOrReturnCtx(e, s), a ?
|
|
1537
|
+
(a || i) && (s = this._getOrReturnCtx(e, s), a ? y(s, {
|
|
1538
1538
|
code: f.too_big,
|
|
1539
1539
|
maximum: r.value,
|
|
1540
1540
|
type: "string",
|
|
1541
1541
|
inclusive: !0,
|
|
1542
1542
|
exact: !0,
|
|
1543
1543
|
message: r.message
|
|
1544
|
-
}) : i &&
|
|
1544
|
+
}) : i && y(s, {
|
|
1545
1545
|
code: f.too_small,
|
|
1546
1546
|
minimum: r.value,
|
|
1547
1547
|
type: "string",
|
|
@@ -1550,43 +1550,43 @@ class pe extends T {
|
|
|
1550
1550
|
message: r.message
|
|
1551
1551
|
}), n.dirty());
|
|
1552
1552
|
} else if (r.kind === "email")
|
|
1553
|
-
|
|
1553
|
+
Wi.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1554
1554
|
validation: "email",
|
|
1555
1555
|
code: f.invalid_string,
|
|
1556
1556
|
message: r.message
|
|
1557
1557
|
}), n.dirty());
|
|
1558
1558
|
else if (r.kind === "emoji")
|
|
1559
|
-
jn || (jn = new RegExp(
|
|
1559
|
+
jn || (jn = new RegExp(Ui, "u")), jn.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1560
1560
|
validation: "emoji",
|
|
1561
1561
|
code: f.invalid_string,
|
|
1562
1562
|
message: r.message
|
|
1563
1563
|
}), n.dirty());
|
|
1564
1564
|
else if (r.kind === "uuid")
|
|
1565
|
-
|
|
1565
|
+
Mi.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1566
1566
|
validation: "uuid",
|
|
1567
1567
|
code: f.invalid_string,
|
|
1568
1568
|
message: r.message
|
|
1569
1569
|
}), n.dirty());
|
|
1570
1570
|
else if (r.kind === "nanoid")
|
|
1571
|
-
|
|
1571
|
+
Li.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1572
1572
|
validation: "nanoid",
|
|
1573
1573
|
code: f.invalid_string,
|
|
1574
1574
|
message: r.message
|
|
1575
1575
|
}), n.dirty());
|
|
1576
1576
|
else if (r.kind === "cuid")
|
|
1577
|
-
|
|
1577
|
+
ji.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1578
1578
|
validation: "cuid",
|
|
1579
1579
|
code: f.invalid_string,
|
|
1580
1580
|
message: r.message
|
|
1581
1581
|
}), n.dirty());
|
|
1582
1582
|
else if (r.kind === "cuid2")
|
|
1583
|
-
|
|
1583
|
+
Zi.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1584
1584
|
validation: "cuid2",
|
|
1585
1585
|
code: f.invalid_string,
|
|
1586
1586
|
message: r.message
|
|
1587
1587
|
}), n.dirty());
|
|
1588
1588
|
else if (r.kind === "ulid")
|
|
1589
|
-
|
|
1589
|
+
Di.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1590
1590
|
validation: "ulid",
|
|
1591
1591
|
code: f.invalid_string,
|
|
1592
1592
|
message: r.message
|
|
@@ -1595,65 +1595,65 @@ class pe extends T {
|
|
|
1595
1595
|
try {
|
|
1596
1596
|
new URL(e.data);
|
|
1597
1597
|
} catch (a) {
|
|
1598
|
-
s = this._getOrReturnCtx(e, s),
|
|
1598
|
+
s = this._getOrReturnCtx(e, s), y(s, {
|
|
1599
1599
|
validation: "url",
|
|
1600
1600
|
code: f.invalid_string,
|
|
1601
1601
|
message: r.message
|
|
1602
1602
|
}), n.dirty();
|
|
1603
1603
|
}
|
|
1604
|
-
else r.kind === "regex" ? (r.regex.lastIndex = 0, r.regex.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
1604
|
+
else r.kind === "regex" ? (r.regex.lastIndex = 0, r.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1605
1605
|
validation: "regex",
|
|
1606
1606
|
code: f.invalid_string,
|
|
1607
1607
|
message: r.message
|
|
1608
|
-
}), n.dirty())) : r.kind === "trim" ? e.data = e.data.trim() : r.kind === "includes" ? e.data.includes(r.value, r.position) || (s = this._getOrReturnCtx(e, s),
|
|
1608
|
+
}), n.dirty())) : r.kind === "trim" ? e.data = e.data.trim() : r.kind === "includes" ? e.data.includes(r.value, r.position) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1609
1609
|
code: f.invalid_string,
|
|
1610
1610
|
validation: { includes: r.value, position: r.position },
|
|
1611
1611
|
message: r.message
|
|
1612
|
-
}), n.dirty()) : r.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : r.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : r.kind === "startsWith" ? e.data.startsWith(r.value) || (s = this._getOrReturnCtx(e, s),
|
|
1612
|
+
}), n.dirty()) : r.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : r.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : r.kind === "startsWith" ? e.data.startsWith(r.value) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1613
1613
|
code: f.invalid_string,
|
|
1614
1614
|
validation: { startsWith: r.value },
|
|
1615
1615
|
message: r.message
|
|
1616
|
-
}), n.dirty()) : r.kind === "endsWith" ? e.data.endsWith(r.value) || (s = this._getOrReturnCtx(e, s),
|
|
1616
|
+
}), n.dirty()) : r.kind === "endsWith" ? e.data.endsWith(r.value) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1617
1617
|
code: f.invalid_string,
|
|
1618
1618
|
validation: { endsWith: r.value },
|
|
1619
1619
|
message: r.message
|
|
1620
|
-
}), n.dirty()) : r.kind === "datetime" ?
|
|
1620
|
+
}), n.dirty()) : r.kind === "datetime" ? Zr(r).test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1621
1621
|
code: f.invalid_string,
|
|
1622
1622
|
validation: "datetime",
|
|
1623
1623
|
message: r.message
|
|
1624
|
-
}), n.dirty()) : r.kind === "date" ?
|
|
1624
|
+
}), n.dirty()) : r.kind === "date" ? Gi.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1625
1625
|
code: f.invalid_string,
|
|
1626
1626
|
validation: "date",
|
|
1627
1627
|
message: r.message
|
|
1628
|
-
}), n.dirty()) : r.kind === "time" ?
|
|
1628
|
+
}), n.dirty()) : r.kind === "time" ? Ji(r).test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1629
1629
|
code: f.invalid_string,
|
|
1630
1630
|
validation: "time",
|
|
1631
1631
|
message: r.message
|
|
1632
|
-
}), n.dirty()) : r.kind === "duration" ? Fi.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
1632
|
+
}), n.dirty()) : r.kind === "duration" ? Fi.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1633
1633
|
validation: "duration",
|
|
1634
1634
|
code: f.invalid_string,
|
|
1635
1635
|
message: r.message
|
|
1636
|
-
}), n.dirty()) : r.kind === "ip" ?
|
|
1636
|
+
}), n.dirty()) : r.kind === "ip" ? Xi(e.data, r.version) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1637
1637
|
validation: "ip",
|
|
1638
1638
|
code: f.invalid_string,
|
|
1639
1639
|
message: r.message
|
|
1640
|
-
}), n.dirty()) : r.kind === "jwt" ?
|
|
1640
|
+
}), n.dirty()) : r.kind === "jwt" ? Yi(e.data, r.alg) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1641
1641
|
validation: "jwt",
|
|
1642
1642
|
code: f.invalid_string,
|
|
1643
1643
|
message: r.message
|
|
1644
|
-
}), n.dirty()) : r.kind === "cidr" ?
|
|
1644
|
+
}), n.dirty()) : r.kind === "cidr" ? Qi(e.data, r.version) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1645
1645
|
validation: "cidr",
|
|
1646
1646
|
code: f.invalid_string,
|
|
1647
1647
|
message: r.message
|
|
1648
|
-
}), n.dirty()) : r.kind === "base64" ?
|
|
1648
|
+
}), n.dirty()) : r.kind === "base64" ? qi.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1649
1649
|
validation: "base64",
|
|
1650
1650
|
code: f.invalid_string,
|
|
1651
1651
|
message: r.message
|
|
1652
|
-
}), n.dirty()) : r.kind === "base64url" ?
|
|
1652
|
+
}), n.dirty()) : r.kind === "base64url" ? Hi.test(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
1653
1653
|
validation: "base64url",
|
|
1654
1654
|
code: f.invalid_string,
|
|
1655
1655
|
message: r.message
|
|
1656
|
-
}), n.dirty()) :
|
|
1656
|
+
}), n.dirty()) : N.assertNever(r);
|
|
1657
1657
|
return { status: n.value, value: e.data };
|
|
1658
1658
|
}
|
|
1659
1659
|
_regex(e, n, s) {
|
|
@@ -1663,7 +1663,7 @@ class pe extends T {
|
|
|
1663
1663
|
}, w.errToObj(s)));
|
|
1664
1664
|
}
|
|
1665
1665
|
_addCheck(e) {
|
|
1666
|
-
return new pe(
|
|
1666
|
+
return new pe(x(d({}, this._def), {
|
|
1667
1667
|
checks: [...this._def.checks, e]
|
|
1668
1668
|
}));
|
|
1669
1669
|
}
|
|
@@ -1789,17 +1789,17 @@ class pe extends T {
|
|
|
1789
1789
|
return this.min(1, w.errToObj(e));
|
|
1790
1790
|
}
|
|
1791
1791
|
trim() {
|
|
1792
|
-
return new pe(
|
|
1792
|
+
return new pe(x(d({}, this._def), {
|
|
1793
1793
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1794
1794
|
}));
|
|
1795
1795
|
}
|
|
1796
1796
|
toLowerCase() {
|
|
1797
|
-
return new pe(
|
|
1797
|
+
return new pe(x(d({}, this._def), {
|
|
1798
1798
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1799
1799
|
}));
|
|
1800
1800
|
}
|
|
1801
1801
|
toUpperCase() {
|
|
1802
|
-
return new pe(
|
|
1802
|
+
return new pe(x(d({}, this._def), {
|
|
1803
1803
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1804
1804
|
}));
|
|
1805
1805
|
}
|
|
@@ -1868,11 +1868,11 @@ pe.create = (t) => {
|
|
|
1868
1868
|
var e;
|
|
1869
1869
|
return new pe(d({
|
|
1870
1870
|
checks: [],
|
|
1871
|
-
typeName:
|
|
1871
|
+
typeName: E.ZodString,
|
|
1872
1872
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1
|
|
1873
1873
|
}, O(t)));
|
|
1874
1874
|
};
|
|
1875
|
-
function
|
|
1875
|
+
function eo(t, e) {
|
|
1876
1876
|
const n = (t.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = n > s ? n : s, a = parseInt(t.toFixed(r).replace(".", "")), i = parseInt(e.toFixed(r).replace(".", ""));
|
|
1877
1877
|
return a % i / Math.pow(10, r);
|
|
1878
1878
|
}
|
|
@@ -1881,44 +1881,44 @@ class Le extends T {
|
|
|
1881
1881
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1882
1882
|
}
|
|
1883
1883
|
_parse(e) {
|
|
1884
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
1884
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== v.number) {
|
|
1885
1885
|
const r = this._getOrReturnCtx(e);
|
|
1886
|
-
return
|
|
1886
|
+
return y(r, {
|
|
1887
1887
|
code: f.invalid_type,
|
|
1888
|
-
expected:
|
|
1888
|
+
expected: v.number,
|
|
1889
1889
|
received: r.parsedType
|
|
1890
1890
|
}), S;
|
|
1891
1891
|
}
|
|
1892
1892
|
let n;
|
|
1893
1893
|
const s = new X();
|
|
1894
1894
|
for (const r of this._def.checks)
|
|
1895
|
-
r.kind === "int" ?
|
|
1895
|
+
r.kind === "int" ? N.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
1896
1896
|
code: f.invalid_type,
|
|
1897
1897
|
expected: "integer",
|
|
1898
1898
|
received: "float",
|
|
1899
1899
|
message: r.message
|
|
1900
|
-
}), s.dirty()) : r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (n = this._getOrReturnCtx(e, n),
|
|
1900
|
+
}), s.dirty()) : r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
1901
1901
|
code: f.too_small,
|
|
1902
1902
|
minimum: r.value,
|
|
1903
1903
|
type: "number",
|
|
1904
1904
|
inclusive: r.inclusive,
|
|
1905
1905
|
exact: !1,
|
|
1906
1906
|
message: r.message
|
|
1907
|
-
}), s.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (n = this._getOrReturnCtx(e, n),
|
|
1907
|
+
}), s.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
1908
1908
|
code: f.too_big,
|
|
1909
1909
|
maximum: r.value,
|
|
1910
1910
|
type: "number",
|
|
1911
1911
|
inclusive: r.inclusive,
|
|
1912
1912
|
exact: !1,
|
|
1913
1913
|
message: r.message
|
|
1914
|
-
}), s.dirty()) : r.kind === "multipleOf" ?
|
|
1914
|
+
}), s.dirty()) : r.kind === "multipleOf" ? eo(e.data, r.value) !== 0 && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
1915
1915
|
code: f.not_multiple_of,
|
|
1916
1916
|
multipleOf: r.value,
|
|
1917
1917
|
message: r.message
|
|
1918
|
-
}), s.dirty()) : r.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
1918
|
+
}), s.dirty()) : r.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
1919
1919
|
code: f.not_finite,
|
|
1920
1920
|
message: r.message
|
|
1921
|
-
}), s.dirty()) :
|
|
1921
|
+
}), s.dirty()) : N.assertNever(r);
|
|
1922
1922
|
return { status: s.value, value: e.data };
|
|
1923
1923
|
}
|
|
1924
1924
|
gte(e, n) {
|
|
@@ -1934,7 +1934,7 @@ class Le extends T {
|
|
|
1934
1934
|
return this.setLimit("max", e, !1, w.toString(n));
|
|
1935
1935
|
}
|
|
1936
1936
|
setLimit(e, n, s, r) {
|
|
1937
|
-
return new Le(
|
|
1937
|
+
return new Le(x(d({}, this._def), {
|
|
1938
1938
|
checks: [
|
|
1939
1939
|
...this._def.checks,
|
|
1940
1940
|
{
|
|
@@ -1947,7 +1947,7 @@ class Le extends T {
|
|
|
1947
1947
|
}));
|
|
1948
1948
|
}
|
|
1949
1949
|
_addCheck(e) {
|
|
1950
|
-
return new Le(
|
|
1950
|
+
return new Le(x(d({}, this._def), {
|
|
1951
1951
|
checks: [...this._def.checks, e]
|
|
1952
1952
|
}));
|
|
1953
1953
|
}
|
|
@@ -2028,7 +2028,7 @@ class Le extends T {
|
|
|
2028
2028
|
return e;
|
|
2029
2029
|
}
|
|
2030
2030
|
get isInt() {
|
|
2031
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
2031
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && N.isInteger(e.value));
|
|
2032
2032
|
}
|
|
2033
2033
|
get isFinite() {
|
|
2034
2034
|
let e = null, n = null;
|
|
@@ -2042,10 +2042,10 @@ class Le extends T {
|
|
|
2042
2042
|
}
|
|
2043
2043
|
Le.create = (t) => new Le(d({
|
|
2044
2044
|
checks: [],
|
|
2045
|
-
typeName:
|
|
2045
|
+
typeName: E.ZodNumber,
|
|
2046
2046
|
coerce: (t == null ? void 0 : t.coerce) || !1
|
|
2047
2047
|
}, O(t)));
|
|
2048
|
-
class
|
|
2048
|
+
class $e extends T {
|
|
2049
2049
|
constructor() {
|
|
2050
2050
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
2051
2051
|
}
|
|
@@ -2056,35 +2056,35 @@ class Fe extends T {
|
|
|
2056
2056
|
} catch (r) {
|
|
2057
2057
|
return this._getInvalidInput(e);
|
|
2058
2058
|
}
|
|
2059
|
-
if (this._getType(e) !==
|
|
2059
|
+
if (this._getType(e) !== v.bigint)
|
|
2060
2060
|
return this._getInvalidInput(e);
|
|
2061
2061
|
let n;
|
|
2062
2062
|
const s = new X();
|
|
2063
2063
|
for (const r of this._def.checks)
|
|
2064
|
-
r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (n = this._getOrReturnCtx(e, n),
|
|
2064
|
+
r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2065
2065
|
code: f.too_small,
|
|
2066
2066
|
type: "bigint",
|
|
2067
2067
|
minimum: r.value,
|
|
2068
2068
|
inclusive: r.inclusive,
|
|
2069
2069
|
message: r.message
|
|
2070
|
-
}), s.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (n = this._getOrReturnCtx(e, n),
|
|
2070
|
+
}), s.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2071
2071
|
code: f.too_big,
|
|
2072
2072
|
type: "bigint",
|
|
2073
2073
|
maximum: r.value,
|
|
2074
2074
|
inclusive: r.inclusive,
|
|
2075
2075
|
message: r.message
|
|
2076
|
-
}), s.dirty()) : r.kind === "multipleOf" ? e.data % r.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n),
|
|
2076
|
+
}), s.dirty()) : r.kind === "multipleOf" ? e.data % r.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2077
2077
|
code: f.not_multiple_of,
|
|
2078
2078
|
multipleOf: r.value,
|
|
2079
2079
|
message: r.message
|
|
2080
|
-
}), s.dirty()) :
|
|
2080
|
+
}), s.dirty()) : N.assertNever(r);
|
|
2081
2081
|
return { status: s.value, value: e.data };
|
|
2082
2082
|
}
|
|
2083
2083
|
_getInvalidInput(e) {
|
|
2084
2084
|
const n = this._getOrReturnCtx(e);
|
|
2085
|
-
return
|
|
2085
|
+
return y(n, {
|
|
2086
2086
|
code: f.invalid_type,
|
|
2087
|
-
expected:
|
|
2087
|
+
expected: v.bigint,
|
|
2088
2088
|
received: n.parsedType
|
|
2089
2089
|
}), S;
|
|
2090
2090
|
}
|
|
@@ -2101,7 +2101,7 @@ class Fe extends T {
|
|
|
2101
2101
|
return this.setLimit("max", e, !1, w.toString(n));
|
|
2102
2102
|
}
|
|
2103
2103
|
setLimit(e, n, s, r) {
|
|
2104
|
-
return new
|
|
2104
|
+
return new $e(x(d({}, this._def), {
|
|
2105
2105
|
checks: [
|
|
2106
2106
|
...this._def.checks,
|
|
2107
2107
|
{
|
|
@@ -2114,7 +2114,7 @@ class Fe extends T {
|
|
|
2114
2114
|
}));
|
|
2115
2115
|
}
|
|
2116
2116
|
_addCheck(e) {
|
|
2117
|
-
return new
|
|
2117
|
+
return new $e(x(d({}, this._def), {
|
|
2118
2118
|
checks: [...this._def.checks, e]
|
|
2119
2119
|
}));
|
|
2120
2120
|
}
|
|
@@ -2170,21 +2170,21 @@ class Fe extends T {
|
|
|
2170
2170
|
return e;
|
|
2171
2171
|
}
|
|
2172
2172
|
}
|
|
2173
|
-
|
|
2173
|
+
$e.create = (t) => {
|
|
2174
2174
|
var e;
|
|
2175
|
-
return new
|
|
2175
|
+
return new $e(d({
|
|
2176
2176
|
checks: [],
|
|
2177
|
-
typeName:
|
|
2177
|
+
typeName: E.ZodBigInt,
|
|
2178
2178
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1
|
|
2179
2179
|
}, O(t)));
|
|
2180
2180
|
};
|
|
2181
2181
|
class It extends T {
|
|
2182
2182
|
_parse(e) {
|
|
2183
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
2183
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== v.boolean) {
|
|
2184
2184
|
const n = this._getOrReturnCtx(e);
|
|
2185
|
-
return
|
|
2185
|
+
return y(n, {
|
|
2186
2186
|
code: f.invalid_type,
|
|
2187
|
-
expected:
|
|
2187
|
+
expected: v.boolean,
|
|
2188
2188
|
received: n.parsedType
|
|
2189
2189
|
}), S;
|
|
2190
2190
|
}
|
|
@@ -2192,50 +2192,50 @@ class It extends T {
|
|
|
2192
2192
|
}
|
|
2193
2193
|
}
|
|
2194
2194
|
It.create = (t) => new It(d({
|
|
2195
|
-
typeName:
|
|
2195
|
+
typeName: E.ZodBoolean,
|
|
2196
2196
|
coerce: (t == null ? void 0 : t.coerce) || !1
|
|
2197
2197
|
}, O(t)));
|
|
2198
2198
|
class Qe extends T {
|
|
2199
2199
|
_parse(e) {
|
|
2200
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
2200
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== v.date) {
|
|
2201
2201
|
const r = this._getOrReturnCtx(e);
|
|
2202
|
-
return
|
|
2202
|
+
return y(r, {
|
|
2203
2203
|
code: f.invalid_type,
|
|
2204
|
-
expected:
|
|
2204
|
+
expected: v.date,
|
|
2205
2205
|
received: r.parsedType
|
|
2206
2206
|
}), S;
|
|
2207
2207
|
}
|
|
2208
2208
|
if (isNaN(e.data.getTime())) {
|
|
2209
2209
|
const r = this._getOrReturnCtx(e);
|
|
2210
|
-
return
|
|
2210
|
+
return y(r, {
|
|
2211
2211
|
code: f.invalid_date
|
|
2212
2212
|
}), S;
|
|
2213
2213
|
}
|
|
2214
2214
|
const n = new X();
|
|
2215
2215
|
let s;
|
|
2216
2216
|
for (const r of this._def.checks)
|
|
2217
|
-
r.kind === "min" ? e.data.getTime() < r.value && (s = this._getOrReturnCtx(e, s),
|
|
2217
|
+
r.kind === "min" ? e.data.getTime() < r.value && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
2218
2218
|
code: f.too_small,
|
|
2219
2219
|
message: r.message,
|
|
2220
2220
|
inclusive: !0,
|
|
2221
2221
|
exact: !1,
|
|
2222
2222
|
minimum: r.value,
|
|
2223
2223
|
type: "date"
|
|
2224
|
-
}), n.dirty()) : r.kind === "max" ? e.data.getTime() > r.value && (s = this._getOrReturnCtx(e, s),
|
|
2224
|
+
}), n.dirty()) : r.kind === "max" ? e.data.getTime() > r.value && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
2225
2225
|
code: f.too_big,
|
|
2226
2226
|
message: r.message,
|
|
2227
2227
|
inclusive: !0,
|
|
2228
2228
|
exact: !1,
|
|
2229
2229
|
maximum: r.value,
|
|
2230
2230
|
type: "date"
|
|
2231
|
-
}), n.dirty()) :
|
|
2231
|
+
}), n.dirty()) : N.assertNever(r);
|
|
2232
2232
|
return {
|
|
2233
2233
|
status: n.value,
|
|
2234
2234
|
value: new Date(e.data.getTime())
|
|
2235
2235
|
};
|
|
2236
2236
|
}
|
|
2237
2237
|
_addCheck(e) {
|
|
2238
|
-
return new Qe(
|
|
2238
|
+
return new Qe(x(d({}, this._def), {
|
|
2239
2239
|
checks: [...this._def.checks, e]
|
|
2240
2240
|
}));
|
|
2241
2241
|
}
|
|
@@ -2269,15 +2269,15 @@ class Qe extends T {
|
|
|
2269
2269
|
Qe.create = (t) => new Qe(d({
|
|
2270
2270
|
checks: [],
|
|
2271
2271
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
2272
|
-
typeName:
|
|
2272
|
+
typeName: E.ZodDate
|
|
2273
2273
|
}, O(t)));
|
|
2274
2274
|
class mn extends T {
|
|
2275
2275
|
_parse(e) {
|
|
2276
|
-
if (this._getType(e) !==
|
|
2276
|
+
if (this._getType(e) !== v.symbol) {
|
|
2277
2277
|
const n = this._getOrReturnCtx(e);
|
|
2278
|
-
return
|
|
2278
|
+
return y(n, {
|
|
2279
2279
|
code: f.invalid_type,
|
|
2280
|
-
expected:
|
|
2280
|
+
expected: v.symbol,
|
|
2281
2281
|
received: n.parsedType
|
|
2282
2282
|
}), S;
|
|
2283
2283
|
}
|
|
@@ -2285,15 +2285,15 @@ class mn extends T {
|
|
|
2285
2285
|
}
|
|
2286
2286
|
}
|
|
2287
2287
|
mn.create = (t) => new mn(d({
|
|
2288
|
-
typeName:
|
|
2288
|
+
typeName: E.ZodSymbol
|
|
2289
2289
|
}, O(t)));
|
|
2290
2290
|
class jt extends T {
|
|
2291
2291
|
_parse(e) {
|
|
2292
|
-
if (this._getType(e) !==
|
|
2292
|
+
if (this._getType(e) !== v.undefined) {
|
|
2293
2293
|
const n = this._getOrReturnCtx(e);
|
|
2294
|
-
return
|
|
2294
|
+
return y(n, {
|
|
2295
2295
|
code: f.invalid_type,
|
|
2296
|
-
expected:
|
|
2296
|
+
expected: v.undefined,
|
|
2297
2297
|
received: n.parsedType
|
|
2298
2298
|
}), S;
|
|
2299
2299
|
}
|
|
@@ -2301,15 +2301,15 @@ class jt extends T {
|
|
|
2301
2301
|
}
|
|
2302
2302
|
}
|
|
2303
2303
|
jt.create = (t) => new jt(d({
|
|
2304
|
-
typeName:
|
|
2304
|
+
typeName: E.ZodUndefined
|
|
2305
2305
|
}, O(t)));
|
|
2306
2306
|
class Zt extends T {
|
|
2307
2307
|
_parse(e) {
|
|
2308
|
-
if (this._getType(e) !==
|
|
2308
|
+
if (this._getType(e) !== v.null) {
|
|
2309
2309
|
const n = this._getOrReturnCtx(e);
|
|
2310
|
-
return
|
|
2310
|
+
return y(n, {
|
|
2311
2311
|
code: f.invalid_type,
|
|
2312
|
-
expected:
|
|
2312
|
+
expected: v.null,
|
|
2313
2313
|
received: n.parsedType
|
|
2314
2314
|
}), S;
|
|
2315
2315
|
}
|
|
@@ -2317,7 +2317,7 @@ class Zt extends T {
|
|
|
2317
2317
|
}
|
|
2318
2318
|
}
|
|
2319
2319
|
Zt.create = (t) => new Zt(d({
|
|
2320
|
-
typeName:
|
|
2320
|
+
typeName: E.ZodNull
|
|
2321
2321
|
}, O(t)));
|
|
2322
2322
|
class gt extends T {
|
|
2323
2323
|
constructor() {
|
|
@@ -2328,7 +2328,7 @@ class gt extends T {
|
|
|
2328
2328
|
}
|
|
2329
2329
|
}
|
|
2330
2330
|
gt.create = (t) => new gt(d({
|
|
2331
|
-
typeName:
|
|
2331
|
+
typeName: E.ZodAny
|
|
2332
2332
|
}, O(t)));
|
|
2333
2333
|
class Xe extends T {
|
|
2334
2334
|
constructor() {
|
|
@@ -2339,28 +2339,28 @@ class Xe extends T {
|
|
|
2339
2339
|
}
|
|
2340
2340
|
}
|
|
2341
2341
|
Xe.create = (t) => new Xe(d({
|
|
2342
|
-
typeName:
|
|
2342
|
+
typeName: E.ZodUnknown
|
|
2343
2343
|
}, O(t)));
|
|
2344
2344
|
class Pe extends T {
|
|
2345
2345
|
_parse(e) {
|
|
2346
2346
|
const n = this._getOrReturnCtx(e);
|
|
2347
|
-
return
|
|
2347
|
+
return y(n, {
|
|
2348
2348
|
code: f.invalid_type,
|
|
2349
|
-
expected:
|
|
2349
|
+
expected: v.never,
|
|
2350
2350
|
received: n.parsedType
|
|
2351
2351
|
}), S;
|
|
2352
2352
|
}
|
|
2353
2353
|
}
|
|
2354
2354
|
Pe.create = (t) => new Pe(d({
|
|
2355
|
-
typeName:
|
|
2355
|
+
typeName: E.ZodNever
|
|
2356
2356
|
}, O(t)));
|
|
2357
2357
|
class yn extends T {
|
|
2358
2358
|
_parse(e) {
|
|
2359
|
-
if (this._getType(e) !==
|
|
2359
|
+
if (this._getType(e) !== v.undefined) {
|
|
2360
2360
|
const n = this._getOrReturnCtx(e);
|
|
2361
|
-
return
|
|
2361
|
+
return y(n, {
|
|
2362
2362
|
code: f.invalid_type,
|
|
2363
|
-
expected:
|
|
2363
|
+
expected: v.void,
|
|
2364
2364
|
received: n.parsedType
|
|
2365
2365
|
}), S;
|
|
2366
2366
|
}
|
|
@@ -2368,20 +2368,20 @@ class yn extends T {
|
|
|
2368
2368
|
}
|
|
2369
2369
|
}
|
|
2370
2370
|
yn.create = (t) => new yn(d({
|
|
2371
|
-
typeName:
|
|
2371
|
+
typeName: E.ZodVoid
|
|
2372
2372
|
}, O(t)));
|
|
2373
2373
|
class me extends T {
|
|
2374
2374
|
_parse(e) {
|
|
2375
2375
|
const { ctx: n, status: s } = this._processInputParams(e), r = this._def;
|
|
2376
|
-
if (n.parsedType !==
|
|
2377
|
-
return
|
|
2376
|
+
if (n.parsedType !== v.array)
|
|
2377
|
+
return y(n, {
|
|
2378
2378
|
code: f.invalid_type,
|
|
2379
|
-
expected:
|
|
2379
|
+
expected: v.array,
|
|
2380
2380
|
received: n.parsedType
|
|
2381
2381
|
}), S;
|
|
2382
2382
|
if (r.exactLength !== null) {
|
|
2383
2383
|
const i = n.data.length > r.exactLength.value, o = n.data.length < r.exactLength.value;
|
|
2384
|
-
(i || o) && (
|
|
2384
|
+
(i || o) && (y(n, {
|
|
2385
2385
|
code: i ? f.too_big : f.too_small,
|
|
2386
2386
|
minimum: o ? r.exactLength.value : void 0,
|
|
2387
2387
|
maximum: i ? r.exactLength.value : void 0,
|
|
@@ -2391,14 +2391,14 @@ class me extends T {
|
|
|
2391
2391
|
message: r.exactLength.message
|
|
2392
2392
|
}), s.dirty());
|
|
2393
2393
|
}
|
|
2394
|
-
if (r.minLength !== null && n.data.length < r.minLength.value && (
|
|
2394
|
+
if (r.minLength !== null && n.data.length < r.minLength.value && (y(n, {
|
|
2395
2395
|
code: f.too_small,
|
|
2396
2396
|
minimum: r.minLength.value,
|
|
2397
2397
|
type: "array",
|
|
2398
2398
|
inclusive: !0,
|
|
2399
2399
|
exact: !1,
|
|
2400
2400
|
message: r.minLength.message
|
|
2401
|
-
}), s.dirty()), r.maxLength !== null && n.data.length > r.maxLength.value && (
|
|
2401
|
+
}), s.dirty()), r.maxLength !== null && n.data.length > r.maxLength.value && (y(n, {
|
|
2402
2402
|
code: f.too_big,
|
|
2403
2403
|
maximum: r.maxLength.value,
|
|
2404
2404
|
type: "array",
|
|
@@ -2406,25 +2406,25 @@ class me extends T {
|
|
|
2406
2406
|
exact: !1,
|
|
2407
2407
|
message: r.maxLength.message
|
|
2408
2408
|
}), s.dirty()), n.common.async)
|
|
2409
|
-
return Promise.all([...n.data].map((i, o) => r.type._parseAsync(new
|
|
2410
|
-
const a = [...n.data].map((i, o) => r.type._parseSync(new
|
|
2409
|
+
return Promise.all([...n.data].map((i, o) => r.type._parseAsync(new Ee(n, i, n.path, o)))).then((i) => X.mergeArray(s, i));
|
|
2410
|
+
const a = [...n.data].map((i, o) => r.type._parseSync(new Ee(n, i, n.path, o)));
|
|
2411
2411
|
return X.mergeArray(s, a);
|
|
2412
2412
|
}
|
|
2413
2413
|
get element() {
|
|
2414
2414
|
return this._def.type;
|
|
2415
2415
|
}
|
|
2416
2416
|
min(e, n) {
|
|
2417
|
-
return new me(
|
|
2417
|
+
return new me(x(d({}, this._def), {
|
|
2418
2418
|
minLength: { value: e, message: w.toString(n) }
|
|
2419
2419
|
}));
|
|
2420
2420
|
}
|
|
2421
2421
|
max(e, n) {
|
|
2422
|
-
return new me(
|
|
2422
|
+
return new me(x(d({}, this._def), {
|
|
2423
2423
|
maxLength: { value: e, message: w.toString(n) }
|
|
2424
2424
|
}));
|
|
2425
2425
|
}
|
|
2426
2426
|
length(e, n) {
|
|
2427
|
-
return new me(
|
|
2427
|
+
return new me(x(d({}, this._def), {
|
|
2428
2428
|
exactLength: { value: e, message: w.toString(n) }
|
|
2429
2429
|
}));
|
|
2430
2430
|
}
|
|
@@ -2437,38 +2437,38 @@ me.create = (t, e) => new me(d({
|
|
|
2437
2437
|
minLength: null,
|
|
2438
2438
|
maxLength: null,
|
|
2439
2439
|
exactLength: null,
|
|
2440
|
-
typeName:
|
|
2440
|
+
typeName: E.ZodArray
|
|
2441
2441
|
}, O(e)));
|
|
2442
2442
|
function ct(t) {
|
|
2443
|
-
if (t instanceof
|
|
2443
|
+
if (t instanceof U) {
|
|
2444
2444
|
const e = {};
|
|
2445
2445
|
for (const n in t.shape) {
|
|
2446
2446
|
const s = t.shape[n];
|
|
2447
2447
|
e[n] = we.create(ct(s));
|
|
2448
2448
|
}
|
|
2449
|
-
return new
|
|
2449
|
+
return new U(x(d({}, t._def), {
|
|
2450
2450
|
shape: () => e
|
|
2451
2451
|
}));
|
|
2452
|
-
} else return t instanceof me ? new me(
|
|
2452
|
+
} else return t instanceof me ? new me(x(d({}, t._def), {
|
|
2453
2453
|
type: ct(t.element)
|
|
2454
|
-
})) : t instanceof we ? we.create(ct(t.unwrap())) : t instanceof We ? We.create(ct(t.unwrap())) : t instanceof
|
|
2454
|
+
})) : t instanceof we ? we.create(ct(t.unwrap())) : t instanceof We ? We.create(ct(t.unwrap())) : t instanceof xe ? xe.create(t.items.map((e) => ct(e))) : t;
|
|
2455
2455
|
}
|
|
2456
|
-
class
|
|
2456
|
+
class U extends T {
|
|
2457
2457
|
constructor() {
|
|
2458
2458
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2459
2459
|
}
|
|
2460
2460
|
_getCached() {
|
|
2461
2461
|
if (this._cached !== null)
|
|
2462
2462
|
return this._cached;
|
|
2463
|
-
const e = this._def.shape(), n =
|
|
2463
|
+
const e = this._def.shape(), n = N.objectKeys(e);
|
|
2464
2464
|
return this._cached = { shape: e, keys: n };
|
|
2465
2465
|
}
|
|
2466
2466
|
_parse(e) {
|
|
2467
|
-
if (this._getType(e) !==
|
|
2467
|
+
if (this._getType(e) !== v.object) {
|
|
2468
2468
|
const c = this._getOrReturnCtx(e);
|
|
2469
|
-
return
|
|
2469
|
+
return y(c, {
|
|
2470
2470
|
code: f.invalid_type,
|
|
2471
|
-
expected:
|
|
2471
|
+
expected: v.object,
|
|
2472
2472
|
received: c.parsedType
|
|
2473
2473
|
}), S;
|
|
2474
2474
|
}
|
|
@@ -2481,7 +2481,7 @@ class V extends T {
|
|
|
2481
2481
|
const u = r[c], h = s.data[c];
|
|
2482
2482
|
o.push({
|
|
2483
2483
|
key: { status: "valid", value: c },
|
|
2484
|
-
value: u._parse(new
|
|
2484
|
+
value: u._parse(new Ee(s, h, s.path, c)),
|
|
2485
2485
|
alwaysSet: c in s.data
|
|
2486
2486
|
});
|
|
2487
2487
|
}
|
|
@@ -2494,7 +2494,7 @@ class V extends T {
|
|
|
2494
2494
|
value: { status: "valid", value: s.data[u] }
|
|
2495
2495
|
});
|
|
2496
2496
|
else if (c === "strict")
|
|
2497
|
-
i.length > 0 && (
|
|
2497
|
+
i.length > 0 && (y(s, {
|
|
2498
2498
|
code: f.unrecognized_keys,
|
|
2499
2499
|
keys: i
|
|
2500
2500
|
}), n.dirty());
|
|
@@ -2506,7 +2506,7 @@ class V extends T {
|
|
|
2506
2506
|
o.push({
|
|
2507
2507
|
key: { status: "valid", value: u },
|
|
2508
2508
|
value: c._parse(
|
|
2509
|
-
new
|
|
2509
|
+
new Ee(s, h, s.path, u)
|
|
2510
2510
|
//, ctx.child(key), value, getParsedType(value)
|
|
2511
2511
|
),
|
|
2512
2512
|
alwaysSet: u in s.data
|
|
@@ -2530,7 +2530,7 @@ class V extends T {
|
|
|
2530
2530
|
return this._def.shape();
|
|
2531
2531
|
}
|
|
2532
2532
|
strict(e) {
|
|
2533
|
-
return w.errToObj, new
|
|
2533
|
+
return w.errToObj, new U(d(x(d({}, this._def), {
|
|
2534
2534
|
unknownKeys: "strict"
|
|
2535
2535
|
}), e !== void 0 ? {
|
|
2536
2536
|
errorMap: (n, s) => {
|
|
@@ -2545,12 +2545,12 @@ class V extends T {
|
|
|
2545
2545
|
} : {}));
|
|
2546
2546
|
}
|
|
2547
2547
|
strip() {
|
|
2548
|
-
return new
|
|
2548
|
+
return new U(x(d({}, this._def), {
|
|
2549
2549
|
unknownKeys: "strip"
|
|
2550
2550
|
}));
|
|
2551
2551
|
}
|
|
2552
2552
|
passthrough() {
|
|
2553
|
-
return new
|
|
2553
|
+
return new U(x(d({}, this._def), {
|
|
2554
2554
|
unknownKeys: "passthrough"
|
|
2555
2555
|
}));
|
|
2556
2556
|
}
|
|
@@ -2572,7 +2572,7 @@ class V extends T {
|
|
|
2572
2572
|
// }) as any;
|
|
2573
2573
|
// };
|
|
2574
2574
|
extend(e) {
|
|
2575
|
-
return new
|
|
2575
|
+
return new U(x(d({}, this._def), {
|
|
2576
2576
|
shape: () => d(d({}, this._def.shape()), e)
|
|
2577
2577
|
}));
|
|
2578
2578
|
}
|
|
@@ -2582,11 +2582,11 @@ class V extends T {
|
|
|
2582
2582
|
* upgrade if you are experiencing issues.
|
|
2583
2583
|
*/
|
|
2584
2584
|
merge(e) {
|
|
2585
|
-
return new
|
|
2585
|
+
return new U({
|
|
2586
2586
|
unknownKeys: e._def.unknownKeys,
|
|
2587
2587
|
catchall: e._def.catchall,
|
|
2588
2588
|
shape: () => d(d({}, this._def.shape()), e._def.shape()),
|
|
2589
|
-
typeName:
|
|
2589
|
+
typeName: E.ZodObject
|
|
2590
2590
|
});
|
|
2591
2591
|
}
|
|
2592
2592
|
// merge<
|
|
@@ -2649,23 +2649,23 @@ class V extends T {
|
|
|
2649
2649
|
// return merged;
|
|
2650
2650
|
// }
|
|
2651
2651
|
catchall(e) {
|
|
2652
|
-
return new
|
|
2652
|
+
return new U(x(d({}, this._def), {
|
|
2653
2653
|
catchall: e
|
|
2654
2654
|
}));
|
|
2655
2655
|
}
|
|
2656
2656
|
pick(e) {
|
|
2657
2657
|
const n = {};
|
|
2658
|
-
return
|
|
2658
|
+
return N.objectKeys(e).forEach((s) => {
|
|
2659
2659
|
e[s] && this.shape[s] && (n[s] = this.shape[s]);
|
|
2660
|
-
}), new
|
|
2660
|
+
}), new U(x(d({}, this._def), {
|
|
2661
2661
|
shape: () => n
|
|
2662
2662
|
}));
|
|
2663
2663
|
}
|
|
2664
2664
|
omit(e) {
|
|
2665
2665
|
const n = {};
|
|
2666
|
-
return
|
|
2666
|
+
return N.objectKeys(this.shape).forEach((s) => {
|
|
2667
2667
|
e[s] || (n[s] = this.shape[s]);
|
|
2668
|
-
}), new
|
|
2668
|
+
}), new U(x(d({}, this._def), {
|
|
2669
2669
|
shape: () => n
|
|
2670
2670
|
}));
|
|
2671
2671
|
}
|
|
@@ -2677,16 +2677,16 @@ class V extends T {
|
|
|
2677
2677
|
}
|
|
2678
2678
|
partial(e) {
|
|
2679
2679
|
const n = {};
|
|
2680
|
-
return
|
|
2680
|
+
return N.objectKeys(this.shape).forEach((s) => {
|
|
2681
2681
|
const r = this.shape[s];
|
|
2682
2682
|
e && !e[s] ? n[s] = r : n[s] = r.optional();
|
|
2683
|
-
}), new
|
|
2683
|
+
}), new U(x(d({}, this._def), {
|
|
2684
2684
|
shape: () => n
|
|
2685
2685
|
}));
|
|
2686
2686
|
}
|
|
2687
2687
|
required(e) {
|
|
2688
2688
|
const n = {};
|
|
2689
|
-
return
|
|
2689
|
+
return N.objectKeys(this.shape).forEach((s) => {
|
|
2690
2690
|
if (e && !e[s])
|
|
2691
2691
|
n[s] = this.shape[s];
|
|
2692
2692
|
else {
|
|
@@ -2695,31 +2695,31 @@ class V extends T {
|
|
|
2695
2695
|
r = r._def.innerType;
|
|
2696
2696
|
n[s] = r;
|
|
2697
2697
|
}
|
|
2698
|
-
}), new
|
|
2698
|
+
}), new U(x(d({}, this._def), {
|
|
2699
2699
|
shape: () => n
|
|
2700
2700
|
}));
|
|
2701
2701
|
}
|
|
2702
2702
|
keyof() {
|
|
2703
|
-
return
|
|
2703
|
+
return Dr(N.objectKeys(this.shape));
|
|
2704
2704
|
}
|
|
2705
2705
|
}
|
|
2706
|
-
|
|
2706
|
+
U.create = (t, e) => new U(d({
|
|
2707
2707
|
shape: () => t,
|
|
2708
2708
|
unknownKeys: "strip",
|
|
2709
2709
|
catchall: Pe.create(),
|
|
2710
|
-
typeName:
|
|
2710
|
+
typeName: E.ZodObject
|
|
2711
2711
|
}, O(e)));
|
|
2712
|
-
|
|
2712
|
+
U.strictCreate = (t, e) => new U(d({
|
|
2713
2713
|
shape: () => t,
|
|
2714
2714
|
unknownKeys: "strict",
|
|
2715
2715
|
catchall: Pe.create(),
|
|
2716
|
-
typeName:
|
|
2716
|
+
typeName: E.ZodObject
|
|
2717
2717
|
}, O(e)));
|
|
2718
|
-
|
|
2718
|
+
U.lazycreate = (t, e) => new U(d({
|
|
2719
2719
|
shape: t,
|
|
2720
2720
|
unknownKeys: "strip",
|
|
2721
2721
|
catchall: Pe.create(),
|
|
2722
|
-
typeName:
|
|
2722
|
+
typeName: E.ZodObject
|
|
2723
2723
|
}, O(e)));
|
|
2724
2724
|
class Dt extends T {
|
|
2725
2725
|
_parse(e) {
|
|
@@ -2732,15 +2732,15 @@ class Dt extends T {
|
|
|
2732
2732
|
if (o.result.status === "dirty")
|
|
2733
2733
|
return n.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2734
2734
|
const i = a.map((o) => new ie(o.ctx.common.issues));
|
|
2735
|
-
return
|
|
2735
|
+
return y(n, {
|
|
2736
2736
|
code: f.invalid_union,
|
|
2737
2737
|
unionErrors: i
|
|
2738
2738
|
}), S;
|
|
2739
2739
|
}
|
|
2740
2740
|
if (n.common.async)
|
|
2741
2741
|
return Promise.all(s.map((a) => ke(this, null, function* () {
|
|
2742
|
-
const i =
|
|
2743
|
-
common:
|
|
2742
|
+
const i = x(d({}, n), {
|
|
2743
|
+
common: x(d({}, n.common), {
|
|
2744
2744
|
issues: []
|
|
2745
2745
|
}),
|
|
2746
2746
|
parent: null
|
|
@@ -2758,8 +2758,8 @@ class Dt extends T {
|
|
|
2758
2758
|
let a;
|
|
2759
2759
|
const i = [];
|
|
2760
2760
|
for (const c of s) {
|
|
2761
|
-
const u =
|
|
2762
|
-
common:
|
|
2761
|
+
const u = x(d({}, n), {
|
|
2762
|
+
common: x(d({}, n.common), {
|
|
2763
2763
|
issues: []
|
|
2764
2764
|
}),
|
|
2765
2765
|
parent: null
|
|
@@ -2775,7 +2775,7 @@ class Dt extends T {
|
|
|
2775
2775
|
if (a)
|
|
2776
2776
|
return n.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2777
2777
|
const o = i.map((c) => new ie(c));
|
|
2778
|
-
return
|
|
2778
|
+
return y(n, {
|
|
2779
2779
|
code: f.invalid_union,
|
|
2780
2780
|
unionErrors: o
|
|
2781
2781
|
}), S;
|
|
@@ -2787,16 +2787,16 @@ class Dt extends T {
|
|
|
2787
2787
|
}
|
|
2788
2788
|
Dt.create = (t, e) => new Dt(d({
|
|
2789
2789
|
options: t,
|
|
2790
|
-
typeName:
|
|
2790
|
+
typeName: E.ZodUnion
|
|
2791
2791
|
}, O(e)));
|
|
2792
|
-
const Ze = (t) => t instanceof
|
|
2793
|
-
class
|
|
2792
|
+
const Ze = (t) => t instanceof $t ? Ze(t.schema) : t instanceof ye ? Ze(t.innerType()) : t instanceof Ft ? [t.value] : t instanceof Fe ? t.options : t instanceof Wt ? N.objectValues(t.enum) : t instanceof Ut ? Ze(t._def.innerType) : t instanceof jt ? [void 0] : t instanceof Zt ? [null] : t instanceof we ? [void 0, ...Ze(t.unwrap())] : t instanceof We ? [null, ...Ze(t.unwrap())] : t instanceof Ns || t instanceof zt ? Ze(t.unwrap()) : t instanceof Vt ? Ze(t._def.innerType) : [];
|
|
2793
|
+
class En extends T {
|
|
2794
2794
|
_parse(e) {
|
|
2795
2795
|
const { ctx: n } = this._processInputParams(e);
|
|
2796
|
-
if (n.parsedType !==
|
|
2797
|
-
return
|
|
2796
|
+
if (n.parsedType !== v.object)
|
|
2797
|
+
return y(n, {
|
|
2798
2798
|
code: f.invalid_type,
|
|
2799
|
-
expected:
|
|
2799
|
+
expected: v.object,
|
|
2800
2800
|
received: n.parsedType
|
|
2801
2801
|
}), S;
|
|
2802
2802
|
const s = this.discriminator, r = n.data[s], a = this.optionsMap.get(r);
|
|
@@ -2808,7 +2808,7 @@ class xn extends T {
|
|
|
2808
2808
|
data: n.data,
|
|
2809
2809
|
path: n.path,
|
|
2810
2810
|
parent: n
|
|
2811
|
-
}) : (
|
|
2811
|
+
}) : (y(n, {
|
|
2812
2812
|
code: f.invalid_union_discriminator,
|
|
2813
2813
|
options: Array.from(this.optionsMap.keys()),
|
|
2814
2814
|
path: [s]
|
|
@@ -2843,8 +2843,8 @@ class xn extends T {
|
|
|
2843
2843
|
r.set(o, a);
|
|
2844
2844
|
}
|
|
2845
2845
|
}
|
|
2846
|
-
return new
|
|
2847
|
-
typeName:
|
|
2846
|
+
return new En(d({
|
|
2847
|
+
typeName: E.ZodDiscriminatedUnion,
|
|
2848
2848
|
discriminator: e,
|
|
2849
2849
|
options: n,
|
|
2850
2850
|
optionsMap: r
|
|
@@ -2855,8 +2855,8 @@ function rs(t, e) {
|
|
|
2855
2855
|
const n = Ne(t), s = Ne(e);
|
|
2856
2856
|
if (t === e)
|
|
2857
2857
|
return { valid: !0, data: t };
|
|
2858
|
-
if (n ===
|
|
2859
|
-
const r =
|
|
2858
|
+
if (n === v.object && s === v.object) {
|
|
2859
|
+
const r = N.objectKeys(e), a = N.objectKeys(t).filter((o) => r.indexOf(o) !== -1), i = d(d({}, t), e);
|
|
2860
2860
|
for (const o of a) {
|
|
2861
2861
|
const c = rs(t[o], e[o]);
|
|
2862
2862
|
if (!c.valid)
|
|
@@ -2864,7 +2864,7 @@ function rs(t, e) {
|
|
|
2864
2864
|
i[o] = c.data;
|
|
2865
2865
|
}
|
|
2866
2866
|
return { valid: !0, data: i };
|
|
2867
|
-
} else if (n ===
|
|
2867
|
+
} else if (n === v.array && s === v.array) {
|
|
2868
2868
|
if (t.length !== e.length)
|
|
2869
2869
|
return { valid: !1 };
|
|
2870
2870
|
const r = [];
|
|
@@ -2875,7 +2875,7 @@ function rs(t, e) {
|
|
|
2875
2875
|
r.push(c.data);
|
|
2876
2876
|
}
|
|
2877
2877
|
return { valid: !0, data: r };
|
|
2878
|
-
} else return n ===
|
|
2878
|
+
} else return n === v.date && s === v.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
|
|
2879
2879
|
}
|
|
2880
2880
|
class Mt extends T {
|
|
2881
2881
|
_parse(e) {
|
|
@@ -2883,7 +2883,7 @@ class Mt extends T {
|
|
|
2883
2883
|
if (ns(a) || ns(i))
|
|
2884
2884
|
return S;
|
|
2885
2885
|
const o = rs(a.value, i.value);
|
|
2886
|
-
return o.valid ? ((ss(a) || ss(i)) && n.dirty(), { status: n.value, value: o.data }) : (
|
|
2886
|
+
return o.valid ? ((ss(a) || ss(i)) && n.dirty(), { status: n.value, value: o.data }) : (y(s, {
|
|
2887
2887
|
code: f.invalid_intersection_types
|
|
2888
2888
|
}), S);
|
|
2889
2889
|
};
|
|
@@ -2912,26 +2912,26 @@ class Mt extends T {
|
|
|
2912
2912
|
Mt.create = (t, e, n) => new Mt(d({
|
|
2913
2913
|
left: t,
|
|
2914
2914
|
right: e,
|
|
2915
|
-
typeName:
|
|
2915
|
+
typeName: E.ZodIntersection
|
|
2916
2916
|
}, O(n)));
|
|
2917
|
-
class
|
|
2917
|
+
class xe extends T {
|
|
2918
2918
|
_parse(e) {
|
|
2919
2919
|
const { status: n, ctx: s } = this._processInputParams(e);
|
|
2920
|
-
if (s.parsedType !==
|
|
2921
|
-
return
|
|
2920
|
+
if (s.parsedType !== v.array)
|
|
2921
|
+
return y(s, {
|
|
2922
2922
|
code: f.invalid_type,
|
|
2923
|
-
expected:
|
|
2923
|
+
expected: v.array,
|
|
2924
2924
|
received: s.parsedType
|
|
2925
2925
|
}), S;
|
|
2926
2926
|
if (s.data.length < this._def.items.length)
|
|
2927
|
-
return
|
|
2927
|
+
return y(s, {
|
|
2928
2928
|
code: f.too_small,
|
|
2929
2929
|
minimum: this._def.items.length,
|
|
2930
2930
|
inclusive: !0,
|
|
2931
2931
|
exact: !1,
|
|
2932
2932
|
type: "array"
|
|
2933
2933
|
}), S;
|
|
2934
|
-
!this._def.rest && s.data.length > this._def.items.length && (
|
|
2934
|
+
!this._def.rest && s.data.length > this._def.items.length && (y(s, {
|
|
2935
2935
|
code: f.too_big,
|
|
2936
2936
|
maximum: this._def.items.length,
|
|
2937
2937
|
inclusive: !0,
|
|
@@ -2940,7 +2940,7 @@ class Ee extends T {
|
|
|
2940
2940
|
}), n.dirty());
|
|
2941
2941
|
const r = [...s.data].map((a, i) => {
|
|
2942
2942
|
const o = this._def.items[i] || this._def.rest;
|
|
2943
|
-
return o ? o._parse(new
|
|
2943
|
+
return o ? o._parse(new Ee(s, a, s.path, i)) : null;
|
|
2944
2944
|
}).filter((a) => !!a);
|
|
2945
2945
|
return s.common.async ? Promise.all(r).then((a) => X.mergeArray(n, a)) : X.mergeArray(n, r);
|
|
2946
2946
|
}
|
|
@@ -2948,17 +2948,17 @@ class Ee extends T {
|
|
|
2948
2948
|
return this._def.items;
|
|
2949
2949
|
}
|
|
2950
2950
|
rest(e) {
|
|
2951
|
-
return new
|
|
2951
|
+
return new xe(x(d({}, this._def), {
|
|
2952
2952
|
rest: e
|
|
2953
2953
|
}));
|
|
2954
2954
|
}
|
|
2955
2955
|
}
|
|
2956
|
-
|
|
2956
|
+
xe.create = (t, e) => {
|
|
2957
2957
|
if (!Array.isArray(t))
|
|
2958
2958
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2959
|
-
return new
|
|
2959
|
+
return new xe(d({
|
|
2960
2960
|
items: t,
|
|
2961
|
-
typeName:
|
|
2961
|
+
typeName: E.ZodTuple,
|
|
2962
2962
|
rest: null
|
|
2963
2963
|
}, O(e)));
|
|
2964
2964
|
};
|
|
@@ -2971,17 +2971,17 @@ class Lt extends T {
|
|
|
2971
2971
|
}
|
|
2972
2972
|
_parse(e) {
|
|
2973
2973
|
const { status: n, ctx: s } = this._processInputParams(e);
|
|
2974
|
-
if (s.parsedType !==
|
|
2975
|
-
return
|
|
2974
|
+
if (s.parsedType !== v.object)
|
|
2975
|
+
return y(s, {
|
|
2976
2976
|
code: f.invalid_type,
|
|
2977
|
-
expected:
|
|
2977
|
+
expected: v.object,
|
|
2978
2978
|
received: s.parsedType
|
|
2979
2979
|
}), S;
|
|
2980
2980
|
const r = [], a = this._def.keyType, i = this._def.valueType;
|
|
2981
2981
|
for (const o in s.data)
|
|
2982
2982
|
r.push({
|
|
2983
|
-
key: a._parse(new
|
|
2984
|
-
value: i._parse(new
|
|
2983
|
+
key: a._parse(new Ee(s, o, s.path, o)),
|
|
2984
|
+
value: i._parse(new Ee(s, s.data[o], s.path, o)),
|
|
2985
2985
|
alwaysSet: o in s.data
|
|
2986
2986
|
});
|
|
2987
2987
|
return s.common.async ? X.mergeObjectAsync(n, r) : X.mergeObjectSync(n, r);
|
|
@@ -2993,11 +2993,11 @@ class Lt extends T {
|
|
|
2993
2993
|
return n instanceof T ? new Lt(d({
|
|
2994
2994
|
keyType: e,
|
|
2995
2995
|
valueType: n,
|
|
2996
|
-
typeName:
|
|
2996
|
+
typeName: E.ZodRecord
|
|
2997
2997
|
}, O(s))) : new Lt(d({
|
|
2998
2998
|
keyType: pe.create(),
|
|
2999
2999
|
valueType: e,
|
|
3000
|
-
typeName:
|
|
3000
|
+
typeName: E.ZodRecord
|
|
3001
3001
|
}, O(n)));
|
|
3002
3002
|
}
|
|
3003
3003
|
}
|
|
@@ -3010,15 +3010,15 @@ class gn extends T {
|
|
|
3010
3010
|
}
|
|
3011
3011
|
_parse(e) {
|
|
3012
3012
|
const { status: n, ctx: s } = this._processInputParams(e);
|
|
3013
|
-
if (s.parsedType !==
|
|
3014
|
-
return
|
|
3013
|
+
if (s.parsedType !== v.map)
|
|
3014
|
+
return y(s, {
|
|
3015
3015
|
code: f.invalid_type,
|
|
3016
|
-
expected:
|
|
3016
|
+
expected: v.map,
|
|
3017
3017
|
received: s.parsedType
|
|
3018
3018
|
}), S;
|
|
3019
3019
|
const r = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], u) => ({
|
|
3020
|
-
key: r._parse(new
|
|
3021
|
-
value: a._parse(new
|
|
3020
|
+
key: r._parse(new Ee(s, o, s.path, [u, "key"])),
|
|
3021
|
+
value: a._parse(new Ee(s, c, s.path, [u, "value"]))
|
|
3022
3022
|
}));
|
|
3023
3023
|
if (s.common.async) {
|
|
3024
3024
|
const o = /* @__PURE__ */ new Map();
|
|
@@ -3046,26 +3046,26 @@ class gn extends T {
|
|
|
3046
3046
|
gn.create = (t, e, n) => new gn(d({
|
|
3047
3047
|
valueType: e,
|
|
3048
3048
|
keyType: t,
|
|
3049
|
-
typeName:
|
|
3049
|
+
typeName: E.ZodMap
|
|
3050
3050
|
}, O(n)));
|
|
3051
3051
|
class et extends T {
|
|
3052
3052
|
_parse(e) {
|
|
3053
3053
|
const { status: n, ctx: s } = this._processInputParams(e);
|
|
3054
|
-
if (s.parsedType !==
|
|
3055
|
-
return
|
|
3054
|
+
if (s.parsedType !== v.set)
|
|
3055
|
+
return y(s, {
|
|
3056
3056
|
code: f.invalid_type,
|
|
3057
|
-
expected:
|
|
3057
|
+
expected: v.set,
|
|
3058
3058
|
received: s.parsedType
|
|
3059
3059
|
}), S;
|
|
3060
3060
|
const r = this._def;
|
|
3061
|
-
r.minSize !== null && s.data.size < r.minSize.value && (
|
|
3061
|
+
r.minSize !== null && s.data.size < r.minSize.value && (y(s, {
|
|
3062
3062
|
code: f.too_small,
|
|
3063
3063
|
minimum: r.minSize.value,
|
|
3064
3064
|
type: "set",
|
|
3065
3065
|
inclusive: !0,
|
|
3066
3066
|
exact: !1,
|
|
3067
3067
|
message: r.minSize.message
|
|
3068
|
-
}), n.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (
|
|
3068
|
+
}), n.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (y(s, {
|
|
3069
3069
|
code: f.too_big,
|
|
3070
3070
|
maximum: r.maxSize.value,
|
|
3071
3071
|
type: "set",
|
|
@@ -3083,16 +3083,16 @@ class et extends T {
|
|
|
3083
3083
|
}
|
|
3084
3084
|
return { status: n.value, value: u };
|
|
3085
3085
|
}
|
|
3086
|
-
const o = [...s.data.values()].map((c, u) => a._parse(new
|
|
3086
|
+
const o = [...s.data.values()].map((c, u) => a._parse(new Ee(s, c, s.path, u)));
|
|
3087
3087
|
return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
3088
3088
|
}
|
|
3089
3089
|
min(e, n) {
|
|
3090
|
-
return new et(
|
|
3090
|
+
return new et(x(d({}, this._def), {
|
|
3091
3091
|
minSize: { value: e, message: w.toString(n) }
|
|
3092
3092
|
}));
|
|
3093
3093
|
}
|
|
3094
3094
|
max(e, n) {
|
|
3095
|
-
return new et(
|
|
3095
|
+
return new et(x(d({}, this._def), {
|
|
3096
3096
|
maxSize: { value: e, message: w.toString(n) }
|
|
3097
3097
|
}));
|
|
3098
3098
|
}
|
|
@@ -3107,7 +3107,7 @@ et.create = (t, e) => new et(d({
|
|
|
3107
3107
|
valueType: t,
|
|
3108
3108
|
minSize: null,
|
|
3109
3109
|
maxSize: null,
|
|
3110
|
-
typeName:
|
|
3110
|
+
typeName: E.ZodSet
|
|
3111
3111
|
}, O(e)));
|
|
3112
3112
|
class ht extends T {
|
|
3113
3113
|
constructor() {
|
|
@@ -3115,10 +3115,10 @@ class ht extends T {
|
|
|
3115
3115
|
}
|
|
3116
3116
|
_parse(e) {
|
|
3117
3117
|
const { ctx: n } = this._processInputParams(e);
|
|
3118
|
-
if (n.parsedType !==
|
|
3119
|
-
return
|
|
3118
|
+
if (n.parsedType !== v.function)
|
|
3119
|
+
return y(n, {
|
|
3120
3120
|
code: f.invalid_type,
|
|
3121
|
-
expected:
|
|
3121
|
+
expected: v.function,
|
|
3122
3122
|
received: n.parsedType
|
|
3123
3123
|
}), S;
|
|
3124
3124
|
function s(o, c) {
|
|
@@ -3186,12 +3186,12 @@ class ht extends T {
|
|
|
3186
3186
|
return this._def.returns;
|
|
3187
3187
|
}
|
|
3188
3188
|
args(...e) {
|
|
3189
|
-
return new ht(
|
|
3190
|
-
args:
|
|
3189
|
+
return new ht(x(d({}, this._def), {
|
|
3190
|
+
args: xe.create(e).rest(Xe.create())
|
|
3191
3191
|
}));
|
|
3192
3192
|
}
|
|
3193
3193
|
returns(e) {
|
|
3194
|
-
return new ht(
|
|
3194
|
+
return new ht(x(d({}, this._def), {
|
|
3195
3195
|
returns: e
|
|
3196
3196
|
}));
|
|
3197
3197
|
}
|
|
@@ -3203,13 +3203,13 @@ class ht extends T {
|
|
|
3203
3203
|
}
|
|
3204
3204
|
static create(e, n, s) {
|
|
3205
3205
|
return new ht(d({
|
|
3206
|
-
args: e ||
|
|
3206
|
+
args: e || xe.create([]).rest(Xe.create()),
|
|
3207
3207
|
returns: n || Xe.create(),
|
|
3208
|
-
typeName:
|
|
3208
|
+
typeName: E.ZodFunction
|
|
3209
3209
|
}, O(s)));
|
|
3210
3210
|
}
|
|
3211
3211
|
}
|
|
3212
|
-
class
|
|
3212
|
+
class $t extends T {
|
|
3213
3213
|
get schema() {
|
|
3214
3214
|
return this._def.getter();
|
|
3215
3215
|
}
|
|
@@ -3218,15 +3218,15 @@ class Ft extends T {
|
|
|
3218
3218
|
return this._def.getter()._parse({ data: n.data, path: n.path, parent: n });
|
|
3219
3219
|
}
|
|
3220
3220
|
}
|
|
3221
|
-
|
|
3221
|
+
$t.create = (t, e) => new $t(d({
|
|
3222
3222
|
getter: t,
|
|
3223
|
-
typeName:
|
|
3223
|
+
typeName: E.ZodLazy
|
|
3224
3224
|
}, O(e)));
|
|
3225
|
-
class
|
|
3225
|
+
class Ft extends T {
|
|
3226
3226
|
_parse(e) {
|
|
3227
3227
|
if (e.data !== this._def.value) {
|
|
3228
3228
|
const n = this._getOrReturnCtx(e);
|
|
3229
|
-
return
|
|
3229
|
+
return y(n, {
|
|
3230
3230
|
received: n.data,
|
|
3231
3231
|
code: f.invalid_literal,
|
|
3232
3232
|
expected: this._def.value
|
|
@@ -3238,32 +3238,32 @@ class $t extends T {
|
|
|
3238
3238
|
return this._def.value;
|
|
3239
3239
|
}
|
|
3240
3240
|
}
|
|
3241
|
-
|
|
3241
|
+
Ft.create = (t, e) => new Ft(d({
|
|
3242
3242
|
value: t,
|
|
3243
|
-
typeName:
|
|
3243
|
+
typeName: E.ZodLiteral
|
|
3244
3244
|
}, O(e)));
|
|
3245
|
-
function
|
|
3246
|
-
return new
|
|
3245
|
+
function Dr(t, e) {
|
|
3246
|
+
return new Fe(d({
|
|
3247
3247
|
values: t,
|
|
3248
|
-
typeName:
|
|
3248
|
+
typeName: E.ZodEnum
|
|
3249
3249
|
}, O(e)));
|
|
3250
3250
|
}
|
|
3251
|
-
class
|
|
3251
|
+
class Fe extends T {
|
|
3252
3252
|
constructor() {
|
|
3253
3253
|
super(...arguments), Ot.set(this, void 0);
|
|
3254
3254
|
}
|
|
3255
3255
|
_parse(e) {
|
|
3256
3256
|
if (typeof e.data != "string") {
|
|
3257
3257
|
const n = this._getOrReturnCtx(e), s = this._def.values;
|
|
3258
|
-
return
|
|
3259
|
-
expected:
|
|
3258
|
+
return y(n, {
|
|
3259
|
+
expected: N.joinValues(s),
|
|
3260
3260
|
received: n.parsedType,
|
|
3261
3261
|
code: f.invalid_type
|
|
3262
3262
|
}), S;
|
|
3263
3263
|
}
|
|
3264
|
-
if (pn(this, Ot) ||
|
|
3264
|
+
if (pn(this, Ot) || Pr(this, Ot, new Set(this._def.values)), !pn(this, Ot).has(e.data)) {
|
|
3265
3265
|
const n = this._getOrReturnCtx(e), s = this._def.values;
|
|
3266
|
-
return
|
|
3266
|
+
return y(n, {
|
|
3267
3267
|
received: n.data,
|
|
3268
3268
|
code: f.invalid_enum_value,
|
|
3269
3269
|
options: s
|
|
@@ -3293,31 +3293,31 @@ class $e extends T {
|
|
|
3293
3293
|
return e;
|
|
3294
3294
|
}
|
|
3295
3295
|
extract(e, n = this._def) {
|
|
3296
|
-
return
|
|
3296
|
+
return Fe.create(e, d(d({}, this._def), n));
|
|
3297
3297
|
}
|
|
3298
3298
|
exclude(e, n = this._def) {
|
|
3299
|
-
return
|
|
3299
|
+
return Fe.create(this.options.filter((s) => !e.includes(s)), d(d({}, this._def), n));
|
|
3300
3300
|
}
|
|
3301
3301
|
}
|
|
3302
3302
|
Ot = /* @__PURE__ */ new WeakMap();
|
|
3303
|
-
|
|
3303
|
+
Fe.create = Dr;
|
|
3304
3304
|
class Wt extends T {
|
|
3305
3305
|
constructor() {
|
|
3306
3306
|
super(...arguments), Tt.set(this, void 0);
|
|
3307
3307
|
}
|
|
3308
3308
|
_parse(e) {
|
|
3309
|
-
const n =
|
|
3310
|
-
if (s.parsedType !==
|
|
3311
|
-
const r =
|
|
3312
|
-
return
|
|
3313
|
-
expected:
|
|
3309
|
+
const n = N.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
3310
|
+
if (s.parsedType !== v.string && s.parsedType !== v.number) {
|
|
3311
|
+
const r = N.objectValues(n);
|
|
3312
|
+
return y(s, {
|
|
3313
|
+
expected: N.joinValues(r),
|
|
3314
3314
|
received: s.parsedType,
|
|
3315
3315
|
code: f.invalid_type
|
|
3316
3316
|
}), S;
|
|
3317
3317
|
}
|
|
3318
|
-
if (pn(this, Tt) ||
|
|
3319
|
-
const r =
|
|
3320
|
-
return
|
|
3318
|
+
if (pn(this, Tt) || Pr(this, Tt, new Set(N.getValidEnumValues(this._def.values))), !pn(this, Tt).has(e.data)) {
|
|
3319
|
+
const r = N.objectValues(n);
|
|
3320
|
+
return y(s, {
|
|
3321
3321
|
received: s.data,
|
|
3322
3322
|
code: f.invalid_enum_value,
|
|
3323
3323
|
options: r
|
|
@@ -3332,7 +3332,7 @@ class Wt extends T {
|
|
|
3332
3332
|
Tt = /* @__PURE__ */ new WeakMap();
|
|
3333
3333
|
Wt.create = (t, e) => new Wt(d({
|
|
3334
3334
|
values: t,
|
|
3335
|
-
typeName:
|
|
3335
|
+
typeName: E.ZodNativeEnum
|
|
3336
3336
|
}, O(e)));
|
|
3337
3337
|
class vt extends T {
|
|
3338
3338
|
unwrap() {
|
|
@@ -3340,13 +3340,13 @@ class vt extends T {
|
|
|
3340
3340
|
}
|
|
3341
3341
|
_parse(e) {
|
|
3342
3342
|
const { ctx: n } = this._processInputParams(e);
|
|
3343
|
-
if (n.parsedType !==
|
|
3344
|
-
return
|
|
3343
|
+
if (n.parsedType !== v.promise && n.common.async === !1)
|
|
3344
|
+
return y(n, {
|
|
3345
3345
|
code: f.invalid_type,
|
|
3346
|
-
expected:
|
|
3346
|
+
expected: v.promise,
|
|
3347
3347
|
received: n.parsedType
|
|
3348
3348
|
}), S;
|
|
3349
|
-
const s = n.parsedType ===
|
|
3349
|
+
const s = n.parsedType === v.promise ? n.data : Promise.resolve(n.data);
|
|
3350
3350
|
return te(s.then((r) => this._def.type.parseAsync(r, {
|
|
3351
3351
|
path: n.path,
|
|
3352
3352
|
errorMap: n.common.contextualErrorMap
|
|
@@ -3355,19 +3355,19 @@ class vt extends T {
|
|
|
3355
3355
|
}
|
|
3356
3356
|
vt.create = (t, e) => new vt(d({
|
|
3357
3357
|
type: t,
|
|
3358
|
-
typeName:
|
|
3358
|
+
typeName: E.ZodPromise
|
|
3359
3359
|
}, O(e)));
|
|
3360
3360
|
class ye extends T {
|
|
3361
3361
|
innerType() {
|
|
3362
3362
|
return this._def.schema;
|
|
3363
3363
|
}
|
|
3364
3364
|
sourceType() {
|
|
3365
|
-
return this._def.schema._def.typeName ===
|
|
3365
|
+
return this._def.schema._def.typeName === E.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
3366
3366
|
}
|
|
3367
3367
|
_parse(e) {
|
|
3368
3368
|
const { status: n, ctx: s } = this._processInputParams(e), r = this._def.effect || null, a = {
|
|
3369
3369
|
addIssue: (i) => {
|
|
3370
|
-
|
|
3370
|
+
y(s, i), i.fatal ? n.abort() : n.dirty();
|
|
3371
3371
|
},
|
|
3372
3372
|
get path() {
|
|
3373
3373
|
return s.path;
|
|
@@ -3431,22 +3431,22 @@ class ye extends T {
|
|
|
3431
3431
|
return { status: n.value, value: o };
|
|
3432
3432
|
} else
|
|
3433
3433
|
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => Ye(i) ? Promise.resolve(r.transform(i.value, a)).then((o) => ({ status: n.value, value: o })) : i);
|
|
3434
|
-
|
|
3434
|
+
N.assertNever(r);
|
|
3435
3435
|
}
|
|
3436
3436
|
}
|
|
3437
3437
|
ye.create = (t, e, n) => new ye(d({
|
|
3438
3438
|
schema: t,
|
|
3439
|
-
typeName:
|
|
3439
|
+
typeName: E.ZodEffects,
|
|
3440
3440
|
effect: e
|
|
3441
3441
|
}, O(n)));
|
|
3442
3442
|
ye.createWithPreprocess = (t, e, n) => new ye(d({
|
|
3443
3443
|
schema: e,
|
|
3444
3444
|
effect: { type: "preprocess", transform: t },
|
|
3445
|
-
typeName:
|
|
3445
|
+
typeName: E.ZodEffects
|
|
3446
3446
|
}, O(n)));
|
|
3447
3447
|
class we extends T {
|
|
3448
3448
|
_parse(e) {
|
|
3449
|
-
return this._getType(e) ===
|
|
3449
|
+
return this._getType(e) === v.undefined ? te(void 0) : this._def.innerType._parse(e);
|
|
3450
3450
|
}
|
|
3451
3451
|
unwrap() {
|
|
3452
3452
|
return this._def.innerType;
|
|
@@ -3454,11 +3454,11 @@ class we extends T {
|
|
|
3454
3454
|
}
|
|
3455
3455
|
we.create = (t, e) => new we(d({
|
|
3456
3456
|
innerType: t,
|
|
3457
|
-
typeName:
|
|
3457
|
+
typeName: E.ZodOptional
|
|
3458
3458
|
}, O(e)));
|
|
3459
3459
|
class We extends T {
|
|
3460
3460
|
_parse(e) {
|
|
3461
|
-
return this._getType(e) ===
|
|
3461
|
+
return this._getType(e) === v.null ? te(null) : this._def.innerType._parse(e);
|
|
3462
3462
|
}
|
|
3463
3463
|
unwrap() {
|
|
3464
3464
|
return this._def.innerType;
|
|
@@ -3466,13 +3466,13 @@ class We extends T {
|
|
|
3466
3466
|
}
|
|
3467
3467
|
We.create = (t, e) => new We(d({
|
|
3468
3468
|
innerType: t,
|
|
3469
|
-
typeName:
|
|
3469
|
+
typeName: E.ZodNullable
|
|
3470
3470
|
}, O(e)));
|
|
3471
|
-
class
|
|
3471
|
+
class Ut extends T {
|
|
3472
3472
|
_parse(e) {
|
|
3473
3473
|
const { ctx: n } = this._processInputParams(e);
|
|
3474
3474
|
let s = n.data;
|
|
3475
|
-
return n.parsedType ===
|
|
3475
|
+
return n.parsedType === v.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
|
|
3476
3476
|
data: s,
|
|
3477
3477
|
path: n.path,
|
|
3478
3478
|
parent: n
|
|
@@ -3482,15 +3482,15 @@ class Vt extends T {
|
|
|
3482
3482
|
return this._def.innerType;
|
|
3483
3483
|
}
|
|
3484
3484
|
}
|
|
3485
|
-
|
|
3485
|
+
Ut.create = (t, e) => new Ut(d({
|
|
3486
3486
|
innerType: t,
|
|
3487
|
-
typeName:
|
|
3487
|
+
typeName: E.ZodDefault,
|
|
3488
3488
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
3489
3489
|
}, O(e)));
|
|
3490
|
-
class
|
|
3490
|
+
class Vt extends T {
|
|
3491
3491
|
_parse(e) {
|
|
3492
|
-
const { ctx: n } = this._processInputParams(e), s =
|
|
3493
|
-
common:
|
|
3492
|
+
const { ctx: n } = this._processInputParams(e), s = x(d({}, n), {
|
|
3493
|
+
common: x(d({}, n.common), {
|
|
3494
3494
|
issues: []
|
|
3495
3495
|
})
|
|
3496
3496
|
}), r = this._def.innerType._parse({
|
|
@@ -3520,18 +3520,18 @@ class Ut extends T {
|
|
|
3520
3520
|
return this._def.innerType;
|
|
3521
3521
|
}
|
|
3522
3522
|
}
|
|
3523
|
-
|
|
3523
|
+
Vt.create = (t, e) => new Vt(d({
|
|
3524
3524
|
innerType: t,
|
|
3525
|
-
typeName:
|
|
3525
|
+
typeName: E.ZodCatch,
|
|
3526
3526
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
3527
3527
|
}, O(e)));
|
|
3528
3528
|
class vn extends T {
|
|
3529
3529
|
_parse(e) {
|
|
3530
|
-
if (this._getType(e) !==
|
|
3530
|
+
if (this._getType(e) !== v.nan) {
|
|
3531
3531
|
const n = this._getOrReturnCtx(e);
|
|
3532
|
-
return
|
|
3532
|
+
return y(n, {
|
|
3533
3533
|
code: f.invalid_type,
|
|
3534
|
-
expected:
|
|
3534
|
+
expected: v.nan,
|
|
3535
3535
|
received: n.parsedType
|
|
3536
3536
|
}), S;
|
|
3537
3537
|
}
|
|
@@ -3539,9 +3539,9 @@ class vn extends T {
|
|
|
3539
3539
|
}
|
|
3540
3540
|
}
|
|
3541
3541
|
vn.create = (t) => new vn(d({
|
|
3542
|
-
typeName:
|
|
3542
|
+
typeName: E.ZodNaN
|
|
3543
3543
|
}, O(t)));
|
|
3544
|
-
const
|
|
3544
|
+
const to = Symbol("zod_brand");
|
|
3545
3545
|
class Ns extends T {
|
|
3546
3546
|
_parse(e) {
|
|
3547
3547
|
const { ctx: n } = this._processInputParams(e), s = n.data;
|
|
@@ -3591,7 +3591,7 @@ class Jt extends T {
|
|
|
3591
3591
|
return new Jt({
|
|
3592
3592
|
in: e,
|
|
3593
3593
|
out: n,
|
|
3594
|
-
typeName:
|
|
3594
|
+
typeName: E.ZodPipeline
|
|
3595
3595
|
});
|
|
3596
3596
|
}
|
|
3597
3597
|
}
|
|
@@ -3606,13 +3606,13 @@ class zt extends T {
|
|
|
3606
3606
|
}
|
|
3607
3607
|
zt.create = (t, e) => new zt(d({
|
|
3608
3608
|
innerType: t,
|
|
3609
|
-
typeName:
|
|
3609
|
+
typeName: E.ZodReadonly
|
|
3610
3610
|
}, O(e)));
|
|
3611
3611
|
function ar(t, e) {
|
|
3612
3612
|
const n = typeof t == "function" ? t(e) : typeof t == "string" ? { message: t } : t;
|
|
3613
3613
|
return typeof n == "string" ? { message: n } : n;
|
|
3614
3614
|
}
|
|
3615
|
-
function
|
|
3615
|
+
function Mr(t, e = {}, n) {
|
|
3616
3616
|
return t ? gt.create().superRefine((s, r) => {
|
|
3617
3617
|
var a, i;
|
|
3618
3618
|
const o = t(s);
|
|
@@ -3621,41 +3621,41 @@ function Dr(t, e = {}, n) {
|
|
|
3621
3621
|
var u, h;
|
|
3622
3622
|
if (!c) {
|
|
3623
3623
|
const p = ar(e, s), k = (h = (u = p.fatal) !== null && u !== void 0 ? u : n) !== null && h !== void 0 ? h : !0;
|
|
3624
|
-
r.addIssue(
|
|
3624
|
+
r.addIssue(x(d({ code: "custom" }, p), { fatal: k }));
|
|
3625
3625
|
}
|
|
3626
3626
|
});
|
|
3627
3627
|
if (!o) {
|
|
3628
3628
|
const c = ar(e, s), u = (i = (a = c.fatal) !== null && a !== void 0 ? a : n) !== null && i !== void 0 ? i : !0;
|
|
3629
|
-
r.addIssue(
|
|
3629
|
+
r.addIssue(x(d({ code: "custom" }, c), { fatal: u }));
|
|
3630
3630
|
}
|
|
3631
3631
|
}) : gt.create();
|
|
3632
3632
|
}
|
|
3633
|
-
const
|
|
3634
|
-
object:
|
|
3633
|
+
const no = {
|
|
3634
|
+
object: U.lazycreate
|
|
3635
3635
|
};
|
|
3636
|
-
var
|
|
3636
|
+
var E;
|
|
3637
3637
|
(function(t) {
|
|
3638
3638
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
3639
|
-
})(
|
|
3640
|
-
const
|
|
3639
|
+
})(E || (E = {}));
|
|
3640
|
+
const so = (t, e = {
|
|
3641
3641
|
message: `Input not instance of ${t.name}`
|
|
3642
|
-
}) =>
|
|
3643
|
-
string: (t) => pe.create(
|
|
3644
|
-
number: (t) => Le.create(
|
|
3645
|
-
boolean: (t) => It.create(
|
|
3642
|
+
}) => Mr((n) => n instanceof t, e), Lr = pe.create, $r = Le.create, ro = vn.create, ao = $e.create, Fr = It.create, io = Qe.create, oo = mn.create, co = jt.create, uo = Zt.create, lo = gt.create, fo = Xe.create, ho = Pe.create, po = yn.create, mo = me.create, yo = U.create, go = U.strictCreate, vo = Dt.create, _o = En.create, bo = Mt.create, wo = xe.create, ko = Lt.create, Eo = gn.create, xo = et.create, So = ht.create, Oo = $t.create, To = Ft.create, Co = Fe.create, Ao = Wt.create, No = vt.create, ir = ye.create, Ro = we.create, Po = We.create, Io = ye.createWithPreprocess, jo = Jt.create, Zo = () => Lr().optional(), Do = () => $r().optional(), Mo = () => Fr().optional(), Lo = {
|
|
3643
|
+
string: (t) => pe.create(x(d({}, t), { coerce: !0 })),
|
|
3644
|
+
number: (t) => Le.create(x(d({}, t), { coerce: !0 })),
|
|
3645
|
+
boolean: (t) => It.create(x(d({}, t), {
|
|
3646
3646
|
coerce: !0
|
|
3647
3647
|
})),
|
|
3648
|
-
bigint: (t) =>
|
|
3649
|
-
date: (t) => Qe.create(
|
|
3650
|
-
},
|
|
3651
|
-
var
|
|
3648
|
+
bigint: (t) => $e.create(x(d({}, t), { coerce: !0 })),
|
|
3649
|
+
date: (t) => Qe.create(x(d({}, t), { coerce: !0 }))
|
|
3650
|
+
}, $o = S;
|
|
3651
|
+
var D = /* @__PURE__ */ Object.freeze({
|
|
3652
3652
|
__proto__: null,
|
|
3653
3653
|
defaultErrorMap: yt,
|
|
3654
|
-
setErrorMap:
|
|
3654
|
+
setErrorMap: Pi,
|
|
3655
3655
|
getErrorMap: ln,
|
|
3656
3656
|
makeIssue: fn,
|
|
3657
|
-
EMPTY_PATH:
|
|
3658
|
-
addIssueToContext:
|
|
3657
|
+
EMPTY_PATH: Ii,
|
|
3658
|
+
addIssueToContext: y,
|
|
3659
3659
|
ParseStatus: X,
|
|
3660
3660
|
INVALID: S,
|
|
3661
3661
|
DIRTY: hn,
|
|
@@ -3665,18 +3665,18 @@ var I = /* @__PURE__ */ Object.freeze({
|
|
|
3665
3665
|
isValid: Ye,
|
|
3666
3666
|
isAsync: Pt,
|
|
3667
3667
|
get util() {
|
|
3668
|
-
return
|
|
3668
|
+
return N;
|
|
3669
3669
|
},
|
|
3670
3670
|
get objectUtil() {
|
|
3671
3671
|
return ts;
|
|
3672
3672
|
},
|
|
3673
|
-
ZodParsedType:
|
|
3673
|
+
ZodParsedType: v,
|
|
3674
3674
|
getParsedType: Ne,
|
|
3675
3675
|
ZodType: T,
|
|
3676
|
-
datetimeRegex:
|
|
3676
|
+
datetimeRegex: Zr,
|
|
3677
3677
|
ZodString: pe,
|
|
3678
3678
|
ZodNumber: Le,
|
|
3679
|
-
ZodBigInt:
|
|
3679
|
+
ZodBigInt: $e,
|
|
3680
3680
|
ZodBoolean: It,
|
|
3681
3681
|
ZodDate: Qe,
|
|
3682
3682
|
ZodSymbol: mn,
|
|
@@ -3687,93 +3687,93 @@ var I = /* @__PURE__ */ Object.freeze({
|
|
|
3687
3687
|
ZodNever: Pe,
|
|
3688
3688
|
ZodVoid: yn,
|
|
3689
3689
|
ZodArray: me,
|
|
3690
|
-
ZodObject:
|
|
3690
|
+
ZodObject: U,
|
|
3691
3691
|
ZodUnion: Dt,
|
|
3692
|
-
ZodDiscriminatedUnion:
|
|
3692
|
+
ZodDiscriminatedUnion: En,
|
|
3693
3693
|
ZodIntersection: Mt,
|
|
3694
|
-
ZodTuple:
|
|
3694
|
+
ZodTuple: xe,
|
|
3695
3695
|
ZodRecord: Lt,
|
|
3696
3696
|
ZodMap: gn,
|
|
3697
3697
|
ZodSet: et,
|
|
3698
3698
|
ZodFunction: ht,
|
|
3699
|
-
ZodLazy:
|
|
3700
|
-
ZodLiteral:
|
|
3701
|
-
ZodEnum:
|
|
3699
|
+
ZodLazy: $t,
|
|
3700
|
+
ZodLiteral: Ft,
|
|
3701
|
+
ZodEnum: Fe,
|
|
3702
3702
|
ZodNativeEnum: Wt,
|
|
3703
3703
|
ZodPromise: vt,
|
|
3704
3704
|
ZodEffects: ye,
|
|
3705
3705
|
ZodTransformer: ye,
|
|
3706
3706
|
ZodOptional: we,
|
|
3707
3707
|
ZodNullable: We,
|
|
3708
|
-
ZodDefault:
|
|
3709
|
-
ZodCatch:
|
|
3708
|
+
ZodDefault: Ut,
|
|
3709
|
+
ZodCatch: Vt,
|
|
3710
3710
|
ZodNaN: vn,
|
|
3711
|
-
BRAND:
|
|
3711
|
+
BRAND: to,
|
|
3712
3712
|
ZodBranded: Ns,
|
|
3713
3713
|
ZodPipeline: Jt,
|
|
3714
3714
|
ZodReadonly: zt,
|
|
3715
|
-
custom:
|
|
3715
|
+
custom: Mr,
|
|
3716
3716
|
Schema: T,
|
|
3717
3717
|
ZodSchema: T,
|
|
3718
|
-
late:
|
|
3718
|
+
late: no,
|
|
3719
3719
|
get ZodFirstPartyTypeKind() {
|
|
3720
|
-
return
|
|
3720
|
+
return E;
|
|
3721
3721
|
},
|
|
3722
|
-
coerce:
|
|
3723
|
-
any:
|
|
3724
|
-
array:
|
|
3725
|
-
bigint:
|
|
3722
|
+
coerce: Lo,
|
|
3723
|
+
any: lo,
|
|
3724
|
+
array: mo,
|
|
3725
|
+
bigint: ao,
|
|
3726
3726
|
boolean: Fr,
|
|
3727
|
-
date:
|
|
3728
|
-
discriminatedUnion:
|
|
3727
|
+
date: io,
|
|
3728
|
+
discriminatedUnion: _o,
|
|
3729
3729
|
effect: ir,
|
|
3730
|
-
enum:
|
|
3731
|
-
function:
|
|
3732
|
-
instanceof:
|
|
3733
|
-
intersection:
|
|
3734
|
-
lazy:
|
|
3735
|
-
literal:
|
|
3736
|
-
map:
|
|
3737
|
-
nan:
|
|
3738
|
-
nativeEnum:
|
|
3739
|
-
never:
|
|
3740
|
-
null:
|
|
3741
|
-
nullable:
|
|
3742
|
-
number:
|
|
3743
|
-
object:
|
|
3744
|
-
oboolean:
|
|
3745
|
-
onumber:
|
|
3746
|
-
optional:
|
|
3747
|
-
ostring:
|
|
3748
|
-
pipeline:
|
|
3749
|
-
preprocess:
|
|
3750
|
-
promise:
|
|
3751
|
-
record:
|
|
3730
|
+
enum: Co,
|
|
3731
|
+
function: So,
|
|
3732
|
+
instanceof: so,
|
|
3733
|
+
intersection: bo,
|
|
3734
|
+
lazy: Oo,
|
|
3735
|
+
literal: To,
|
|
3736
|
+
map: Eo,
|
|
3737
|
+
nan: ro,
|
|
3738
|
+
nativeEnum: Ao,
|
|
3739
|
+
never: ho,
|
|
3740
|
+
null: uo,
|
|
3741
|
+
nullable: Po,
|
|
3742
|
+
number: $r,
|
|
3743
|
+
object: yo,
|
|
3744
|
+
oboolean: Mo,
|
|
3745
|
+
onumber: Do,
|
|
3746
|
+
optional: Ro,
|
|
3747
|
+
ostring: Zo,
|
|
3748
|
+
pipeline: jo,
|
|
3749
|
+
preprocess: Io,
|
|
3750
|
+
promise: No,
|
|
3751
|
+
record: ko,
|
|
3752
3752
|
set: xo,
|
|
3753
|
-
strictObject:
|
|
3754
|
-
string:
|
|
3755
|
-
symbol:
|
|
3753
|
+
strictObject: go,
|
|
3754
|
+
string: Lr,
|
|
3755
|
+
symbol: oo,
|
|
3756
3756
|
transformer: ir,
|
|
3757
|
-
tuple:
|
|
3758
|
-
undefined:
|
|
3759
|
-
union:
|
|
3760
|
-
unknown:
|
|
3761
|
-
void:
|
|
3762
|
-
NEVER:
|
|
3757
|
+
tuple: wo,
|
|
3758
|
+
undefined: co,
|
|
3759
|
+
union: vo,
|
|
3760
|
+
unknown: fo,
|
|
3761
|
+
void: po,
|
|
3762
|
+
NEVER: $o,
|
|
3763
3763
|
ZodIssueCode: f,
|
|
3764
|
-
quotelessJson:
|
|
3764
|
+
quotelessJson: Ri,
|
|
3765
3765
|
ZodError: ie
|
|
3766
3766
|
});
|
|
3767
|
-
|
|
3768
|
-
language:
|
|
3769
|
-
disableMarkedForExport:
|
|
3770
|
-
allowAutoSelectFirstNode:
|
|
3767
|
+
D.object({
|
|
3768
|
+
language: D.enum(["typescript", "javascript"]).optional(),
|
|
3769
|
+
disableMarkedForExport: D.boolean().optional(),
|
|
3770
|
+
allowAutoSelectFirstNode: D.boolean().optional().default(!0)
|
|
3771
3771
|
}).and(
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
framework:
|
|
3775
|
-
model:
|
|
3776
|
-
styling:
|
|
3772
|
+
D.union([
|
|
3773
|
+
D.object({
|
|
3774
|
+
framework: D.literal("react"),
|
|
3775
|
+
model: D.string().optional(),
|
|
3776
|
+
styling: D.enum([
|
|
3777
3777
|
"plain_css",
|
|
3778
3778
|
"css_modules",
|
|
3779
3779
|
"styled_components",
|
|
@@ -3782,26 +3782,26 @@ I.object({
|
|
|
3782
3782
|
"scss",
|
|
3783
3783
|
"inline_styles"
|
|
3784
3784
|
]),
|
|
3785
|
-
uiLibrary:
|
|
3786
|
-
responsivePages:
|
|
3787
|
-
|
|
3788
|
-
name:
|
|
3789
|
-
framesId:
|
|
3785
|
+
uiLibrary: D.enum(["mui", "antd", "radix", "shadcn", "clean_react"]).optional(),
|
|
3786
|
+
responsivePages: D.array(
|
|
3787
|
+
D.object({
|
|
3788
|
+
name: D.string(),
|
|
3789
|
+
framesId: D.array(D.string())
|
|
3790
3790
|
})
|
|
3791
3791
|
).optional(),
|
|
3792
|
-
enableUILibraryTheming:
|
|
3793
|
-
enableCompactStructure:
|
|
3794
|
-
enableDisplayScreenModelId:
|
|
3795
|
-
enableGeneratePackageLock:
|
|
3796
|
-
enableAutoSplit:
|
|
3797
|
-
autoSplitThreshold:
|
|
3798
|
-
url:
|
|
3799
|
-
codegenSettings:
|
|
3792
|
+
enableUILibraryTheming: D.boolean().optional(),
|
|
3793
|
+
enableCompactStructure: D.boolean().optional(),
|
|
3794
|
+
enableDisplayScreenModelId: D.boolean().optional(),
|
|
3795
|
+
enableGeneratePackageLock: D.boolean().optional(),
|
|
3796
|
+
enableAutoSplit: D.boolean().optional(),
|
|
3797
|
+
autoSplitThreshold: D.number().optional(),
|
|
3798
|
+
url: D.string().url().optional(),
|
|
3799
|
+
codegenSettings: D.record(D.unknown()).optional()
|
|
3800
3800
|
}),
|
|
3801
|
-
|
|
3802
|
-
framework:
|
|
3803
|
-
styling:
|
|
3804
|
-
enableTranslation:
|
|
3801
|
+
D.object({
|
|
3802
|
+
framework: D.literal("html"),
|
|
3803
|
+
styling: D.enum(["plain_css", "inline_styles", "tailwind"]),
|
|
3804
|
+
enableTranslation: D.boolean().optional()
|
|
3805
3805
|
})
|
|
3806
3806
|
])
|
|
3807
3807
|
);
|
|
@@ -3819,61 +3819,61 @@ function Fo(t) {
|
|
|
3819
3819
|
);
|
|
3820
3820
|
const { onEvent: e = Zn, onError: n = Zn, onRetry: s = Zn, onComment: r } = t;
|
|
3821
3821
|
let a = "", i = !0, o, c = "", u = "";
|
|
3822
|
-
function h(
|
|
3823
|
-
const
|
|
3824
|
-
for (const
|
|
3825
|
-
p(
|
|
3826
|
-
a =
|
|
3827
|
-
}
|
|
3828
|
-
function p(
|
|
3829
|
-
if (
|
|
3830
|
-
|
|
3822
|
+
function h(m) {
|
|
3823
|
+
const _ = i ? m.replace(/^\xEF\xBB\xBF/, "") : m, [l, A] = Wo(`${a}${_}`);
|
|
3824
|
+
for (const I of l)
|
|
3825
|
+
p(I);
|
|
3826
|
+
a = A, i = !1;
|
|
3827
|
+
}
|
|
3828
|
+
function p(m) {
|
|
3829
|
+
if (m === "") {
|
|
3830
|
+
g();
|
|
3831
3831
|
return;
|
|
3832
3832
|
}
|
|
3833
|
-
if (
|
|
3834
|
-
r && r(
|
|
3833
|
+
if (m.startsWith(":")) {
|
|
3834
|
+
r && r(m.slice(m.startsWith(": ") ? 2 : 1));
|
|
3835
3835
|
return;
|
|
3836
3836
|
}
|
|
3837
|
-
const
|
|
3838
|
-
if (
|
|
3839
|
-
const
|
|
3840
|
-
k(
|
|
3837
|
+
const _ = m.indexOf(":");
|
|
3838
|
+
if (_ !== -1) {
|
|
3839
|
+
const l = m.slice(0, _), A = m[_ + 1] === " " ? 2 : 1, I = m.slice(_ + A);
|
|
3840
|
+
k(l, I, m);
|
|
3841
3841
|
return;
|
|
3842
3842
|
}
|
|
3843
|
-
k(
|
|
3843
|
+
k(m, "", m);
|
|
3844
3844
|
}
|
|
3845
|
-
function k(
|
|
3846
|
-
switch (
|
|
3845
|
+
function k(m, _, l) {
|
|
3846
|
+
switch (m) {
|
|
3847
3847
|
case "event":
|
|
3848
|
-
u =
|
|
3848
|
+
u = _;
|
|
3849
3849
|
break;
|
|
3850
3850
|
case "data":
|
|
3851
|
-
c = `${c}${
|
|
3851
|
+
c = `${c}${_}
|
|
3852
3852
|
`;
|
|
3853
3853
|
break;
|
|
3854
3854
|
case "id":
|
|
3855
|
-
o =
|
|
3855
|
+
o = _.includes("\0") ? void 0 : _;
|
|
3856
3856
|
break;
|
|
3857
3857
|
case "retry":
|
|
3858
|
-
/^\d+$/.test(
|
|
3859
|
-
new or(`Invalid \`retry\` value: "${
|
|
3858
|
+
/^\d+$/.test(_) ? s(parseInt(_, 10)) : n(
|
|
3859
|
+
new or(`Invalid \`retry\` value: "${_}"`, {
|
|
3860
3860
|
type: "invalid-retry",
|
|
3861
|
-
value:
|
|
3862
|
-
line:
|
|
3861
|
+
value: _,
|
|
3862
|
+
line: l
|
|
3863
3863
|
})
|
|
3864
3864
|
);
|
|
3865
3865
|
break;
|
|
3866
3866
|
default:
|
|
3867
3867
|
n(
|
|
3868
3868
|
new or(
|
|
3869
|
-
`Unknown field "${
|
|
3870
|
-
{ type: "unknown-field", field:
|
|
3869
|
+
`Unknown field "${m.length > 20 ? `${m.slice(0, 20)}…` : m}"`,
|
|
3870
|
+
{ type: "unknown-field", field: m, value: _, line: l }
|
|
3871
3871
|
)
|
|
3872
3872
|
);
|
|
3873
3873
|
break;
|
|
3874
3874
|
}
|
|
3875
3875
|
}
|
|
3876
|
-
function
|
|
3876
|
+
function g() {
|
|
3877
3877
|
c.length > 0 && e({
|
|
3878
3878
|
id: o,
|
|
3879
3879
|
event: u || void 0,
|
|
@@ -3883,12 +3883,12 @@ function Fo(t) {
|
|
|
3883
3883
|
`) ? c.slice(0, -1) : c
|
|
3884
3884
|
}), o = void 0, c = "", u = "";
|
|
3885
3885
|
}
|
|
3886
|
-
function b(
|
|
3887
|
-
a &&
|
|
3886
|
+
function b(m = {}) {
|
|
3887
|
+
a && m.consume && p(a), i = !0, o = void 0, c = "", u = "", a = "";
|
|
3888
3888
|
}
|
|
3889
3889
|
return { feed: h, reset: b };
|
|
3890
3890
|
}
|
|
3891
|
-
function
|
|
3891
|
+
function Wo(t) {
|
|
3892
3892
|
const e = [];
|
|
3893
3893
|
let n = "", s = 0;
|
|
3894
3894
|
for (; s < t.length; ) {
|
|
@@ -3948,7 +3948,7 @@ class cr extends Event {
|
|
|
3948
3948
|
return e(ur(this), n);
|
|
3949
3949
|
}
|
|
3950
3950
|
}
|
|
3951
|
-
function
|
|
3951
|
+
function Uo(t) {
|
|
3952
3952
|
const e = globalThis.DOMException;
|
|
3953
3953
|
return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
|
|
3954
3954
|
}
|
|
@@ -3965,13 +3965,13 @@ function ur(t) {
|
|
|
3965
3965
|
timeStamp: t.timeStamp
|
|
3966
3966
|
};
|
|
3967
3967
|
}
|
|
3968
|
-
var
|
|
3968
|
+
var Wr = (t) => {
|
|
3969
3969
|
throw TypeError(t);
|
|
3970
|
-
}, Rs = (t, e, n) => e.has(t) ||
|
|
3970
|
+
}, Rs = (t, e, n) => e.has(t) || Wr("Cannot " + n), C = (t, e, n) => (Rs(t, e, "read from private field"), n ? n.call(t) : e.get(t)), q = (t, e, n) => e.has(t) ? Wr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), W = (t, e, n, s) => (Rs(t, e, "write to private field"), e.set(t, n), n), Ae = (t, e, n) => (Rs(t, e, "access private method"), n), se, Je, ut, un, _n, Nt, ft, Rt, De, dt, pt, lt, Ct, he, is, os, cs, dr, us, ds, At, ls, fs;
|
|
3971
3971
|
class dn extends EventTarget {
|
|
3972
3972
|
constructor(e, n) {
|
|
3973
3973
|
var s, r;
|
|
3974
|
-
super(),
|
|
3974
|
+
super(), q(this, he), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, q(this, se), q(this, Je), q(this, ut), q(this, un), q(this, _n), q(this, Nt), q(this, ft), q(this, Rt, null), q(this, De), q(this, dt), q(this, pt, null), q(this, lt, null), q(this, Ct, null), q(this, os, (a) => Ie(this, null, function* () {
|
|
3975
3975
|
var i;
|
|
3976
3976
|
C(this, dt).reset();
|
|
3977
3977
|
const { body: o, redirected: c, status: u, headers: h } = a;
|
|
@@ -3979,7 +3979,7 @@ class dn extends EventTarget {
|
|
|
3979
3979
|
Ae(this, he, At).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
3980
3980
|
return;
|
|
3981
3981
|
}
|
|
3982
|
-
if (c ?
|
|
3982
|
+
if (c ? W(this, ut, new URL(a.url)) : W(this, ut, void 0), u !== 200) {
|
|
3983
3983
|
Ae(this, he, At).call(this, `Non-200 status code (${u})`, u);
|
|
3984
3984
|
return;
|
|
3985
3985
|
}
|
|
@@ -3989,47 +3989,47 @@ class dn extends EventTarget {
|
|
|
3989
3989
|
}
|
|
3990
3990
|
if (C(this, se) === this.CLOSED)
|
|
3991
3991
|
return;
|
|
3992
|
-
|
|
3992
|
+
W(this, se, this.OPEN);
|
|
3993
3993
|
const p = new Event("open");
|
|
3994
3994
|
if ((i = C(this, Ct)) == null || i.call(this, p), this.dispatchEvent(p), typeof o != "object" || !o || !("getReader" in o)) {
|
|
3995
3995
|
Ae(this, he, At).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
3996
3996
|
return;
|
|
3997
3997
|
}
|
|
3998
|
-
const k = new TextDecoder(),
|
|
3998
|
+
const k = new TextDecoder(), g = o.getReader();
|
|
3999
3999
|
let b = !0;
|
|
4000
4000
|
do {
|
|
4001
|
-
const { done:
|
|
4002
|
-
|
|
4001
|
+
const { done: m, value: _ } = yield g.read();
|
|
4002
|
+
_ && C(this, dt).feed(k.decode(_, { stream: !m })), m && (b = !1, C(this, dt).reset(), Ae(this, he, ls).call(this));
|
|
4003
4003
|
} while (b);
|
|
4004
|
-
})),
|
|
4005
|
-
|
|
4006
|
-
}),
|
|
4007
|
-
typeof a.id == "string" &&
|
|
4004
|
+
})), q(this, cs, (a) => {
|
|
4005
|
+
W(this, De, void 0), !(a.name === "AbortError" || a.type === "aborted") && Ae(this, he, ls).call(this, as(a));
|
|
4006
|
+
}), q(this, us, (a) => {
|
|
4007
|
+
typeof a.id == "string" && W(this, Rt, a.id);
|
|
4008
4008
|
const i = new MessageEvent(a.event || "message", {
|
|
4009
4009
|
data: a.data,
|
|
4010
4010
|
origin: C(this, ut) ? C(this, ut).origin : C(this, Je).origin,
|
|
4011
4011
|
lastEventId: a.id || ""
|
|
4012
4012
|
});
|
|
4013
4013
|
C(this, lt) && (!a.event || a.event === "message") && C(this, lt).call(this, i), this.dispatchEvent(i);
|
|
4014
|
-
}),
|
|
4015
|
-
|
|
4016
|
-
}),
|
|
4017
|
-
|
|
4014
|
+
}), q(this, ds, (a) => {
|
|
4015
|
+
W(this, Nt, a);
|
|
4016
|
+
}), q(this, fs, () => {
|
|
4017
|
+
W(this, ft, void 0), C(this, se) === this.CONNECTING && Ae(this, he, is).call(this);
|
|
4018
4018
|
});
|
|
4019
4019
|
try {
|
|
4020
4020
|
if (e instanceof URL)
|
|
4021
|
-
|
|
4021
|
+
W(this, Je, e);
|
|
4022
4022
|
else if (typeof e == "string")
|
|
4023
|
-
|
|
4023
|
+
W(this, Je, new URL(e, Vo()));
|
|
4024
4024
|
else
|
|
4025
4025
|
throw new Error("Invalid URL");
|
|
4026
4026
|
} catch (a) {
|
|
4027
|
-
throw
|
|
4027
|
+
throw Uo("An invalid or illegal string was specified");
|
|
4028
4028
|
}
|
|
4029
|
-
|
|
4029
|
+
W(this, dt, Fo({
|
|
4030
4030
|
onEvent: C(this, us),
|
|
4031
4031
|
onRetry: C(this, ds)
|
|
4032
|
-
})),
|
|
4032
|
+
})), W(this, se, this.CONNECTING), W(this, Nt, 3e3), W(this, _n, (s = n == null ? void 0 : n.fetch) != null ? s : globalThis.fetch), W(this, un, (r = n == null ? void 0 : n.withCredentials) != null ? r : !1), Ae(this, he, is).call(this);
|
|
4033
4033
|
}
|
|
4034
4034
|
/**
|
|
4035
4035
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -4067,21 +4067,21 @@ class dn extends EventTarget {
|
|
|
4067
4067
|
return C(this, pt);
|
|
4068
4068
|
}
|
|
4069
4069
|
set onerror(e) {
|
|
4070
|
-
|
|
4070
|
+
W(this, pt, e);
|
|
4071
4071
|
}
|
|
4072
4072
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
4073
4073
|
get onmessage() {
|
|
4074
4074
|
return C(this, lt);
|
|
4075
4075
|
}
|
|
4076
4076
|
set onmessage(e) {
|
|
4077
|
-
|
|
4077
|
+
W(this, lt, e);
|
|
4078
4078
|
}
|
|
4079
4079
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
4080
4080
|
get onopen() {
|
|
4081
4081
|
return C(this, Ct);
|
|
4082
4082
|
}
|
|
4083
4083
|
set onopen(e) {
|
|
4084
|
-
|
|
4084
|
+
W(this, Ct, e);
|
|
4085
4085
|
}
|
|
4086
4086
|
addEventListener(e, n, s) {
|
|
4087
4087
|
const r = n;
|
|
@@ -4099,7 +4099,7 @@ class dn extends EventTarget {
|
|
|
4099
4099
|
* @public
|
|
4100
4100
|
*/
|
|
4101
4101
|
close() {
|
|
4102
|
-
C(this, ft) && clearTimeout(C(this, ft)), C(this, se) !== this.CLOSED && (C(this, De) && C(this, De).abort(),
|
|
4102
|
+
C(this, ft) && clearTimeout(C(this, ft)), C(this, se) !== this.CLOSED && (C(this, De) && C(this, De).abort(), W(this, se, this.CLOSED), W(this, De, void 0));
|
|
4103
4103
|
}
|
|
4104
4104
|
}
|
|
4105
4105
|
se = /* @__PURE__ */ new WeakMap(), Je = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), un = /* @__PURE__ */ new WeakMap(), _n = /* @__PURE__ */ new WeakMap(), Nt = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), Rt = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakMap(), Ct = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakSet(), /**
|
|
@@ -4108,7 +4108,7 @@ se = /* @__PURE__ */ new WeakMap(), Je = /* @__PURE__ */ new WeakMap(), ut = /*
|
|
|
4108
4108
|
* @internal
|
|
4109
4109
|
*/
|
|
4110
4110
|
is = function() {
|
|
4111
|
-
|
|
4111
|
+
W(this, se, this.CONNECTING), W(this, De, new AbortController()), C(this, _n)(C(this, Je), Ae(this, he, dr).call(this)).then(C(this, os)).catch(C(this, cs));
|
|
4112
4112
|
}, os = /* @__PURE__ */ new WeakMap(), cs = /* @__PURE__ */ new WeakMap(), /**
|
|
4113
4113
|
* Get request options for the `fetch()` request
|
|
4114
4114
|
*
|
|
@@ -4136,7 +4136,7 @@ dr = function() {
|
|
|
4136
4136
|
*/
|
|
4137
4137
|
At = function(t, e) {
|
|
4138
4138
|
var n;
|
|
4139
|
-
C(this, se) !== this.CLOSED &&
|
|
4139
|
+
C(this, se) !== this.CLOSED && W(this, se, this.CLOSED);
|
|
4140
4140
|
const s = new cr("error", { code: e, message: t });
|
|
4141
4141
|
(n = C(this, pt)) == null || n.call(this, s), this.dispatchEvent(s);
|
|
4142
4142
|
}, /**
|
|
@@ -4150,9 +4150,9 @@ ls = function(t, e) {
|
|
|
4150
4150
|
var n;
|
|
4151
4151
|
if (C(this, se) === this.CLOSED)
|
|
4152
4152
|
return;
|
|
4153
|
-
|
|
4153
|
+
W(this, se, this.CONNECTING);
|
|
4154
4154
|
const s = new cr("error", { code: e, message: t });
|
|
4155
|
-
(n = C(this, pt)) == null || n.call(this, s), this.dispatchEvent(s),
|
|
4155
|
+
(n = C(this, pt)) == null || n.call(this, s), this.dispatchEvent(s), W(this, ft, setTimeout(C(this, fs), C(this, Nt)));
|
|
4156
4156
|
}, fs = /* @__PURE__ */ new WeakMap(), /**
|
|
4157
4157
|
* ReadyState representing an EventSource currently trying to connect
|
|
4158
4158
|
*
|
|
@@ -4173,7 +4173,7 @@ function Vo() {
|
|
|
4173
4173
|
const t = "document" in globalThis ? globalThis.document : void 0;
|
|
4174
4174
|
return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
|
|
4175
4175
|
}
|
|
4176
|
-
var
|
|
4176
|
+
var Ur = Symbol.for("immer-nothing"), lr = Symbol.for("immer-draftable"), oe = Symbol.for("immer-state"), zo = process.env.NODE_ENV !== "production" ? [
|
|
4177
4177
|
// All error codes, starting by 0:
|
|
4178
4178
|
function(t) {
|
|
4179
4179
|
return `The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`;
|
|
@@ -4206,7 +4206,7 @@ var Wr = Symbol.for("immer-nothing"), lr = Symbol.for("immer-draftable"), oe = S
|
|
|
4206
4206
|
] : [];
|
|
4207
4207
|
function re(t, ...e) {
|
|
4208
4208
|
if (process.env.NODE_ENV !== "production") {
|
|
4209
|
-
const n =
|
|
4209
|
+
const n = zo[t], s = typeof n == "function" ? n.apply(null, e) : n;
|
|
4210
4210
|
throw new Error(`[Immer] ${s}`);
|
|
4211
4211
|
}
|
|
4212
4212
|
throw new Error(
|
|
@@ -4221,7 +4221,7 @@ function tt(t) {
|
|
|
4221
4221
|
var e;
|
|
4222
4222
|
return t ? Vr(t) || Array.isArray(t) || !!t[lr] || !!((e = t.constructor) != null && e[lr]) || Sn(t) || On(t) : !1;
|
|
4223
4223
|
}
|
|
4224
|
-
var
|
|
4224
|
+
var Ko = Object.prototype.constructor.toString();
|
|
4225
4225
|
function Vr(t) {
|
|
4226
4226
|
if (!t || typeof t != "object")
|
|
4227
4227
|
return !1;
|
|
@@ -4229,25 +4229,25 @@ function Vr(t) {
|
|
|
4229
4229
|
if (e === null)
|
|
4230
4230
|
return !0;
|
|
4231
4231
|
const n = Object.hasOwnProperty.call(e, "constructor") && e.constructor;
|
|
4232
|
-
return n === Object ? !0 : typeof n == "function" && Function.toString.call(n) ===
|
|
4232
|
+
return n === Object ? !0 : typeof n == "function" && Function.toString.call(n) === Ko;
|
|
4233
4233
|
}
|
|
4234
4234
|
function bn(t, e) {
|
|
4235
|
-
|
|
4235
|
+
xn(t) === 0 ? Reflect.ownKeys(t).forEach((n) => {
|
|
4236
4236
|
e(n, t[n], t);
|
|
4237
4237
|
}) : t.forEach((n, s) => e(s, n, t));
|
|
4238
4238
|
}
|
|
4239
|
-
function
|
|
4239
|
+
function xn(t) {
|
|
4240
4240
|
const e = t[oe];
|
|
4241
4241
|
return e ? e.type_ : Array.isArray(t) ? 1 : Sn(t) ? 2 : On(t) ? 3 : 0;
|
|
4242
4242
|
}
|
|
4243
4243
|
function hs(t, e) {
|
|
4244
|
-
return
|
|
4244
|
+
return xn(t) === 2 ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
4245
4245
|
}
|
|
4246
|
-
function
|
|
4247
|
-
const s =
|
|
4246
|
+
function zr(t, e, n) {
|
|
4247
|
+
const s = xn(t);
|
|
4248
4248
|
s === 2 ? t.set(e, n) : s === 3 ? t.add(n) : t[e] = n;
|
|
4249
4249
|
}
|
|
4250
|
-
function
|
|
4250
|
+
function Bo(t, e) {
|
|
4251
4251
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
4252
4252
|
}
|
|
4253
4253
|
function Sn(t) {
|
|
@@ -4291,24 +4291,24 @@ function ps(t, e) {
|
|
|
4291
4291
|
}
|
|
4292
4292
|
}
|
|
4293
4293
|
function Kt(t, e = !1) {
|
|
4294
|
-
return Tn(t) || bt(t) || !tt(t) || (
|
|
4294
|
+
return Tn(t) || bt(t) || !tt(t) || (xn(t) > 1 && (t.set = t.add = t.clear = t.delete = qo), Object.freeze(t), e && Object.entries(t).forEach(([n, s]) => Kt(s, !0))), t;
|
|
4295
4295
|
}
|
|
4296
|
-
function
|
|
4296
|
+
function qo() {
|
|
4297
4297
|
re(2);
|
|
4298
4298
|
}
|
|
4299
4299
|
function Tn(t) {
|
|
4300
4300
|
return Object.isFrozen(t);
|
|
4301
4301
|
}
|
|
4302
|
-
var
|
|
4302
|
+
var Ho = {};
|
|
4303
4303
|
function nt(t) {
|
|
4304
|
-
const e =
|
|
4304
|
+
const e = Ho[t];
|
|
4305
4305
|
return e || re(0, t), e;
|
|
4306
4306
|
}
|
|
4307
4307
|
var Bt;
|
|
4308
|
-
function
|
|
4308
|
+
function Kr() {
|
|
4309
4309
|
return Bt;
|
|
4310
4310
|
}
|
|
4311
|
-
function
|
|
4311
|
+
function Go(t, e) {
|
|
4312
4312
|
return {
|
|
4313
4313
|
drafts_: [],
|
|
4314
4314
|
parent_: t,
|
|
@@ -4323,15 +4323,15 @@ function fr(t, e) {
|
|
|
4323
4323
|
e && (nt("Patches"), t.patches_ = [], t.inversePatches_ = [], t.patchListener_ = e);
|
|
4324
4324
|
}
|
|
4325
4325
|
function ms(t) {
|
|
4326
|
-
ys(t), t.drafts_.forEach(
|
|
4326
|
+
ys(t), t.drafts_.forEach(Jo), t.drafts_ = null;
|
|
4327
4327
|
}
|
|
4328
4328
|
function ys(t) {
|
|
4329
4329
|
t === Bt && (Bt = t.parent_);
|
|
4330
4330
|
}
|
|
4331
4331
|
function hr(t) {
|
|
4332
|
-
return Bt =
|
|
4332
|
+
return Bt = Go(Bt, t);
|
|
4333
4333
|
}
|
|
4334
|
-
function
|
|
4334
|
+
function Jo(t) {
|
|
4335
4335
|
const e = t[oe];
|
|
4336
4336
|
e.type_ === 0 || e.type_ === 1 ? e.revoke_() : e.revoked_ = !0;
|
|
4337
4337
|
}
|
|
@@ -4343,7 +4343,7 @@ function pr(t, e) {
|
|
|
4343
4343
|
t,
|
|
4344
4344
|
e.patches_,
|
|
4345
4345
|
e.inversePatches_
|
|
4346
|
-
)) : t = wn(e, n, []), ms(e), e.patches_ && e.patchListener_(e.patches_, e.inversePatches_), t !==
|
|
4346
|
+
)) : t = wn(e, n, []), ms(e), e.patches_ && e.patchListener_(e.patches_, e.inversePatches_), t !== Ur ? t : void 0;
|
|
4347
4347
|
}
|
|
4348
4348
|
function wn(t, e, n) {
|
|
4349
4349
|
if (Tn(e))
|
|
@@ -4378,7 +4378,7 @@ function mr(t, e, n, s, r, a, i) {
|
|
|
4378
4378
|
if (process.env.NODE_ENV !== "production" && r === n && re(5), bt(r)) {
|
|
4379
4379
|
const o = a && e && e.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
4380
4380
|
!hs(e.assigned_, s) ? a.concat(s) : void 0, c = wn(t, r, o);
|
|
4381
|
-
if (
|
|
4381
|
+
if (zr(n, s, c), bt(c))
|
|
4382
4382
|
t.canAutoFreeze_ = !1;
|
|
4383
4383
|
else
|
|
4384
4384
|
return;
|
|
@@ -4392,11 +4392,11 @@ function mr(t, e, n, s, r, a, i) {
|
|
|
4392
4392
|
function kn(t, e, n = !1) {
|
|
4393
4393
|
!t.parent_ && t.immer_.autoFreeze_ && t.canAutoFreeze_ && Kt(e, n);
|
|
4394
4394
|
}
|
|
4395
|
-
function
|
|
4395
|
+
function Xo(t, e) {
|
|
4396
4396
|
const n = Array.isArray(t), s = {
|
|
4397
4397
|
type_: n ? 1 : 0,
|
|
4398
4398
|
// Track which produce call this is associated with.
|
|
4399
|
-
scope_: e ? e.scope_ :
|
|
4399
|
+
scope_: e ? e.scope_ : Kr(),
|
|
4400
4400
|
// True for both shallow and deep changes.
|
|
4401
4401
|
modified_: !1,
|
|
4402
4402
|
// Used during finalization.
|
|
@@ -4427,7 +4427,7 @@ var Ps = {
|
|
|
4427
4427
|
return t;
|
|
4428
4428
|
const n = qe(t);
|
|
4429
4429
|
if (!hs(n, e))
|
|
4430
|
-
return
|
|
4430
|
+
return Yo(t, n, e);
|
|
4431
4431
|
const s = n[e];
|
|
4432
4432
|
return t.finalized_ || !tt(s) ? s : s === Dn(t.base_, e) ? (Mn(t), t.copy_[e] = vs(s, t)) : s;
|
|
4433
4433
|
},
|
|
@@ -4438,14 +4438,14 @@ var Ps = {
|
|
|
4438
4438
|
return Reflect.ownKeys(qe(t));
|
|
4439
4439
|
},
|
|
4440
4440
|
set(t, e, n) {
|
|
4441
|
-
const s =
|
|
4441
|
+
const s = Br(qe(t), e);
|
|
4442
4442
|
if (s != null && s.set)
|
|
4443
4443
|
return s.set.call(t.draft_, n), !0;
|
|
4444
4444
|
if (!t.modified_) {
|
|
4445
4445
|
const r = Dn(qe(t), e), a = r == null ? void 0 : r[oe];
|
|
4446
4446
|
if (a && a.base_ === n)
|
|
4447
4447
|
return t.copy_[e] = n, t.assigned_[e] = !1, !0;
|
|
4448
|
-
if (
|
|
4448
|
+
if (Bo(n, r) && (n !== void 0 || hs(t.base_, e)))
|
|
4449
4449
|
return !0;
|
|
4450
4450
|
Mn(t), gs(t);
|
|
4451
4451
|
}
|
|
@@ -4492,16 +4492,16 @@ function Dn(t, e) {
|
|
|
4492
4492
|
const n = t[oe];
|
|
4493
4493
|
return (n ? qe(n) : t)[e];
|
|
4494
4494
|
}
|
|
4495
|
-
function
|
|
4495
|
+
function Yo(t, e, n) {
|
|
4496
4496
|
var r;
|
|
4497
|
-
const s =
|
|
4497
|
+
const s = Br(e, n);
|
|
4498
4498
|
return s ? "value" in s ? s.value : (
|
|
4499
4499
|
// This is a very special case, if the prop is a getter defined by the
|
|
4500
4500
|
// prototype, we should invoke it with the draft as context!
|
|
4501
4501
|
(r = s.get) == null ? void 0 : r.call(t.draft_)
|
|
4502
4502
|
) : void 0;
|
|
4503
4503
|
}
|
|
4504
|
-
function
|
|
4504
|
+
function Br(t, e) {
|
|
4505
4505
|
if (!(e in t))
|
|
4506
4506
|
return;
|
|
4507
4507
|
let n = _t(t);
|
|
@@ -4521,7 +4521,7 @@ function Mn(t) {
|
|
|
4521
4521
|
t.scope_.immer_.useStrictShallowCopy_
|
|
4522
4522
|
));
|
|
4523
4523
|
}
|
|
4524
|
-
var
|
|
4524
|
+
var Qo = class {
|
|
4525
4525
|
constructor(t) {
|
|
4526
4526
|
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (e, n, s) => {
|
|
4527
4527
|
if (typeof e == "function" && typeof n != "function") {
|
|
@@ -4544,7 +4544,7 @@ var Yo = class {
|
|
|
4544
4544
|
}
|
|
4545
4545
|
return fr(a, s), pr(r, a);
|
|
4546
4546
|
} else if (!e || typeof e != "object") {
|
|
4547
|
-
if (r = n(e), r === void 0 && (r = e), r ===
|
|
4547
|
+
if (r = n(e), r === void 0 && (r = e), r === Ur && (r = void 0), this.autoFreeze_ && Kt(r, !0), s) {
|
|
4548
4548
|
const a = [], i = [];
|
|
4549
4549
|
nt("Patches").generateReplacementPatches_(e, r, a, i), s(a, i);
|
|
4550
4550
|
}
|
|
@@ -4561,7 +4561,7 @@ var Yo = class {
|
|
|
4561
4561
|
}, typeof (t == null ? void 0 : t.autoFreeze) == "boolean" && this.setAutoFreeze(t.autoFreeze), typeof (t == null ? void 0 : t.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(t.useStrictShallowCopy);
|
|
4562
4562
|
}
|
|
4563
4563
|
createDraft(t) {
|
|
4564
|
-
tt(t) || re(8), bt(t) && (t =
|
|
4564
|
+
tt(t) || re(8), bt(t) && (t = ec(t));
|
|
4565
4565
|
const e = hr(this), n = vs(t, void 0);
|
|
4566
4566
|
return n[oe].isManual_ = !0, ys(e), n;
|
|
4567
4567
|
}
|
|
@@ -4605,13 +4605,13 @@ var Yo = class {
|
|
|
4605
4605
|
}
|
|
4606
4606
|
};
|
|
4607
4607
|
function vs(t, e) {
|
|
4608
|
-
const n = Sn(t) ? nt("MapSet").proxyMap_(t, e) : On(t) ? nt("MapSet").proxySet_(t, e) :
|
|
4609
|
-
return (e ? e.scope_ :
|
|
4608
|
+
const n = Sn(t) ? nt("MapSet").proxyMap_(t, e) : On(t) ? nt("MapSet").proxySet_(t, e) : Xo(t, e);
|
|
4609
|
+
return (e ? e.scope_ : Kr()).drafts_.push(n), n;
|
|
4610
4610
|
}
|
|
4611
|
-
function
|
|
4612
|
-
return bt(t) || re(10, t),
|
|
4611
|
+
function ec(t) {
|
|
4612
|
+
return bt(t) || re(10, t), qr(t);
|
|
4613
4613
|
}
|
|
4614
|
-
function
|
|
4614
|
+
function qr(t) {
|
|
4615
4615
|
if (!tt(t) || Tn(t))
|
|
4616
4616
|
return t;
|
|
4617
4617
|
const e = t[oe];
|
|
@@ -4623,10 +4623,10 @@ function Br(t) {
|
|
|
4623
4623
|
} else
|
|
4624
4624
|
n = ps(t, !0);
|
|
4625
4625
|
return bn(n, (s, r) => {
|
|
4626
|
-
|
|
4626
|
+
zr(n, s, qr(r));
|
|
4627
4627
|
}), e && (e.finalized_ = !1), n;
|
|
4628
4628
|
}
|
|
4629
|
-
var ce = new
|
|
4629
|
+
var ce = new Qo(), tc = ce.produce;
|
|
4630
4630
|
ce.produceWithPatches.bind(
|
|
4631
4631
|
ce
|
|
4632
4632
|
);
|
|
@@ -4635,15 +4635,15 @@ ce.setUseStrictShallowCopy.bind(ce);
|
|
|
4635
4635
|
ce.applyPatches.bind(ce);
|
|
4636
4636
|
ce.createDraft.bind(ce);
|
|
4637
4637
|
ce.finishDraft.bind(ce);
|
|
4638
|
-
function
|
|
4639
|
-
var e =
|
|
4638
|
+
function nc(t) {
|
|
4639
|
+
var e = la(function() {
|
|
4640
4640
|
return Kt(typeof t == "function" ? t() : t, !0);
|
|
4641
4641
|
}), n = e[1];
|
|
4642
4642
|
return [e[0], rn(function(s) {
|
|
4643
|
-
n(typeof s == "function" ?
|
|
4643
|
+
n(typeof s == "function" ? tc(s) : Kt(s));
|
|
4644
4644
|
}, [])];
|
|
4645
4645
|
}
|
|
4646
|
-
const yr = {
|
|
4646
|
+
const yr = 10, gr = {
|
|
4647
4647
|
status: "idle",
|
|
4648
4648
|
error: null,
|
|
4649
4649
|
result: null,
|
|
@@ -4652,142 +4652,150 @@ const yr = {
|
|
|
4652
4652
|
codeGeneration: { status: "pending", progress: 0 },
|
|
4653
4653
|
uploadAssets: { status: "pending" }
|
|
4654
4654
|
}
|
|
4655
|
-
},
|
|
4655
|
+
}, vr = (t) => "path" in t ? {
|
|
4656
4656
|
filePath: t.path.replace(/^\//, ""),
|
|
4657
4657
|
referencePath: t.path === "/" ? "" : t.path
|
|
4658
4658
|
// Workaround to avoid duplicated slashes in the URL. Ideally, the fix should be done in Codegen.
|
|
4659
4659
|
} : {
|
|
4660
4660
|
filePath: t.filePath.replace(/^\//, ""),
|
|
4661
4661
|
referencePath: t.referencePath === "/" ? "" : t.referencePath
|
|
4662
|
-
},
|
|
4662
|
+
}, $c = ({
|
|
4663
4663
|
url: t,
|
|
4664
4664
|
method: e = "POST"
|
|
4665
4665
|
}) => {
|
|
4666
|
-
const [n, s] =
|
|
4666
|
+
const [n, s] = nc(gr);
|
|
4667
4667
|
return {
|
|
4668
4668
|
getCode: (a) => Ie(void 0, null, function* () {
|
|
4669
4669
|
var h, p, k;
|
|
4670
|
-
s((
|
|
4671
|
-
|
|
4670
|
+
s((g) => {
|
|
4671
|
+
g.status = "pending", g.error = null, g.result = null, g.tasks = gr.tasks;
|
|
4672
4672
|
});
|
|
4673
4673
|
const i = structuredClone(a);
|
|
4674
4674
|
if (((h = a.assetsStorage) == null ? void 0 : h.strategy) === "local") {
|
|
4675
|
-
const { referencePath:
|
|
4675
|
+
const { referencePath: g } = vr(
|
|
4676
4676
|
a.assetsStorage
|
|
4677
4677
|
);
|
|
4678
4678
|
a.assetsStorage = {
|
|
4679
4679
|
strategy: "external",
|
|
4680
|
-
url:
|
|
4680
|
+
url: g
|
|
4681
4681
|
};
|
|
4682
4682
|
}
|
|
4683
4683
|
let o;
|
|
4684
4684
|
const c = new dn(t, {
|
|
4685
|
-
fetch: (
|
|
4685
|
+
fetch: (g, b) => (o = fetch(g, Bs(Ke({}, b), {
|
|
4686
4686
|
method: e,
|
|
4687
4687
|
body: JSON.stringify(a)
|
|
4688
4688
|
})), o)
|
|
4689
|
-
}), u = new Promise((
|
|
4689
|
+
}), u = new Promise((g) => {
|
|
4690
4690
|
const b = {};
|
|
4691
|
-
c.addEventListener("start", (
|
|
4692
|
-
const
|
|
4693
|
-
b.sessionId =
|
|
4694
|
-
|
|
4691
|
+
c.addEventListener("start", (_) => {
|
|
4692
|
+
const l = JSON.parse(_.data);
|
|
4693
|
+
b.sessionId = l.sessionId, s((A) => {
|
|
4694
|
+
A.tasks.fetchDesign.status = "running";
|
|
4695
4695
|
});
|
|
4696
|
-
}), c.addEventListener("pre_codegen", (
|
|
4696
|
+
}), c.addEventListener("pre_codegen", (_) => {
|
|
4697
4697
|
JSON.parse(
|
|
4698
|
-
|
|
4699
|
-
).message === "Anima model built" && s((
|
|
4700
|
-
|
|
4698
|
+
_.data
|
|
4699
|
+
).message === "Anima model built" && s((A) => {
|
|
4700
|
+
A.tasks.fetchDesign.status = "finished", A.tasks.codeGeneration.status = "running", A.tasks.uploadAssets.status = "running";
|
|
4701
4701
|
});
|
|
4702
|
-
}), c.addEventListener("figma_metadata", (
|
|
4703
|
-
const
|
|
4704
|
-
|
|
4702
|
+
}), c.addEventListener("figma_metadata", (_) => {
|
|
4703
|
+
const l = JSON.parse(
|
|
4704
|
+
_.data
|
|
4705
4705
|
);
|
|
4706
|
-
b.figmaFileName =
|
|
4706
|
+
b.figmaFileName = l.figmaFileName, b.figmaSelectedFrameName = l.figmaSelectedFrameName;
|
|
4707
4707
|
}), c.addEventListener("aborted", () => {
|
|
4708
|
-
const
|
|
4709
|
-
s((
|
|
4710
|
-
|
|
4711
|
-
}),
|
|
4708
|
+
const _ = new Gs({ name: "Aborted", reason: "Unknown" });
|
|
4709
|
+
s((l) => {
|
|
4710
|
+
l.status = "aborted", l.result = null, l.error = _;
|
|
4711
|
+
}), g({
|
|
4712
4712
|
result: null,
|
|
4713
|
-
error:
|
|
4713
|
+
error: _
|
|
4714
4714
|
});
|
|
4715
|
-
}), c.addEventListener("generating_code", (
|
|
4716
|
-
const
|
|
4717
|
-
|
|
4715
|
+
}), c.addEventListener("generating_code", (_) => {
|
|
4716
|
+
const l = JSON.parse(
|
|
4717
|
+
_.data
|
|
4718
4718
|
);
|
|
4719
|
-
|
|
4720
|
-
|
|
4719
|
+
l.payload.status === "success" && (b.files = l.payload.files), s((A) => {
|
|
4720
|
+
A.tasks.codeGeneration.progress = l.payload.progress, A.tasks.codeGeneration.status = "running";
|
|
4721
4721
|
});
|
|
4722
4722
|
}), c.addEventListener("codegen_completed", () => {
|
|
4723
|
-
s((
|
|
4724
|
-
|
|
4723
|
+
s((_) => {
|
|
4724
|
+
_.tasks.codeGeneration.status = "finished";
|
|
4725
4725
|
});
|
|
4726
4726
|
}), c.addEventListener("generation_completed", () => {
|
|
4727
|
-
s((
|
|
4728
|
-
|
|
4727
|
+
s((_) => {
|
|
4728
|
+
_.tasks.codeGeneration.status = "finished";
|
|
4729
4729
|
});
|
|
4730
4730
|
}), c.addEventListener("assets_uploaded", () => {
|
|
4731
|
-
s((
|
|
4732
|
-
|
|
4731
|
+
s((_) => {
|
|
4732
|
+
_.tasks.uploadAssets.status = "finished";
|
|
4733
4733
|
});
|
|
4734
|
-
}), c.addEventListener("assets_list", (
|
|
4735
|
-
const
|
|
4736
|
-
|
|
4734
|
+
}), c.addEventListener("assets_list", (_) => {
|
|
4735
|
+
const l = JSON.parse(
|
|
4736
|
+
_.data
|
|
4737
|
+
);
|
|
4738
|
+
b.assets = l.payload.assets;
|
|
4739
|
+
});
|
|
4740
|
+
let m = 0;
|
|
4741
|
+
c.addEventListener("error", (_) => Ie(void 0, null, function* () {
|
|
4742
|
+
var M, z, Z;
|
|
4743
|
+
console.warn(
|
|
4744
|
+
`Experienced error during code generation (attempt ${m + 1} / ${yr})`,
|
|
4745
|
+
_
|
|
4737
4746
|
);
|
|
4738
|
-
|
|
4739
|
-
}), c.addEventListener("error", (l) => Ie(void 0, null, function* () {
|
|
4740
|
-
var W, R;
|
|
4741
|
-
let y;
|
|
4747
|
+
let l, A = !1;
|
|
4742
4748
|
try {
|
|
4743
|
-
|
|
4744
|
-
} catch (
|
|
4749
|
+
_ instanceof MessageEvent ? l = JSON.parse(_.data) : l = yield (yield o).json(), ((M = l == null ? void 0 : l.payload) == null ? void 0 : M.name) === "Task Crashed" && (A = !0);
|
|
4750
|
+
} catch (P) {
|
|
4745
4751
|
}
|
|
4746
|
-
const
|
|
4747
|
-
name: (
|
|
4748
|
-
reason: (
|
|
4749
|
-
status:
|
|
4750
|
-
detail:
|
|
4752
|
+
const I = new Gs({
|
|
4753
|
+
name: (z = l == null ? void 0 : l.payload.name) != null ? z : "Unknown error",
|
|
4754
|
+
reason: (Z = l == null ? void 0 : l.payload.message) != null ? Z : "Unknown",
|
|
4755
|
+
status: l == null ? void 0 : l.payload.status,
|
|
4756
|
+
detail: l == null ? void 0 : l.payload.detail
|
|
4751
4757
|
});
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4758
|
+
m++;
|
|
4759
|
+
let V = !1;
|
|
4760
|
+
m > yr ? (console.error("Experienced too many errors, terminating request"), V = !0) : A && (console.error("Experienced unrecoverable error, terminating request"), V = !0), V && (s((P) => {
|
|
4761
|
+
P.status = "error", P.error = I;
|
|
4762
|
+
}), g({
|
|
4755
4763
|
result: null,
|
|
4756
|
-
error:
|
|
4757
|
-
});
|
|
4758
|
-
})), c.addEventListener("done", (
|
|
4759
|
-
const
|
|
4760
|
-
b.tokenUsage =
|
|
4761
|
-
|
|
4762
|
-
}),
|
|
4764
|
+
error: I
|
|
4765
|
+
}));
|
|
4766
|
+
})), c.addEventListener("done", (_) => {
|
|
4767
|
+
const l = JSON.parse(_.data);
|
|
4768
|
+
b.tokenUsage = l.payload.tokenUsage, b.sessionId = l.payload.sessionId, s((A) => {
|
|
4769
|
+
A.status = "success", A.result = b;
|
|
4770
|
+
}), g({ result: b, error: null });
|
|
4763
4771
|
});
|
|
4764
4772
|
});
|
|
4765
4773
|
try {
|
|
4766
|
-
const { result:
|
|
4767
|
-
if (((p = i.assetsStorage) == null ? void 0 : p.strategy) === "local" && ((k =
|
|
4768
|
-
const { filePath:
|
|
4774
|
+
const { result: g, error: b } = yield u, m = structuredClone(g);
|
|
4775
|
+
if (((p = i.assetsStorage) == null ? void 0 : p.strategy) === "local" && ((k = m == null ? void 0 : m.assets) != null && k.length)) {
|
|
4776
|
+
const { filePath: _ } = vr(
|
|
4769
4777
|
i.assetsStorage
|
|
4770
|
-
),
|
|
4771
|
-
const
|
|
4778
|
+
), l = m.assets.map((I) => Ie(void 0, null, function* () {
|
|
4779
|
+
const M = yield (yield fetch(I.url)).arrayBuffer();
|
|
4772
4780
|
return {
|
|
4773
|
-
assetName:
|
|
4774
|
-
base64:
|
|
4781
|
+
assetName: I.name,
|
|
4782
|
+
base64: va(M)
|
|
4775
4783
|
};
|
|
4776
|
-
})),
|
|
4777
|
-
for (const
|
|
4778
|
-
const
|
|
4779
|
-
if (
|
|
4780
|
-
const { assetName:
|
|
4781
|
-
|
|
4782
|
-
const Z =
|
|
4783
|
-
|
|
4784
|
-
content:
|
|
4784
|
+
})), A = yield Promise.allSettled(l);
|
|
4785
|
+
for (const I of A) {
|
|
4786
|
+
const V = {};
|
|
4787
|
+
if (I.status === "fulfilled") {
|
|
4788
|
+
const { assetName: M, base64: z } = I.value;
|
|
4789
|
+
V[M] = z;
|
|
4790
|
+
const Z = _ ? `${_}/${M}` : M;
|
|
4791
|
+
m.files[Z] = {
|
|
4792
|
+
content: z,
|
|
4785
4793
|
isBinary: !0
|
|
4786
4794
|
};
|
|
4787
4795
|
}
|
|
4788
4796
|
}
|
|
4789
4797
|
}
|
|
4790
|
-
return b ? { result: null, error: b } : { result:
|
|
4798
|
+
return b ? { result: null, error: b } : { result: m, error: b };
|
|
4791
4799
|
} finally {
|
|
4792
4800
|
c.close();
|
|
4793
4801
|
}
|
|
@@ -4808,37 +4816,37 @@ var tn = { exports: {} }, Ln = {};
|
|
|
4808
4816
|
* This source code is licensed under the MIT license found in the
|
|
4809
4817
|
* LICENSE file in the root directory of this source tree.
|
|
4810
4818
|
*/
|
|
4811
|
-
var
|
|
4812
|
-
function
|
|
4813
|
-
if (
|
|
4814
|
-
|
|
4819
|
+
var _r;
|
|
4820
|
+
function sc() {
|
|
4821
|
+
if (_r) return Ln;
|
|
4822
|
+
_r = 1;
|
|
4815
4823
|
var t = Gt;
|
|
4816
4824
|
function e(p, k) {
|
|
4817
4825
|
return p === k && (p !== 0 || 1 / p === 1 / k) || p !== p && k !== k;
|
|
4818
4826
|
}
|
|
4819
4827
|
var n = typeof Object.is == "function" ? Object.is : e, s = t.useState, r = t.useEffect, a = t.useLayoutEffect, i = t.useDebugValue;
|
|
4820
4828
|
function o(p, k) {
|
|
4821
|
-
var
|
|
4829
|
+
var g = k(), b = s({ inst: { value: g, getSnapshot: k } }), m = b[0].inst, _ = b[1];
|
|
4822
4830
|
return a(
|
|
4823
4831
|
function() {
|
|
4824
|
-
|
|
4832
|
+
m.value = g, m.getSnapshot = k, c(m) && _({ inst: m });
|
|
4825
4833
|
},
|
|
4826
|
-
[p,
|
|
4834
|
+
[p, g, k]
|
|
4827
4835
|
), r(
|
|
4828
4836
|
function() {
|
|
4829
|
-
return c(
|
|
4830
|
-
c(
|
|
4837
|
+
return c(m) && _({ inst: m }), p(function() {
|
|
4838
|
+
c(m) && _({ inst: m });
|
|
4831
4839
|
});
|
|
4832
4840
|
},
|
|
4833
4841
|
[p]
|
|
4834
|
-
), i(
|
|
4842
|
+
), i(g), g;
|
|
4835
4843
|
}
|
|
4836
4844
|
function c(p) {
|
|
4837
4845
|
var k = p.getSnapshot;
|
|
4838
4846
|
p = p.value;
|
|
4839
4847
|
try {
|
|
4840
|
-
var
|
|
4841
|
-
return !n(p,
|
|
4848
|
+
var g = k();
|
|
4849
|
+
return !n(p, g);
|
|
4842
4850
|
} catch (b) {
|
|
4843
4851
|
return !0;
|
|
4844
4852
|
}
|
|
@@ -4849,7 +4857,7 @@ function nc() {
|
|
|
4849
4857
|
var h = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? u : o;
|
|
4850
4858
|
return Ln.useSyncExternalStore = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : h, Ln;
|
|
4851
4859
|
}
|
|
4852
|
-
var
|
|
4860
|
+
var $n = {};
|
|
4853
4861
|
/**
|
|
4854
4862
|
* @license React
|
|
4855
4863
|
* use-sync-external-store-shim.development.js
|
|
@@ -4859,66 +4867,66 @@ var Fn = {};
|
|
|
4859
4867
|
* This source code is licensed under the MIT license found in the
|
|
4860
4868
|
* LICENSE file in the root directory of this source tree.
|
|
4861
4869
|
*/
|
|
4862
|
-
var
|
|
4863
|
-
function
|
|
4864
|
-
return
|
|
4865
|
-
function t(
|
|
4866
|
-
return
|
|
4870
|
+
var br;
|
|
4871
|
+
function rc() {
|
|
4872
|
+
return br || (br = 1, process.env.NODE_ENV !== "production" && function() {
|
|
4873
|
+
function t(g, b) {
|
|
4874
|
+
return g === b && (g !== 0 || 1 / g === 1 / b) || g !== g && b !== b;
|
|
4867
4875
|
}
|
|
4868
|
-
function e(
|
|
4876
|
+
function e(g, b) {
|
|
4869
4877
|
h || r.startTransition === void 0 || (h = !0, console.error(
|
|
4870
4878
|
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
4871
4879
|
));
|
|
4872
|
-
var
|
|
4880
|
+
var m = b();
|
|
4873
4881
|
if (!p) {
|
|
4874
|
-
var
|
|
4875
|
-
a(
|
|
4882
|
+
var _ = b();
|
|
4883
|
+
a(m, _) || (console.error(
|
|
4876
4884
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
4877
4885
|
), p = !0);
|
|
4878
4886
|
}
|
|
4879
|
-
|
|
4880
|
-
inst: { value:
|
|
4887
|
+
_ = i({
|
|
4888
|
+
inst: { value: m, getSnapshot: b }
|
|
4881
4889
|
});
|
|
4882
|
-
var
|
|
4890
|
+
var l = _[0].inst, A = _[1];
|
|
4883
4891
|
return c(
|
|
4884
4892
|
function() {
|
|
4885
|
-
|
|
4893
|
+
l.value = m, l.getSnapshot = b, n(l) && A({ inst: l });
|
|
4886
4894
|
},
|
|
4887
|
-
[
|
|
4895
|
+
[g, m, b]
|
|
4888
4896
|
), o(
|
|
4889
4897
|
function() {
|
|
4890
|
-
return n(
|
|
4891
|
-
n(
|
|
4898
|
+
return n(l) && A({ inst: l }), g(function() {
|
|
4899
|
+
n(l) && A({ inst: l });
|
|
4892
4900
|
});
|
|
4893
4901
|
},
|
|
4894
|
-
[
|
|
4895
|
-
), u(
|
|
4902
|
+
[g]
|
|
4903
|
+
), u(m), m;
|
|
4896
4904
|
}
|
|
4897
|
-
function n(
|
|
4898
|
-
var b =
|
|
4899
|
-
|
|
4905
|
+
function n(g) {
|
|
4906
|
+
var b = g.getSnapshot;
|
|
4907
|
+
g = g.value;
|
|
4900
4908
|
try {
|
|
4901
|
-
var
|
|
4902
|
-
return !a(
|
|
4903
|
-
} catch (
|
|
4909
|
+
var m = b();
|
|
4910
|
+
return !a(g, m);
|
|
4911
|
+
} catch (_) {
|
|
4904
4912
|
return !0;
|
|
4905
4913
|
}
|
|
4906
4914
|
}
|
|
4907
|
-
function s(
|
|
4915
|
+
function s(g, b) {
|
|
4908
4916
|
return b();
|
|
4909
4917
|
}
|
|
4910
4918
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ != "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
4911
4919
|
var r = Gt, a = typeof Object.is == "function" ? Object.is : t, i = r.useState, o = r.useEffect, c = r.useLayoutEffect, u = r.useDebugValue, h = !1, p = !1, k = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? s : e;
|
|
4912
|
-
|
|
4913
|
-
}()),
|
|
4920
|
+
$n.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : k, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ != "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
4921
|
+
}()), $n;
|
|
4914
4922
|
}
|
|
4915
|
-
var
|
|
4916
|
-
function
|
|
4917
|
-
return
|
|
4923
|
+
var wr;
|
|
4924
|
+
function ac() {
|
|
4925
|
+
return wr || (wr = 1, process.env.NODE_ENV === "production" ? tn.exports = sc() : tn.exports = rc()), tn.exports;
|
|
4918
4926
|
}
|
|
4919
|
-
var
|
|
4920
|
-
const
|
|
4921
|
-
var
|
|
4927
|
+
var ic = ac();
|
|
4928
|
+
const Hr = 0, Gr = 1, Jr = 2, kr = 3;
|
|
4929
|
+
var Er = Object.prototype.hasOwnProperty;
|
|
4922
4930
|
function _s(t, e) {
|
|
4923
4931
|
var n, s;
|
|
4924
4932
|
if (t === e) return !0;
|
|
@@ -4933,7 +4941,7 @@ function _s(t, e) {
|
|
|
4933
4941
|
if (!n || typeof t == "object") {
|
|
4934
4942
|
s = 0;
|
|
4935
4943
|
for (n in t)
|
|
4936
|
-
if (
|
|
4944
|
+
if (Er.call(t, n) && ++s && !Er.call(e, n) || !(n in e) || !_s(t[n], e[n])) return !1;
|
|
4937
4945
|
return Object.keys(e).length === s;
|
|
4938
4946
|
}
|
|
4939
4947
|
}
|
|
@@ -4943,62 +4951,62 @@ const Re = /* @__PURE__ */ new WeakMap(), Me = () => {
|
|
|
4943
4951
|
}, ee = (
|
|
4944
4952
|
/*#__NOINLINE__*/
|
|
4945
4953
|
Me()
|
|
4946
|
-
), bs = Object,
|
|
4954
|
+
), bs = Object, R = (t) => t === ee, be = (t) => typeof t == "function", Ue = (t, e) => Ke(Ke({}, t), e), Xr = (t) => be(t.then), Fn = {}, nn = {}, Is = "undefined", Xt = typeof window != Is, ws = typeof document != Is, oc = Xt && "Deno" in window, cc = () => Xt && typeof window.requestAnimationFrame != Is, Yr = (t, e) => {
|
|
4947
4955
|
const n = Re.get(t);
|
|
4948
4956
|
return [
|
|
4949
4957
|
// Getter
|
|
4950
|
-
() => !
|
|
4958
|
+
() => !R(e) && t.get(e) || Fn,
|
|
4951
4959
|
// Setter
|
|
4952
4960
|
(s) => {
|
|
4953
|
-
if (!
|
|
4961
|
+
if (!R(e)) {
|
|
4954
4962
|
const r = t.get(e);
|
|
4955
|
-
e in nn || (nn[e] = r), n[5](e,
|
|
4963
|
+
e in nn || (nn[e] = r), n[5](e, Ue(r, s), r || Fn);
|
|
4956
4964
|
}
|
|
4957
4965
|
},
|
|
4958
4966
|
// Subscriber
|
|
4959
4967
|
n[6],
|
|
4960
4968
|
// Get server cache snapshot
|
|
4961
|
-
() => !
|
|
4969
|
+
() => !R(e) && e in nn ? nn[e] : !R(e) && t.get(e) || Fn
|
|
4962
4970
|
];
|
|
4963
4971
|
};
|
|
4964
4972
|
let ks = !0;
|
|
4965
|
-
const
|
|
4973
|
+
const uc = () => ks, [Es, xs] = Xt && window.addEventListener ? [
|
|
4966
4974
|
window.addEventListener.bind(window),
|
|
4967
4975
|
window.removeEventListener.bind(window)
|
|
4968
4976
|
] : [
|
|
4969
4977
|
Me,
|
|
4970
4978
|
Me
|
|
4971
|
-
],
|
|
4979
|
+
], dc = () => {
|
|
4972
4980
|
const t = ws && document.visibilityState;
|
|
4973
|
-
return
|
|
4974
|
-
},
|
|
4975
|
-
ws && document.removeEventListener("visibilitychange", t),
|
|
4976
|
-
}),
|
|
4981
|
+
return R(t) || t !== "hidden";
|
|
4982
|
+
}, lc = (t) => (ws && document.addEventListener("visibilitychange", t), Es("focus", t), () => {
|
|
4983
|
+
ws && document.removeEventListener("visibilitychange", t), xs("focus", t);
|
|
4984
|
+
}), fc = (t) => {
|
|
4977
4985
|
const e = () => {
|
|
4978
4986
|
ks = !0, t();
|
|
4979
4987
|
}, n = () => {
|
|
4980
4988
|
ks = !1;
|
|
4981
4989
|
};
|
|
4982
|
-
return
|
|
4983
|
-
|
|
4990
|
+
return Es("online", e), Es("offline", n), () => {
|
|
4991
|
+
xs("online", e), xs("offline", n);
|
|
4984
4992
|
};
|
|
4985
|
-
}, fc = {
|
|
4986
|
-
isOnline: cc,
|
|
4987
|
-
isVisible: uc
|
|
4988
4993
|
}, hc = {
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
},
|
|
4994
|
+
isOnline: uc,
|
|
4995
|
+
isVisible: dc
|
|
4996
|
+
}, pc = {
|
|
4997
|
+
initFocus: lc,
|
|
4998
|
+
initReconnect: fc
|
|
4999
|
+
}, xr = !Gt.useId, Ht = !Xt || oc, mc = (t) => cc() ? window.requestAnimationFrame(t) : setTimeout(t, 1), Wn = Ht ? ha : pa, Un = typeof navigator != "undefined" && navigator.connection, Sr = !Ht && Un && ([
|
|
4992
5000
|
"slow-2g",
|
|
4993
5001
|
"2g"
|
|
4994
|
-
].includes(
|
|
4995
|
-
let
|
|
5002
|
+
].includes(Un.effectiveType) || Un.saveData), sn = /* @__PURE__ */ new WeakMap(), Vn = (t, e) => bs.prototype.toString.call(t) === `[object ${e}]`;
|
|
5003
|
+
let yc = 0;
|
|
4996
5004
|
const Ss = (t) => {
|
|
4997
|
-
const e = typeof t, n =
|
|
5005
|
+
const e = typeof t, n = Vn(t, "Date"), s = Vn(t, "RegExp"), r = Vn(t, "Object");
|
|
4998
5006
|
let a, i;
|
|
4999
5007
|
if (bs(t) === t && !n && !s) {
|
|
5000
5008
|
if (a = sn.get(t), a) return a;
|
|
5001
|
-
if (a = ++
|
|
5009
|
+
if (a = ++yc + "~", sn.set(t, a), Array.isArray(t)) {
|
|
5002
5010
|
for (a = "@", i = 0; i < t.length; i++)
|
|
5003
5011
|
a += Ss(t[i]) + ",";
|
|
5004
5012
|
sn.set(t, a);
|
|
@@ -5006,8 +5014,8 @@ const Ss = (t) => {
|
|
|
5006
5014
|
if (r) {
|
|
5007
5015
|
a = "#";
|
|
5008
5016
|
const o = bs.keys(t).sort();
|
|
5009
|
-
for (; !
|
|
5010
|
-
|
|
5017
|
+
for (; !R(i = o.pop()); )
|
|
5018
|
+
R(t[i]) || (a += i + ":" + Ss(t[i]) + ",");
|
|
5011
5019
|
sn.set(t, a);
|
|
5012
5020
|
}
|
|
5013
5021
|
} else
|
|
@@ -5026,11 +5034,11 @@ const Ss = (t) => {
|
|
|
5026
5034
|
e
|
|
5027
5035
|
];
|
|
5028
5036
|
};
|
|
5029
|
-
let
|
|
5030
|
-
const Os = () => ++
|
|
5031
|
-
function
|
|
5037
|
+
let gc = 0;
|
|
5038
|
+
const Os = () => ++gc;
|
|
5039
|
+
function Qr(...t) {
|
|
5032
5040
|
return Ie(this, null, function* () {
|
|
5033
|
-
const [e, n, s, r] = t, a =
|
|
5041
|
+
const [e, n, s, r] = t, a = Ue({
|
|
5034
5042
|
populateCache: !0,
|
|
5035
5043
|
throwOnError: !0
|
|
5036
5044
|
}, typeof r == "boolean" ? {
|
|
@@ -5041,91 +5049,91 @@ function Yr(...t) {
|
|
|
5041
5049
|
let c = a.optimisticData;
|
|
5042
5050
|
const u = (k) => typeof o == "function" ? o(k) : o !== !1, h = a.throwOnError;
|
|
5043
5051
|
if (be(n)) {
|
|
5044
|
-
const k = n,
|
|
5045
|
-
for (const
|
|
5052
|
+
const k = n, g = [], b = e.keys();
|
|
5053
|
+
for (const m of b)
|
|
5046
5054
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
5047
|
-
!/^\$(inf|sub)\$/.test(
|
|
5048
|
-
return Promise.all(
|
|
5055
|
+
!/^\$(inf|sub)\$/.test(m) && k(e.get(m)._k) && g.push(m);
|
|
5056
|
+
return Promise.all(g.map(p));
|
|
5049
5057
|
}
|
|
5050
5058
|
return p(n);
|
|
5051
5059
|
function p(k) {
|
|
5052
5060
|
return Ie(this, null, function* () {
|
|
5053
|
-
const [
|
|
5054
|
-
if (!
|
|
5055
|
-
const [b,
|
|
5056
|
-
const le =
|
|
5057
|
-
return (be(a.revalidate) ? a.revalidate(b().data, k) : a.revalidate !== !1) && (delete
|
|
5061
|
+
const [g] = js(k);
|
|
5062
|
+
if (!g) return;
|
|
5063
|
+
const [b, m] = Yr(e, g), [_, l, A, I] = Re.get(e), V = () => {
|
|
5064
|
+
const le = _[g];
|
|
5065
|
+
return (be(a.revalidate) ? a.revalidate(b().data, k) : a.revalidate !== !1) && (delete A[g], delete I[g], le && le[0]) ? le[0](Jr).then(() => b().data) : b().data;
|
|
5058
5066
|
};
|
|
5059
5067
|
if (t.length < 3)
|
|
5060
|
-
return
|
|
5061
|
-
let
|
|
5068
|
+
return V();
|
|
5069
|
+
let M = s, z;
|
|
5062
5070
|
const Z = Os();
|
|
5063
|
-
|
|
5071
|
+
l[g] = [
|
|
5064
5072
|
Z,
|
|
5065
5073
|
0
|
|
5066
5074
|
];
|
|
5067
|
-
const
|
|
5068
|
-
if (
|
|
5075
|
+
const P = !R(c), Se = b(), F = Se.data, st = Se._c, Ve = R(st) ? F : st;
|
|
5076
|
+
if (P && (c = be(c) ? c(Ve, F) : c, m({
|
|
5069
5077
|
data: c,
|
|
5070
|
-
_c:
|
|
5071
|
-
})), be(
|
|
5078
|
+
_c: Ve
|
|
5079
|
+
})), be(M))
|
|
5072
5080
|
try {
|
|
5073
|
-
|
|
5081
|
+
M = M(Ve);
|
|
5074
5082
|
} catch (le) {
|
|
5075
|
-
|
|
5083
|
+
z = le;
|
|
5076
5084
|
}
|
|
5077
|
-
if (
|
|
5078
|
-
if (
|
|
5079
|
-
|
|
5080
|
-
}), Z !==
|
|
5081
|
-
if (
|
|
5082
|
-
return
|
|
5083
|
-
} else
|
|
5084
|
-
data:
|
|
5085
|
+
if (M && Xr(M))
|
|
5086
|
+
if (M = yield M.catch((le) => {
|
|
5087
|
+
z = le;
|
|
5088
|
+
}), Z !== l[g][0]) {
|
|
5089
|
+
if (z) throw z;
|
|
5090
|
+
return M;
|
|
5091
|
+
} else z && P && u(z) && (i = !0, m({
|
|
5092
|
+
data: Ve,
|
|
5085
5093
|
_c: ee
|
|
5086
5094
|
}));
|
|
5087
|
-
if (i && !
|
|
5095
|
+
if (i && !z)
|
|
5088
5096
|
if (be(i)) {
|
|
5089
|
-
const le = i(
|
|
5090
|
-
|
|
5097
|
+
const le = i(M, Ve);
|
|
5098
|
+
m({
|
|
5091
5099
|
data: le,
|
|
5092
5100
|
error: ee,
|
|
5093
5101
|
_c: ee
|
|
5094
5102
|
});
|
|
5095
5103
|
} else
|
|
5096
|
-
|
|
5097
|
-
data:
|
|
5104
|
+
m({
|
|
5105
|
+
data: M,
|
|
5098
5106
|
error: ee,
|
|
5099
5107
|
_c: ee
|
|
5100
5108
|
});
|
|
5101
|
-
if (
|
|
5102
|
-
|
|
5109
|
+
if (l[g][1] = Os(), Promise.resolve(V()).then(() => {
|
|
5110
|
+
m({
|
|
5103
5111
|
_c: ee
|
|
5104
5112
|
});
|
|
5105
|
-
}),
|
|
5106
|
-
if (h) throw
|
|
5113
|
+
}), z) {
|
|
5114
|
+
if (h) throw z;
|
|
5107
5115
|
return;
|
|
5108
5116
|
}
|
|
5109
|
-
return
|
|
5117
|
+
return M;
|
|
5110
5118
|
});
|
|
5111
5119
|
}
|
|
5112
5120
|
});
|
|
5113
5121
|
}
|
|
5114
|
-
const
|
|
5122
|
+
const Or = (t, e) => {
|
|
5115
5123
|
for (const n in t)
|
|
5116
5124
|
t[n][0] && t[n][0](e);
|
|
5117
|
-
},
|
|
5125
|
+
}, vc = (t, e) => {
|
|
5118
5126
|
if (!Re.has(t)) {
|
|
5119
|
-
const n =
|
|
5127
|
+
const n = Ue(pc, e), s = /* @__PURE__ */ Object.create(null), r = Qr.bind(ee, t);
|
|
5120
5128
|
let a = Me;
|
|
5121
5129
|
const i = /* @__PURE__ */ Object.create(null), o = (h, p) => {
|
|
5122
5130
|
const k = i[h] || [];
|
|
5123
5131
|
return i[h] = k, k.push(p), () => k.splice(k.indexOf(p), 1);
|
|
5124
5132
|
}, c = (h, p, k) => {
|
|
5125
5133
|
t.set(h, p);
|
|
5126
|
-
const
|
|
5127
|
-
if (
|
|
5128
|
-
for (const b of
|
|
5134
|
+
const g = i[h];
|
|
5135
|
+
if (g)
|
|
5136
|
+
for (const b of g)
|
|
5129
5137
|
b(p, k);
|
|
5130
5138
|
}, u = () => {
|
|
5131
5139
|
if (!Re.has(t) && (Re.set(t, [
|
|
@@ -5137,7 +5145,7 @@ const Sr = (t, e) => {
|
|
|
5137
5145
|
c,
|
|
5138
5146
|
o
|
|
5139
5147
|
]), !Ht)) {
|
|
5140
|
-
const h = n.initFocus(setTimeout.bind(ee,
|
|
5148
|
+
const h = n.initFocus(setTimeout.bind(ee, Or.bind(ee, s, Hr))), p = n.initReconnect(setTimeout.bind(ee, Or.bind(ee, s, Gr)));
|
|
5141
5149
|
a = () => {
|
|
5142
5150
|
h && h(), p && p(), Re.delete(t);
|
|
5143
5151
|
};
|
|
@@ -5154,16 +5162,16 @@ const Sr = (t, e) => {
|
|
|
5154
5162
|
t,
|
|
5155
5163
|
Re.get(t)[4]
|
|
5156
5164
|
];
|
|
5157
|
-
},
|
|
5165
|
+
}, _c = (t, e, n, s, r) => {
|
|
5158
5166
|
const a = n.errorRetryCount, i = r.retryCount, o = ~~((Math.random() + 0.5) * (1 << (i < 8 ? i : 8))) * n.errorRetryInterval;
|
|
5159
|
-
!
|
|
5160
|
-
},
|
|
5167
|
+
!R(a) && i > a || setTimeout(s, o, r);
|
|
5168
|
+
}, bc = _s, [ea, wc] = vc(/* @__PURE__ */ new Map()), kc = Ue(
|
|
5161
5169
|
{
|
|
5162
5170
|
// events
|
|
5163
5171
|
onLoadingSlow: Me,
|
|
5164
5172
|
onSuccess: Me,
|
|
5165
5173
|
onError: Me,
|
|
5166
|
-
onErrorRetry:
|
|
5174
|
+
onErrorRetry: _c,
|
|
5167
5175
|
onDiscarded: Me,
|
|
5168
5176
|
// switches
|
|
5169
5177
|
revalidateOnFocus: !0,
|
|
@@ -5171,29 +5179,29 @@ const Sr = (t, e) => {
|
|
|
5171
5179
|
revalidateIfStale: !0,
|
|
5172
5180
|
shouldRetryOnError: !0,
|
|
5173
5181
|
// timeouts
|
|
5174
|
-
errorRetryInterval:
|
|
5182
|
+
errorRetryInterval: Sr ? 1e4 : 5e3,
|
|
5175
5183
|
focusThrottleInterval: 5 * 1e3,
|
|
5176
5184
|
dedupingInterval: 2 * 1e3,
|
|
5177
|
-
loadingTimeout:
|
|
5185
|
+
loadingTimeout: Sr ? 5e3 : 3e3,
|
|
5178
5186
|
// providers
|
|
5179
|
-
compare:
|
|
5187
|
+
compare: bc,
|
|
5180
5188
|
isPaused: () => !1,
|
|
5181
|
-
cache:
|
|
5182
|
-
mutate:
|
|
5189
|
+
cache: ea,
|
|
5190
|
+
mutate: wc,
|
|
5183
5191
|
fallback: {}
|
|
5184
5192
|
},
|
|
5185
5193
|
// use web preset by default
|
|
5186
|
-
|
|
5187
|
-
),
|
|
5188
|
-
const n =
|
|
5194
|
+
hc
|
|
5195
|
+
), Ec = (t, e) => {
|
|
5196
|
+
const n = Ue(t, e);
|
|
5189
5197
|
if (e) {
|
|
5190
5198
|
const { use: s, fallback: r } = t, { use: a, fallback: i } = e;
|
|
5191
|
-
s && a && (n.use = s.concat(a)), r && i && (n.fallback =
|
|
5199
|
+
s && a && (n.use = s.concat(a)), r && i && (n.fallback = Ue(r, i));
|
|
5192
5200
|
}
|
|
5193
5201
|
return n;
|
|
5194
|
-
}, xc =
|
|
5195
|
-
|
|
5196
|
-
},
|
|
5202
|
+
}, xc = fa({}), Sc = "$inf$", ta = Xt && window.__SWR_DEVTOOLS_USE__, Oc = ta ? window.__SWR_DEVTOOLS_USE__ : [], Tc = () => {
|
|
5203
|
+
ta && (window.__SWR_DEVTOOLS_REACT__ = Gt);
|
|
5204
|
+
}, Cc = (t) => be(t[1]) ? [
|
|
5197
5205
|
t[0],
|
|
5198
5206
|
t[1],
|
|
5199
5207
|
t[2] || {}
|
|
@@ -5201,27 +5209,27 @@ const Sr = (t, e) => {
|
|
|
5201
5209
|
t[0],
|
|
5202
5210
|
null,
|
|
5203
5211
|
(t[1] === null ? t[2] : t[1]) || {}
|
|
5204
|
-
],
|
|
5205
|
-
const [i] = js(e), [, , , o] = Re.get(
|
|
5206
|
-
if (i.startsWith(
|
|
5212
|
+
], Ac = () => Ue(kc, ma(xc)), Nc = (t) => (e, n, s) => t(e, n && ((...a) => {
|
|
5213
|
+
const [i] = js(e), [, , , o] = Re.get(ea);
|
|
5214
|
+
if (i.startsWith(Sc))
|
|
5207
5215
|
return n(...a);
|
|
5208
5216
|
const c = o[i];
|
|
5209
|
-
return
|
|
5210
|
-
}), s),
|
|
5211
|
-
const s =
|
|
5217
|
+
return R(c) ? n(...a) : (delete o[i], c);
|
|
5218
|
+
}), s), Rc = Oc.concat(Nc), Pc = (t) => function(...n) {
|
|
5219
|
+
const s = Ac(), [r, a, i] = Cc(n), o = Ec(s, i);
|
|
5212
5220
|
let c = t;
|
|
5213
|
-
const { use: u } = o, h = (u || []).concat(
|
|
5221
|
+
const { use: u } = o, h = (u || []).concat(Rc);
|
|
5214
5222
|
for (let p = h.length; p--; )
|
|
5215
5223
|
c = h[p](c);
|
|
5216
5224
|
return c(r, a || o.fetcher || null, o);
|
|
5217
|
-
},
|
|
5225
|
+
}, Ic = (t, e, n) => {
|
|
5218
5226
|
const s = e[t] || (e[t] = []);
|
|
5219
5227
|
return s.push(n), () => {
|
|
5220
5228
|
const r = s.indexOf(n);
|
|
5221
5229
|
r >= 0 && (s[r] = s[s.length - 1], s.pop());
|
|
5222
5230
|
};
|
|
5223
5231
|
};
|
|
5224
|
-
|
|
5232
|
+
Tc();
|
|
5225
5233
|
const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
|
|
5226
5234
|
// and emitting an error.
|
|
5227
5235
|
// We assume that this is only for the `use(thenable)` case, not `use(context)`.
|
|
@@ -5243,86 +5251,86 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5243
5251
|
}
|
|
5244
5252
|
}), Kn = {
|
|
5245
5253
|
dedupe: !0
|
|
5246
|
-
},
|
|
5247
|
-
const { cache: s, compare: r, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale: c, refreshInterval: u, refreshWhenHidden: h, refreshWhenOffline: p, keepPreviousData: k } = n, [
|
|
5254
|
+
}, jc = (t, e, n) => {
|
|
5255
|
+
const { cache: s, compare: r, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale: c, refreshInterval: u, refreshWhenHidden: h, refreshWhenOffline: p, keepPreviousData: k } = n, [g, b, m, _] = Re.get(s), [l, A] = js(t), I = Be(!1), V = Be(!1), M = Be(l), z = Be(e), Z = Be(n), P = () => Z.current, Se = () => P().isVisible() && P().isOnline(), [F, st, Ve, le] = Yr(s, l), rt = Be({}).current, Yt = R(i) ? R(n.fallback) ? ee : n.fallback[l] : i, Zs = ($, L) => {
|
|
5248
5256
|
for (const G in rt) {
|
|
5249
|
-
const
|
|
5250
|
-
if (
|
|
5251
|
-
if (!r(
|
|
5257
|
+
const K = G;
|
|
5258
|
+
if (K === "data") {
|
|
5259
|
+
if (!r($[K], L[K]) && (!R($[K]) || !r(en, L[K])))
|
|
5252
5260
|
return !1;
|
|
5253
|
-
} else if (
|
|
5261
|
+
} else if (L[K] !== $[K])
|
|
5254
5262
|
return !1;
|
|
5255
5263
|
}
|
|
5256
5264
|
return !0;
|
|
5257
|
-
}, Ds =
|
|
5258
|
-
const
|
|
5259
|
-
const Oe =
|
|
5260
|
-
return delete Oe._k,
|
|
5265
|
+
}, Ds = ya(() => {
|
|
5266
|
+
const $ = !l || !e ? !1 : R(o) ? P().isPaused() || a ? !1 : c !== !1 : o, L = (Y) => {
|
|
5267
|
+
const Oe = Ue(Y);
|
|
5268
|
+
return delete Oe._k, $ ? Ke({
|
|
5261
5269
|
isValidating: !0,
|
|
5262
5270
|
isLoading: !0
|
|
5263
5271
|
}, Oe) : Oe;
|
|
5264
|
-
}, G = F(),
|
|
5272
|
+
}, G = F(), K = le(), fe = L(G), ot = G === K ? fe : L(K);
|
|
5265
5273
|
let H = fe;
|
|
5266
5274
|
return [
|
|
5267
5275
|
() => {
|
|
5268
|
-
const Y =
|
|
5276
|
+
const Y = L(F());
|
|
5269
5277
|
return Zs(Y, H) ? (H.data = Y.data, H.isLoading = Y.isLoading, H.isValidating = Y.isValidating, H.error = Y.error, H) : (H = Y, Y);
|
|
5270
5278
|
},
|
|
5271
5279
|
() => ot
|
|
5272
5280
|
];
|
|
5273
5281
|
}, [
|
|
5274
5282
|
s,
|
|
5275
|
-
|
|
5276
|
-
]), at =
|
|
5277
|
-
(
|
|
5278
|
-
Zs(G,
|
|
5283
|
+
l
|
|
5284
|
+
]), at = ic.useSyncExternalStore(rn(
|
|
5285
|
+
($) => Ve(l, (L, G) => {
|
|
5286
|
+
Zs(G, L) || $();
|
|
5279
5287
|
}),
|
|
5280
5288
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5281
5289
|
[
|
|
5282
5290
|
s,
|
|
5283
|
-
|
|
5291
|
+
l
|
|
5284
5292
|
]
|
|
5285
|
-
), Ds[0], Ds[1]), Ms = !
|
|
5286
|
-
(
|
|
5287
|
-
const
|
|
5288
|
-
if (!
|
|
5293
|
+
), Ds[0], Ds[1]), Ms = !I.current, na = g[l] && g[l].length > 0, it = at.data, ze = R(it) ? Yt && Xr(Yt) ? zn(Yt) : Yt : it, Qt = at.error, Cn = Be(ze), en = k ? R(it) ? R(Cn.current) ? ze : Cn.current : it : ze, Ls = na && !R(Qt) ? !1 : Ms && !R(o) ? o : P().isPaused() ? !1 : a ? R(ze) ? !1 : c : R(ze) || c, $s = !!(l && e && Ms && Ls), sa = R(at.isValidating) ? $s : at.isValidating, ra = R(at.isLoading) ? $s : at.isLoading, wt = rn(
|
|
5294
|
+
($) => Ie(void 0, null, function* () {
|
|
5295
|
+
const L = z.current;
|
|
5296
|
+
if (!l || !L || V.current || P().isPaused())
|
|
5289
5297
|
return !1;
|
|
5290
|
-
let G,
|
|
5291
|
-
const ot =
|
|
5298
|
+
let G, K, fe = !0;
|
|
5299
|
+
const ot = $ || {}, H = !m[l] || !ot.dedupe, Y = () => xr ? !V.current && l === M.current && I.current : l === M.current, Oe = {
|
|
5292
5300
|
isValidating: !1,
|
|
5293
5301
|
isLoading: !1
|
|
5294
5302
|
}, Ws = () => {
|
|
5295
5303
|
st(Oe);
|
|
5296
|
-
},
|
|
5297
|
-
const ue = l
|
|
5298
|
-
ue && ue[1] ===
|
|
5299
|
-
},
|
|
5304
|
+
}, Us = () => {
|
|
5305
|
+
const ue = m[l];
|
|
5306
|
+
ue && ue[1] === K && delete m[l];
|
|
5307
|
+
}, Vs = {
|
|
5300
5308
|
isValidating: !0
|
|
5301
5309
|
};
|
|
5302
|
-
|
|
5310
|
+
R(F().data) && (Vs.isLoading = !0);
|
|
5303
5311
|
try {
|
|
5304
|
-
if (H && (st(
|
|
5305
|
-
fe && Y() &&
|
|
5306
|
-
}, n.loadingTimeout), l
|
|
5307
|
-
|
|
5312
|
+
if (H && (st(Vs), n.loadingTimeout && R(F().data) && setTimeout(() => {
|
|
5313
|
+
fe && Y() && P().onLoadingSlow(l, n);
|
|
5314
|
+
}, n.loadingTimeout), m[l] = [
|
|
5315
|
+
L(A),
|
|
5308
5316
|
Os()
|
|
5309
|
-
]), [G,
|
|
5310
|
-
return H && Y() &&
|
|
5317
|
+
]), [G, K] = m[l], G = yield G, H && setTimeout(Us, n.dedupingInterval), !m[l] || m[l][1] !== K)
|
|
5318
|
+
return H && Y() && P().onDiscarded(l), !1;
|
|
5311
5319
|
Oe.error = ee;
|
|
5312
|
-
const ue = b[
|
|
5313
|
-
if (!
|
|
5314
|
-
(
|
|
5315
|
-
|
|
5320
|
+
const ue = b[l];
|
|
5321
|
+
if (!R(ue) && // case 1
|
|
5322
|
+
(K <= ue[0] || // case 2
|
|
5323
|
+
K <= ue[1] || // case 3
|
|
5316
5324
|
ue[1] === 0))
|
|
5317
|
-
return Ws(), H && Y() &&
|
|
5325
|
+
return Ws(), H && Y() && P().onDiscarded(l), !1;
|
|
5318
5326
|
const Te = F().data;
|
|
5319
|
-
Oe.data = r(Te, G) ? Te : G, H && Y() &&
|
|
5327
|
+
Oe.data = r(Te, G) ? Te : G, H && Y() && P().onSuccess(G, l, n);
|
|
5320
5328
|
} catch (ue) {
|
|
5321
|
-
|
|
5322
|
-
const Te =
|
|
5323
|
-
Te.isPaused() || (Oe.error = ue, H && Y() && (Te.onError(ue,
|
|
5324
|
-
const Nn =
|
|
5325
|
-
Nn && Nn[0] && Nn[0](
|
|
5329
|
+
Us();
|
|
5330
|
+
const Te = P(), { shouldRetryOnError: An } = Te;
|
|
5331
|
+
Te.isPaused() || (Oe.error = ue, H && Y() && (Te.onError(ue, l, Te), (An === !0 || be(An) && An(ue)) && (!P().revalidateOnFocus || !P().revalidateOnReconnect || Se()) && Te.onErrorRetry(ue, l, Te, (aa) => {
|
|
5332
|
+
const Nn = g[l];
|
|
5333
|
+
Nn && Nn[0] && Nn[0](kr, aa);
|
|
5326
5334
|
}, {
|
|
5327
5335
|
retryCount: (ot.retryCount || 0) + 1,
|
|
5328
5336
|
dedupe: !0
|
|
@@ -5342,76 +5350,76 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5342
5350
|
// even though it might cause unexpected behaviors.
|
|
5343
5351
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5344
5352
|
[
|
|
5345
|
-
|
|
5353
|
+
l,
|
|
5346
5354
|
s
|
|
5347
5355
|
]
|
|
5348
|
-
),
|
|
5356
|
+
), Fs = rn(
|
|
5349
5357
|
// Use callback to make sure `keyRef.current` returns latest result every time
|
|
5350
|
-
(
|
|
5358
|
+
(...$) => Qr(s, M.current, ...$),
|
|
5351
5359
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5352
5360
|
[]
|
|
5353
5361
|
);
|
|
5354
5362
|
if (Wn(() => {
|
|
5355
|
-
|
|
5363
|
+
z.current = e, Z.current = n, R(it) || (Cn.current = it);
|
|
5356
5364
|
}), Wn(() => {
|
|
5357
|
-
if (!
|
|
5358
|
-
const
|
|
5359
|
-
let
|
|
5360
|
-
|
|
5361
|
-
const
|
|
5362
|
-
if (fe ==
|
|
5365
|
+
if (!l) return;
|
|
5366
|
+
const $ = wt.bind(ee, Kn);
|
|
5367
|
+
let L = 0;
|
|
5368
|
+
P().revalidateOnFocus && (L = Date.now() + P().focusThrottleInterval);
|
|
5369
|
+
const K = Ic(l, g, (fe, ot = {}) => {
|
|
5370
|
+
if (fe == Hr) {
|
|
5363
5371
|
const H = Date.now();
|
|
5364
|
-
|
|
5365
|
-
} else if (fe ==
|
|
5366
|
-
|
|
5372
|
+
P().revalidateOnFocus && H > L && Se() && (L = H + P().focusThrottleInterval, $());
|
|
5373
|
+
} else if (fe == Gr)
|
|
5374
|
+
P().revalidateOnReconnect && Se() && $();
|
|
5367
5375
|
else {
|
|
5368
|
-
if (fe ==
|
|
5376
|
+
if (fe == Jr)
|
|
5369
5377
|
return wt();
|
|
5370
|
-
if (fe ==
|
|
5378
|
+
if (fe == kr)
|
|
5371
5379
|
return wt(ot);
|
|
5372
5380
|
}
|
|
5373
5381
|
});
|
|
5374
|
-
return
|
|
5375
|
-
_k:
|
|
5376
|
-
}), Ls && (
|
|
5377
|
-
|
|
5382
|
+
return V.current = !1, M.current = l, I.current = !0, st({
|
|
5383
|
+
_k: A
|
|
5384
|
+
}), Ls && (R(ze) || Ht ? $() : mc($)), () => {
|
|
5385
|
+
V.current = !0, K();
|
|
5378
5386
|
};
|
|
5379
5387
|
}, [
|
|
5380
|
-
|
|
5388
|
+
l
|
|
5381
5389
|
]), Wn(() => {
|
|
5382
|
-
let
|
|
5383
|
-
function
|
|
5384
|
-
const
|
|
5385
|
-
|
|
5390
|
+
let $;
|
|
5391
|
+
function L() {
|
|
5392
|
+
const K = be(u) ? u(F().data) : u;
|
|
5393
|
+
K && $ !== -1 && ($ = setTimeout(G, K));
|
|
5386
5394
|
}
|
|
5387
5395
|
function G() {
|
|
5388
|
-
!F().error && (h ||
|
|
5396
|
+
!F().error && (h || P().isVisible()) && (p || P().isOnline()) ? wt(Kn).then(L) : L();
|
|
5389
5397
|
}
|
|
5390
|
-
return
|
|
5391
|
-
|
|
5398
|
+
return L(), () => {
|
|
5399
|
+
$ && (clearTimeout($), $ = -1);
|
|
5392
5400
|
};
|
|
5393
5401
|
}, [
|
|
5394
5402
|
u,
|
|
5395
5403
|
h,
|
|
5396
5404
|
p,
|
|
5397
|
-
|
|
5398
|
-
]),
|
|
5405
|
+
l
|
|
5406
|
+
]), ga(en), a && R(ze) && l) {
|
|
5399
5407
|
if (!xr && Ht)
|
|
5400
5408
|
throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
5401
|
-
|
|
5402
|
-
const
|
|
5403
|
-
if (!
|
|
5404
|
-
const
|
|
5405
|
-
zn(
|
|
5409
|
+
z.current = e, Z.current = n, V.current = !1;
|
|
5410
|
+
const $ = _[l];
|
|
5411
|
+
if (!R($)) {
|
|
5412
|
+
const L = Fs($);
|
|
5413
|
+
zn(L);
|
|
5406
5414
|
}
|
|
5407
|
-
if (
|
|
5408
|
-
const
|
|
5409
|
-
|
|
5415
|
+
if (R(Qt)) {
|
|
5416
|
+
const L = wt(Kn);
|
|
5417
|
+
R(en) || (L.status = "fulfilled", L.value = !0), zn(L);
|
|
5410
5418
|
} else
|
|
5411
5419
|
throw Qt;
|
|
5412
5420
|
}
|
|
5413
5421
|
return {
|
|
5414
|
-
mutate:
|
|
5422
|
+
mutate: Fs,
|
|
5415
5423
|
get data() {
|
|
5416
5424
|
return rt.data = !0, en;
|
|
5417
5425
|
},
|
|
@@ -5419,21 +5427,21 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5419
5427
|
return rt.error = !0, Qt;
|
|
5420
5428
|
},
|
|
5421
5429
|
get isValidating() {
|
|
5422
|
-
return rt.isValidating = !0,
|
|
5430
|
+
return rt.isValidating = !0, sa;
|
|
5423
5431
|
},
|
|
5424
5432
|
get isLoading() {
|
|
5425
|
-
return rt.isLoading = !0,
|
|
5433
|
+
return rt.isLoading = !0, ra;
|
|
5426
5434
|
}
|
|
5427
5435
|
};
|
|
5428
|
-
},
|
|
5436
|
+
}, Zc = Pc(jc), Fc = ({
|
|
5429
5437
|
fileKey: t,
|
|
5430
5438
|
authToken: e,
|
|
5431
5439
|
enabled: n = !0,
|
|
5432
5440
|
params: s = {}
|
|
5433
5441
|
}) => {
|
|
5434
|
-
const r = !!(n && t && e), { data: a, isLoading: i, error: o } =
|
|
5442
|
+
const r = !!(n && t && e), { data: a, isLoading: i, error: o } = Zc(
|
|
5435
5443
|
["useFigmaFile", t, e, s],
|
|
5436
|
-
() => r ?
|
|
5444
|
+
() => r ? Ni({
|
|
5437
5445
|
fileKey: t,
|
|
5438
5446
|
authToken: e,
|
|
5439
5447
|
params: s
|
|
@@ -5451,7 +5459,7 @@ const zn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5451
5459
|
};
|
|
5452
5460
|
};
|
|
5453
5461
|
export {
|
|
5454
|
-
|
|
5462
|
+
$c as useAnimaCodegen,
|
|
5455
5463
|
Fc as useFigmaFile
|
|
5456
5464
|
};
|
|
5457
5465
|
//# sourceMappingURL=index.js.map
|