@animaapp/anima-sdk-react 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +6 -6
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +437 -431
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/useAnimaCodegen.ts +6 -1
package/dist/index.js
CHANGED
|
@@ -40,15 +40,15 @@ class Hr extends Error {
|
|
|
40
40
|
super(e), tn(this, "type"), tn(this, "field"), tn(this, "value"), tn(this, "line"), this.name = "ParseError", this.type = n.type, this.field = n.field, this.value = n.value, this.line = n.line;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function Rn(t) {
|
|
44
44
|
}
|
|
45
45
|
function va(t) {
|
|
46
|
-
const { onEvent: e =
|
|
46
|
+
const { onEvent: e = Rn, onError: n = Rn, onRetry: r = Rn, onComment: s } = t;
|
|
47
47
|
let a = "", i = !0, o, u = "", c = "";
|
|
48
48
|
function h(l) {
|
|
49
|
-
const v = i ? l.replace(/^\xEF\xBB\xBF/, "") : l, [
|
|
50
|
-
for (const
|
|
51
|
-
p(
|
|
49
|
+
const v = i ? l.replace(/^\xEF\xBB\xBF/, "") : l, [m, z] = ba(`${a}${v}`);
|
|
50
|
+
for (const R of m)
|
|
51
|
+
p(R);
|
|
52
52
|
a = z, i = !1;
|
|
53
53
|
}
|
|
54
54
|
function p(l) {
|
|
@@ -62,13 +62,13 @@ function va(t) {
|
|
|
62
62
|
}
|
|
63
63
|
const v = l.indexOf(":");
|
|
64
64
|
if (v !== -1) {
|
|
65
|
-
const
|
|
66
|
-
k(
|
|
65
|
+
const m = l.slice(0, v), z = l[v + 1] === " " ? 2 : 1, R = l.slice(v + z);
|
|
66
|
+
k(m, R, l);
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
k(l, "", l);
|
|
70
70
|
}
|
|
71
|
-
function k(l, v,
|
|
71
|
+
function k(l, v, m) {
|
|
72
72
|
switch (l) {
|
|
73
73
|
case "event":
|
|
74
74
|
c = v;
|
|
@@ -85,7 +85,7 @@ function va(t) {
|
|
|
85
85
|
new Hr(`Invalid \`retry\` value: "${v}"`, {
|
|
86
86
|
type: "invalid-retry",
|
|
87
87
|
value: v,
|
|
88
|
-
line:
|
|
88
|
+
line: m
|
|
89
89
|
})
|
|
90
90
|
);
|
|
91
91
|
break;
|
|
@@ -93,7 +93,7 @@ function va(t) {
|
|
|
93
93
|
n(
|
|
94
94
|
new Hr(
|
|
95
95
|
`Unknown field "${l.length > 20 ? `${l.slice(0, 20)}…` : l}"`,
|
|
96
|
-
{ type: "unknown-field", field: l, value: v, line:
|
|
96
|
+
{ type: "unknown-field", field: l, value: v, line: m }
|
|
97
97
|
)
|
|
98
98
|
);
|
|
99
99
|
break;
|
|
@@ -187,11 +187,11 @@ function Jr(t) {
|
|
|
187
187
|
}
|
|
188
188
|
var Ss = (t) => {
|
|
189
189
|
throw TypeError(t);
|
|
190
|
-
}, Ar = (t, e, n) => e.has(t) || Ss("Cannot " + n), A = (t, e, n) => (Ar(t, e, "read from private field"), n ? n.call(t) : e.get(t)), U = (t, e, n) => e.has(t) ? Ss("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), L = (t, e, n, r) => (Ar(t, e, "write to private field"), e.set(t, n), n), Ce = (t, e, n) => (Ar(t, e, "access private method"), n),
|
|
190
|
+
}, Ar = (t, e, n) => e.has(t) || Ss("Cannot " + n), A = (t, e, n) => (Ar(t, e, "read from private field"), n ? n.call(t) : e.get(t)), U = (t, e, n) => e.has(t) ? Ss("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), L = (t, e, n, r) => (Ar(t, e, "write to private field"), e.set(t, n), n), Ce = (t, e, n) => (Ar(t, e, "access private method"), n), re, He, ut, on, fn, Nt, ft, Pt, Ze, ct, ht, dt, Et, fe, Hn, Gn, Jn, Xr, Xn, Yn, xt, Qn, er;
|
|
191
191
|
class un extends EventTarget {
|
|
192
192
|
constructor(e, n) {
|
|
193
193
|
var r, s;
|
|
194
|
-
super(), U(this, fe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, U(this,
|
|
194
|
+
super(), U(this, fe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, U(this, re), U(this, He), U(this, ut), U(this, on), U(this, fn), U(this, Nt), U(this, ft), U(this, Pt, null), U(this, Ze), U(this, ct), U(this, ht, null), U(this, dt, null), U(this, Et, null), U(this, Gn, (a) => Be(this, null, function* () {
|
|
195
195
|
var i;
|
|
196
196
|
A(this, ct).reset();
|
|
197
197
|
const { body: o, redirected: u, status: c, headers: h } = a;
|
|
@@ -207,9 +207,9 @@ class un extends EventTarget {
|
|
|
207
207
|
Ce(this, fe, xt).call(this, 'Invalid content type, expected "text/event-stream"', c);
|
|
208
208
|
return;
|
|
209
209
|
}
|
|
210
|
-
if (A(this,
|
|
210
|
+
if (A(this, re) === this.CLOSED)
|
|
211
211
|
return;
|
|
212
|
-
L(this,
|
|
212
|
+
L(this, re, this.OPEN);
|
|
213
213
|
const p = new Event("open");
|
|
214
214
|
if ((i = A(this, Et)) == null || i.call(this, p), this.dispatchEvent(p), typeof o != "object" || !o || !("getReader" in o)) {
|
|
215
215
|
Ce(this, fe, xt).call(this, "Invalid response body, expected a web ReadableStream", c), this.close();
|
|
@@ -224,7 +224,7 @@ class un extends EventTarget {
|
|
|
224
224
|
})), U(this, Jn, (a) => {
|
|
225
225
|
L(this, Ze, void 0), !(a.name === "AbortError" || a.type === "aborted") && Ce(this, fe, Qn).call(this, Kn(a));
|
|
226
226
|
}), U(this, Xn, (a) => {
|
|
227
|
-
typeof a.id == "string" && L(this,
|
|
227
|
+
typeof a.id == "string" && L(this, Pt, a.id);
|
|
228
228
|
const i = new MessageEvent(a.event || "message", {
|
|
229
229
|
data: a.data,
|
|
230
230
|
origin: A(this, ut) ? A(this, ut).origin : A(this, He).origin,
|
|
@@ -232,9 +232,9 @@ class un extends EventTarget {
|
|
|
232
232
|
});
|
|
233
233
|
A(this, dt) && (!a.event || a.event === "message") && A(this, dt).call(this, i), this.dispatchEvent(i);
|
|
234
234
|
}), U(this, Yn, (a) => {
|
|
235
|
-
L(this,
|
|
235
|
+
L(this, Nt, a);
|
|
236
236
|
}), U(this, er, () => {
|
|
237
|
-
L(this, ft, void 0), A(this,
|
|
237
|
+
L(this, ft, void 0), A(this, re) === this.CONNECTING && Ce(this, fe, Hn).call(this);
|
|
238
238
|
});
|
|
239
239
|
try {
|
|
240
240
|
if (e instanceof URL)
|
|
@@ -249,7 +249,7 @@ class un extends EventTarget {
|
|
|
249
249
|
L(this, ct, va({
|
|
250
250
|
onEvent: A(this, Xn),
|
|
251
251
|
onRetry: A(this, Yn)
|
|
252
|
-
})), L(this,
|
|
252
|
+
})), L(this, re, this.CONNECTING), L(this, Nt, 3e3), L(this, fn, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), L(this, on, (s = n == null ? void 0 : n.withCredentials) != null ? s : !1), Ce(this, fe, Hn).call(this);
|
|
253
253
|
}
|
|
254
254
|
/**
|
|
255
255
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -262,7 +262,7 @@ class un extends EventTarget {
|
|
|
262
262
|
* @public
|
|
263
263
|
*/
|
|
264
264
|
get readyState() {
|
|
265
|
-
return A(this,
|
|
265
|
+
return A(this, re);
|
|
266
266
|
}
|
|
267
267
|
/**
|
|
268
268
|
* Returns the URL providing the event stream.
|
|
@@ -319,16 +319,16 @@ class un extends EventTarget {
|
|
|
319
319
|
* @public
|
|
320
320
|
*/
|
|
321
321
|
close() {
|
|
322
|
-
A(this, ft) && clearTimeout(A(this, ft)), A(this,
|
|
322
|
+
A(this, ft) && clearTimeout(A(this, ft)), A(this, re) !== this.CLOSED && (A(this, Ze) && A(this, Ze).abort(), L(this, re, this.CLOSED), L(this, Ze, void 0));
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
|
|
325
|
+
re = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), on = /* @__PURE__ */ new WeakMap(), fn = /* @__PURE__ */ new WeakMap(), Nt = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), Pt = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), ct = /* @__PURE__ */ new WeakMap(), ht = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), Et = /* @__PURE__ */ new WeakMap(), fe = /* @__PURE__ */ new WeakSet(), /**
|
|
326
326
|
* Connect to the given URL and start receiving events
|
|
327
327
|
*
|
|
328
328
|
* @internal
|
|
329
329
|
*/
|
|
330
330
|
Hn = function() {
|
|
331
|
-
L(this,
|
|
331
|
+
L(this, re, this.CONNECTING), L(this, Ze, new AbortController()), A(this, fn)(A(this, He), Ce(this, fe, Xr).call(this)).then(A(this, Gn)).catch(A(this, Jn));
|
|
332
332
|
}, Gn = /* @__PURE__ */ new WeakMap(), Jn = /* @__PURE__ */ new WeakMap(), /**
|
|
333
333
|
* Get request options for the `fetch()` request
|
|
334
334
|
*
|
|
@@ -342,7 +342,7 @@ Xr = function() {
|
|
|
342
342
|
// [spec] …will have their mode set to "cors"…
|
|
343
343
|
mode: "cors",
|
|
344
344
|
redirect: "follow",
|
|
345
|
-
headers: Ue({ Accept: "text/event-stream" }, A(this,
|
|
345
|
+
headers: Ue({ Accept: "text/event-stream" }, A(this, Pt) ? { "Last-Event-ID": A(this, Pt) } : void 0),
|
|
346
346
|
cache: "no-store",
|
|
347
347
|
signal: (t = A(this, Ze)) == null ? void 0 : t.signal
|
|
348
348
|
};
|
|
@@ -356,7 +356,7 @@ Xr = function() {
|
|
|
356
356
|
*/
|
|
357
357
|
xt = function(t, e) {
|
|
358
358
|
var n;
|
|
359
|
-
A(this,
|
|
359
|
+
A(this, re) !== this.CLOSED && L(this, re, this.CLOSED);
|
|
360
360
|
const r = new Gr("error", { code: e, message: t });
|
|
361
361
|
(n = A(this, ht)) == null || n.call(this, r), this.dispatchEvent(r);
|
|
362
362
|
}, /**
|
|
@@ -368,11 +368,11 @@ xt = function(t, e) {
|
|
|
368
368
|
*/
|
|
369
369
|
Qn = function(t, e) {
|
|
370
370
|
var n;
|
|
371
|
-
if (A(this,
|
|
371
|
+
if (A(this, re) === this.CLOSED)
|
|
372
372
|
return;
|
|
373
|
-
L(this,
|
|
373
|
+
L(this, re, this.CONNECTING);
|
|
374
374
|
const r = new Gr("error", { code: e, message: t });
|
|
375
|
-
(n = A(this, ht)) == null || n.call(this, r), this.dispatchEvent(r), L(this, ft, setTimeout(A(this, er), A(this,
|
|
375
|
+
(n = A(this, ht)) == null || n.call(this, r), this.dispatchEvent(r), L(this, ft, setTimeout(A(this, er), A(this, Nt)));
|
|
376
376
|
}, er = /* @__PURE__ */ new WeakMap(), /**
|
|
377
377
|
* ReadyState representing an EventSource currently trying to connect
|
|
378
378
|
*
|
|
@@ -424,7 +424,7 @@ var Os = Symbol.for("immer-nothing"), Yr = Symbol.for("immer-draftable"), oe = S
|
|
|
424
424
|
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
425
425
|
// See Patches.ts for additional errors
|
|
426
426
|
] : [];
|
|
427
|
-
function
|
|
427
|
+
function se(t, ...e) {
|
|
428
428
|
if (process.env.NODE_ENV !== "production") {
|
|
429
429
|
const n = Ea[t], r = typeof n == "function" ? n.apply(null, e) : n;
|
|
430
430
|
throw new Error(`[Immer] ${r}`);
|
|
@@ -510,11 +510,11 @@ function nr(t, e) {
|
|
|
510
510
|
return Object.assign(s, t);
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
function
|
|
514
|
-
return Tn(t) || yt(t) || !Ye(t) || (xn(t) > 1 && (t.set = t.add = t.clear = t.delete = Oa), Object.freeze(t), e && Object.entries(t).forEach(([n, r]) =>
|
|
513
|
+
function Rt(t, e = !1) {
|
|
514
|
+
return Tn(t) || yt(t) || !Ye(t) || (xn(t) > 1 && (t.set = t.add = t.clear = t.delete = Oa), Object.freeze(t), e && Object.entries(t).forEach(([n, r]) => Rt(r, !0))), t;
|
|
515
515
|
}
|
|
516
516
|
function Oa() {
|
|
517
|
-
|
|
517
|
+
se(2);
|
|
518
518
|
}
|
|
519
519
|
function Tn(t) {
|
|
520
520
|
return Object.isFrozen(t);
|
|
@@ -522,11 +522,11 @@ function Tn(t) {
|
|
|
522
522
|
var Ta = {};
|
|
523
523
|
function Qe(t) {
|
|
524
524
|
const e = Ta[t];
|
|
525
|
-
return e ||
|
|
525
|
+
return e || se(0, t), e;
|
|
526
526
|
}
|
|
527
|
-
var
|
|
527
|
+
var jt;
|
|
528
528
|
function Cs() {
|
|
529
|
-
return
|
|
529
|
+
return jt;
|
|
530
530
|
}
|
|
531
531
|
function Aa(t, e) {
|
|
532
532
|
return {
|
|
@@ -546,10 +546,10 @@ function rr(t) {
|
|
|
546
546
|
sr(t), t.drafts_.forEach(Ca), t.drafts_ = null;
|
|
547
547
|
}
|
|
548
548
|
function sr(t) {
|
|
549
|
-
t ===
|
|
549
|
+
t === jt && (jt = t.parent_);
|
|
550
550
|
}
|
|
551
551
|
function es(t) {
|
|
552
|
-
return
|
|
552
|
+
return jt = Aa(jt, t);
|
|
553
553
|
}
|
|
554
554
|
function Ca(t) {
|
|
555
555
|
const e = t[oe];
|
|
@@ -558,7 +558,7 @@ function Ca(t) {
|
|
|
558
558
|
function ts(t, e) {
|
|
559
559
|
e.unfinalizedDrafts_ = e.drafts_.length;
|
|
560
560
|
const n = e.drafts_[0];
|
|
561
|
-
return t !== void 0 && t !== n ? (n[oe].modified_ && (rr(e),
|
|
561
|
+
return t !== void 0 && t !== n ? (n[oe].modified_ && (rr(e), se(4)), Ye(t) && (t = pn(e, t), e.parent_ || mn(e, t)), e.patches_ && Qe("Patches").generateReplacementPatches_(
|
|
562
562
|
n[oe].base_,
|
|
563
563
|
t,
|
|
564
564
|
e.patches_,
|
|
@@ -595,7 +595,7 @@ function pn(t, e, n) {
|
|
|
595
595
|
return r.copy_;
|
|
596
596
|
}
|
|
597
597
|
function ns(t, e, n, r, s, a, i) {
|
|
598
|
-
if (process.env.NODE_ENV !== "production" && s === n &&
|
|
598
|
+
if (process.env.NODE_ENV !== "production" && s === n && se(5), yt(s)) {
|
|
599
599
|
const o = a && e && e.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
600
600
|
!tr(e.assigned_, r) ? a.concat(r) : void 0, u = pn(t, s, o);
|
|
601
601
|
if (As(n, r, u), yt(u))
|
|
@@ -610,9 +610,9 @@ function ns(t, e, n, r, s, a, i) {
|
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
612
|
function mn(t, e, n = !1) {
|
|
613
|
-
!t.parent_ && t.immer_.autoFreeze_ && t.canAutoFreeze_ &&
|
|
613
|
+
!t.parent_ && t.immer_.autoFreeze_ && t.canAutoFreeze_ && Rt(e, n);
|
|
614
614
|
}
|
|
615
|
-
function
|
|
615
|
+
function Na(t, e) {
|
|
616
616
|
const n = Array.isArray(t), r = {
|
|
617
617
|
type_: n ? 1 : 0,
|
|
618
618
|
// Track which produce call this is associated with.
|
|
@@ -637,7 +637,7 @@ function Pa(t, e) {
|
|
|
637
637
|
isManual_: !1
|
|
638
638
|
};
|
|
639
639
|
let s = r, a = Cr;
|
|
640
|
-
n && (s = [r], a =
|
|
640
|
+
n && (s = [r], a = It);
|
|
641
641
|
const { revoke: i, proxy: o } = Proxy.revocable(s, a);
|
|
642
642
|
return r.draft_ = o, r.revoke_ = i, o;
|
|
643
643
|
}
|
|
@@ -647,9 +647,9 @@ var Cr = {
|
|
|
647
647
|
return t;
|
|
648
648
|
const n = Ke(t);
|
|
649
649
|
if (!tr(n, e))
|
|
650
|
-
return
|
|
650
|
+
return Pa(t, n, e);
|
|
651
651
|
const r = n[e];
|
|
652
|
-
return t.finalized_ || !Ye(r) ? r : r ===
|
|
652
|
+
return t.finalized_ || !Ye(r) ? r : r === jn(t.base_, e) ? (In(t), t.copy_[e] = ir(r, t)) : r;
|
|
653
653
|
},
|
|
654
654
|
has(t, e) {
|
|
655
655
|
return e in Ke(t);
|
|
@@ -658,23 +658,23 @@ var Cr = {
|
|
|
658
658
|
return Reflect.ownKeys(Ke(t));
|
|
659
659
|
},
|
|
660
660
|
set(t, e, n) {
|
|
661
|
-
const r =
|
|
661
|
+
const r = Ns(Ke(t), e);
|
|
662
662
|
if (r != null && r.set)
|
|
663
663
|
return r.set.call(t.draft_, n), !0;
|
|
664
664
|
if (!t.modified_) {
|
|
665
|
-
const s =
|
|
665
|
+
const s = jn(Ke(t), e), a = s == null ? void 0 : s[oe];
|
|
666
666
|
if (a && a.base_ === n)
|
|
667
667
|
return t.copy_[e] = n, t.assigned_[e] = !1, !0;
|
|
668
668
|
if (Sa(n, s) && (n !== void 0 || tr(t.base_, e)))
|
|
669
669
|
return !0;
|
|
670
|
-
|
|
670
|
+
In(t), ar(t);
|
|
671
671
|
}
|
|
672
672
|
return t.copy_[e] === n && // special case: handle new props with value 'undefined'
|
|
673
673
|
(n !== void 0 || e in t.copy_) || // special case: NaN
|
|
674
674
|
Number.isNaN(n) && Number.isNaN(t.copy_[e]) || (t.copy_[e] = n, t.assigned_[e] = !0), !0;
|
|
675
675
|
},
|
|
676
676
|
deleteProperty(t, e) {
|
|
677
|
-
return
|
|
677
|
+
return jn(t.base_, e) !== void 0 || e in t.base_ ? (t.assigned_[e] = !1, In(t), ar(t)) : delete t.assigned_[e], t.copy_ && delete t.copy_[e], !0;
|
|
678
678
|
},
|
|
679
679
|
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
680
680
|
// the same guarantee in ES5 mode.
|
|
@@ -688,40 +688,40 @@ var Cr = {
|
|
|
688
688
|
};
|
|
689
689
|
},
|
|
690
690
|
defineProperty() {
|
|
691
|
-
|
|
691
|
+
se(11);
|
|
692
692
|
},
|
|
693
693
|
getPrototypeOf(t) {
|
|
694
694
|
return mt(t.base_);
|
|
695
695
|
},
|
|
696
696
|
setPrototypeOf() {
|
|
697
|
-
|
|
697
|
+
se(12);
|
|
698
698
|
}
|
|
699
|
-
},
|
|
699
|
+
}, It = {};
|
|
700
700
|
hn(Cr, (t, e) => {
|
|
701
|
-
|
|
701
|
+
It[t] = function() {
|
|
702
702
|
return arguments[0] = arguments[0][0], e.apply(this, arguments);
|
|
703
703
|
};
|
|
704
704
|
});
|
|
705
|
-
|
|
706
|
-
return process.env.NODE_ENV !== "production" && isNaN(parseInt(e)) &&
|
|
705
|
+
It.deleteProperty = function(t, e) {
|
|
706
|
+
return process.env.NODE_ENV !== "production" && isNaN(parseInt(e)) && se(13), It.set.call(this, t, e, void 0);
|
|
707
707
|
};
|
|
708
|
-
|
|
709
|
-
return process.env.NODE_ENV !== "production" && e !== "length" && isNaN(parseInt(e)) &&
|
|
708
|
+
It.set = function(t, e, n) {
|
|
709
|
+
return process.env.NODE_ENV !== "production" && e !== "length" && isNaN(parseInt(e)) && se(14), Cr.set.call(this, t[0], e, n, t[0]);
|
|
710
710
|
};
|
|
711
|
-
function
|
|
711
|
+
function jn(t, e) {
|
|
712
712
|
const n = t[oe];
|
|
713
713
|
return (n ? Ke(n) : t)[e];
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function Pa(t, e, n) {
|
|
716
716
|
var s;
|
|
717
|
-
const r =
|
|
717
|
+
const r = Ns(e, n);
|
|
718
718
|
return r ? "value" in r ? r.value : (
|
|
719
719
|
// This is a very special case, if the prop is a getter defined by the
|
|
720
720
|
// prototype, we should invoke it with the draft as context!
|
|
721
721
|
(s = r.get) == null ? void 0 : s.call(t.draft_)
|
|
722
722
|
) : void 0;
|
|
723
723
|
}
|
|
724
|
-
function
|
|
724
|
+
function Ns(t, e) {
|
|
725
725
|
if (!(e in t))
|
|
726
726
|
return;
|
|
727
727
|
let n = mt(t);
|
|
@@ -735,13 +735,13 @@ function Ps(t, e) {
|
|
|
735
735
|
function ar(t) {
|
|
736
736
|
t.modified_ || (t.modified_ = !0, t.parent_ && ar(t.parent_));
|
|
737
737
|
}
|
|
738
|
-
function
|
|
738
|
+
function In(t) {
|
|
739
739
|
t.copy_ || (t.copy_ = nr(
|
|
740
740
|
t.base_,
|
|
741
741
|
t.scope_.immer_.useStrictShallowCopy_
|
|
742
742
|
));
|
|
743
743
|
}
|
|
744
|
-
var
|
|
744
|
+
var Ra = class {
|
|
745
745
|
constructor(t) {
|
|
746
746
|
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (e, n, r) => {
|
|
747
747
|
if (typeof e == "function" && typeof n != "function") {
|
|
@@ -752,7 +752,7 @@ var Na = class {
|
|
|
752
752
|
return i.produce(u, (h) => n.call(this, h, ...c));
|
|
753
753
|
};
|
|
754
754
|
}
|
|
755
|
-
typeof n != "function" &&
|
|
755
|
+
typeof n != "function" && se(6), r !== void 0 && typeof r != "function" && se(7);
|
|
756
756
|
let s;
|
|
757
757
|
if (Ye(e)) {
|
|
758
758
|
const a = es(this), i = ir(e, void 0);
|
|
@@ -764,13 +764,13 @@ var Na = class {
|
|
|
764
764
|
}
|
|
765
765
|
return Qr(a, r), ts(s, a);
|
|
766
766
|
} else if (!e || typeof e != "object") {
|
|
767
|
-
if (s = n(e), s === void 0 && (s = e), s === Os && (s = void 0), this.autoFreeze_ &&
|
|
767
|
+
if (s = n(e), s === void 0 && (s = e), s === Os && (s = void 0), this.autoFreeze_ && Rt(s, !0), r) {
|
|
768
768
|
const a = [], i = [];
|
|
769
769
|
Qe("Patches").generateReplacementPatches_(e, s, a, i), r(a, i);
|
|
770
770
|
}
|
|
771
771
|
return s;
|
|
772
772
|
} else
|
|
773
|
-
|
|
773
|
+
se(1, e);
|
|
774
774
|
}, this.produceWithPatches = (e, n) => {
|
|
775
775
|
if (typeof e == "function")
|
|
776
776
|
return (i, ...o) => this.produceWithPatches(i, (u) => e(u, ...o));
|
|
@@ -781,13 +781,13 @@ var Na = class {
|
|
|
781
781
|
}, typeof (t == null ? void 0 : t.autoFreeze) == "boolean" && this.setAutoFreeze(t.autoFreeze), typeof (t == null ? void 0 : t.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(t.useStrictShallowCopy);
|
|
782
782
|
}
|
|
783
783
|
createDraft(t) {
|
|
784
|
-
Ye(t) ||
|
|
784
|
+
Ye(t) || se(8), yt(t) && (t = ja(t));
|
|
785
785
|
const e = es(this), n = ir(t, void 0);
|
|
786
786
|
return n[oe].isManual_ = !0, sr(e), n;
|
|
787
787
|
}
|
|
788
788
|
finishDraft(t, e) {
|
|
789
789
|
const n = t && t[oe];
|
|
790
|
-
(!n || !n.isManual_) &&
|
|
790
|
+
(!n || !n.isManual_) && se(9);
|
|
791
791
|
const { scope_: r } = n;
|
|
792
792
|
return Qr(r, e), ts(void 0, r);
|
|
793
793
|
}
|
|
@@ -825,13 +825,13 @@ var Na = class {
|
|
|
825
825
|
}
|
|
826
826
|
};
|
|
827
827
|
function ir(t, e) {
|
|
828
|
-
const n = Sn(t) ? Qe("MapSet").proxyMap_(t, e) : On(t) ? Qe("MapSet").proxySet_(t, e) :
|
|
828
|
+
const n = Sn(t) ? Qe("MapSet").proxyMap_(t, e) : On(t) ? Qe("MapSet").proxySet_(t, e) : Na(t, e);
|
|
829
829
|
return (e ? e.scope_ : Cs()).drafts_.push(n), n;
|
|
830
830
|
}
|
|
831
|
-
function
|
|
832
|
-
return yt(t) ||
|
|
831
|
+
function ja(t) {
|
|
832
|
+
return yt(t) || se(10, t), Ps(t);
|
|
833
833
|
}
|
|
834
|
-
function
|
|
834
|
+
function Ps(t) {
|
|
835
835
|
if (!Ye(t) || Tn(t))
|
|
836
836
|
return t;
|
|
837
837
|
const e = t[oe];
|
|
@@ -843,10 +843,10 @@ function Rs(t) {
|
|
|
843
843
|
} else
|
|
844
844
|
n = nr(t, !0);
|
|
845
845
|
return hn(n, (r, s) => {
|
|
846
|
-
As(n, r,
|
|
846
|
+
As(n, r, Ps(s));
|
|
847
847
|
}), e && (e.finalized_ = !1), n;
|
|
848
848
|
}
|
|
849
|
-
var ue = new
|
|
849
|
+
var ue = new Ra(), Ia = ue.produce;
|
|
850
850
|
ue.produceWithPatches.bind(
|
|
851
851
|
ue
|
|
852
852
|
);
|
|
@@ -857,10 +857,10 @@ ue.createDraft.bind(ue);
|
|
|
857
857
|
ue.finishDraft.bind(ue);
|
|
858
858
|
function Za(t) {
|
|
859
859
|
var e = ca(function() {
|
|
860
|
-
return
|
|
860
|
+
return Rt(typeof t == "function" ? t() : t, !0);
|
|
861
861
|
}), n = e[1];
|
|
862
862
|
return [e[0], an(function(r) {
|
|
863
|
-
n(typeof r == "function" ?
|
|
863
|
+
n(typeof r == "function" ? Ia(r) : Rt(r));
|
|
864
864
|
}, [])];
|
|
865
865
|
}
|
|
866
866
|
const rs = {
|
|
@@ -909,14 +909,14 @@ const rs = {
|
|
|
909
909
|
const b = {};
|
|
910
910
|
o.addEventListener("start", (l) => {
|
|
911
911
|
const v = JSON.parse(l.data);
|
|
912
|
-
b.sessionId = v.sessionId, r((
|
|
913
|
-
|
|
912
|
+
b.sessionId = v.sessionId, r((m) => {
|
|
913
|
+
m.tasks.fetchDesign.status = "running";
|
|
914
914
|
});
|
|
915
915
|
}), o.addEventListener("pre_codegen", (l) => {
|
|
916
916
|
JSON.parse(
|
|
917
917
|
l.data
|
|
918
|
-
).message === "Anima model built" && r((
|
|
919
|
-
|
|
918
|
+
).message === "Anima model built" && r((m) => {
|
|
919
|
+
m.tasks.fetchDesign.status = "finished", m.tasks.codeGeneration.status = "running", m.tasks.uploadAssets.status = "running";
|
|
920
920
|
});
|
|
921
921
|
}), o.addEventListener("figma_metadata", (l) => {
|
|
922
922
|
const v = JSON.parse(
|
|
@@ -934,8 +934,8 @@ const rs = {
|
|
|
934
934
|
const v = JSON.parse(
|
|
935
935
|
l.data
|
|
936
936
|
);
|
|
937
|
-
v.payload.status === "success" && (b.files = v.payload.files), r((
|
|
938
|
-
|
|
937
|
+
v.payload.status === "success" && (b.files = v.payload.files), r((m) => {
|
|
938
|
+
m.tasks.codeGeneration.progress = v.payload.progress;
|
|
939
939
|
});
|
|
940
940
|
}), o.addEventListener("codegen_completed", () => {
|
|
941
941
|
r((l) => {
|
|
@@ -955,8 +955,8 @@ const rs = {
|
|
|
955
955
|
const v = JSON.parse(
|
|
956
956
|
l.data
|
|
957
957
|
);
|
|
958
|
-
r((
|
|
959
|
-
|
|
958
|
+
r((m) => {
|
|
959
|
+
m.status = "error", m.error = new Error(v.payload.message);
|
|
960
960
|
}), g({
|
|
961
961
|
result: null,
|
|
962
962
|
error: new Error(v.payload.message)
|
|
@@ -968,9 +968,12 @@ const rs = {
|
|
|
968
968
|
result: null,
|
|
969
969
|
error: new Error("HTTP error: " + l.message)
|
|
970
970
|
});
|
|
971
|
-
}), o.addEventListener("done", () => {
|
|
972
|
-
|
|
973
|
-
l.
|
|
971
|
+
}), o.addEventListener("done", (l) => {
|
|
972
|
+
const v = JSON.parse(
|
|
973
|
+
l.data
|
|
974
|
+
);
|
|
975
|
+
b.tokenUsage = v.payload.tokenUsage, r((m) => {
|
|
976
|
+
m.status = "success", m.result = b;
|
|
974
977
|
}), g({ result: b, error: null });
|
|
975
978
|
});
|
|
976
979
|
});
|
|
@@ -979,20 +982,20 @@ const rs = {
|
|
|
979
982
|
if (((h = i.assetsStorage) == null ? void 0 : h.strategy) === "local" && ((p = l == null ? void 0 : l.assets) != null && p.length)) {
|
|
980
983
|
const { filePath: v } = ss(
|
|
981
984
|
i.assetsStorage
|
|
982
|
-
),
|
|
983
|
-
const D = yield (yield fetch(
|
|
985
|
+
), m = l.assets.map((R) => Be(void 0, null, function* () {
|
|
986
|
+
const D = yield (yield fetch(R.url)).arrayBuffer();
|
|
984
987
|
return {
|
|
985
|
-
assetName:
|
|
988
|
+
assetName: R.name,
|
|
986
989
|
base64: ya(D)
|
|
987
990
|
};
|
|
988
|
-
})), z = yield Promise.allSettled(
|
|
989
|
-
for (const
|
|
991
|
+
})), z = yield Promise.allSettled(m);
|
|
992
|
+
for (const R of z) {
|
|
990
993
|
const q = {};
|
|
991
|
-
if (
|
|
992
|
-
const { assetName: D, base64: B } =
|
|
994
|
+
if (R.status === "fulfilled") {
|
|
995
|
+
const { assetName: D, base64: B } = R.value;
|
|
993
996
|
q[D] = B;
|
|
994
|
-
const
|
|
995
|
-
l.files[
|
|
997
|
+
const j = v ? `${v}/${D}` : D;
|
|
998
|
+
l.files[j] = {
|
|
996
999
|
content: B,
|
|
997
1000
|
isBinary: !0
|
|
998
1001
|
};
|
|
@@ -1094,16 +1097,16 @@ function Ma() {
|
|
|
1094
1097
|
v = i({
|
|
1095
1098
|
inst: { value: l, getSnapshot: b }
|
|
1096
1099
|
});
|
|
1097
|
-
var
|
|
1100
|
+
var m = v[0].inst, z = v[1];
|
|
1098
1101
|
return u(
|
|
1099
1102
|
function() {
|
|
1100
|
-
|
|
1103
|
+
m.value = l, m.getSnapshot = b, n(m) && z({ inst: m });
|
|
1101
1104
|
},
|
|
1102
1105
|
[g, l, b]
|
|
1103
1106
|
), o(
|
|
1104
1107
|
function() {
|
|
1105
|
-
return n(
|
|
1106
|
-
n(
|
|
1108
|
+
return n(m) && z({ inst: m }), g(function() {
|
|
1109
|
+
n(m) && z({ inst: m });
|
|
1107
1110
|
});
|
|
1108
1111
|
},
|
|
1109
1112
|
[g]
|
|
@@ -1132,7 +1135,7 @@ function La() {
|
|
|
1132
1135
|
return os || (os = 1, process.env.NODE_ENV === "production" ? nn.exports = Da() : nn.exports = Ma()), nn.exports;
|
|
1133
1136
|
}
|
|
1134
1137
|
var $a = La();
|
|
1135
|
-
const
|
|
1138
|
+
const Rs = 0, js = 1, Is = 2, us = 3;
|
|
1136
1139
|
var cs = Object.prototype.hasOwnProperty;
|
|
1137
1140
|
function or(t, e) {
|
|
1138
1141
|
var n, r;
|
|
@@ -1154,18 +1157,18 @@ function or(t, e) {
|
|
|
1154
1157
|
}
|
|
1155
1158
|
return t !== t && e !== e;
|
|
1156
1159
|
}
|
|
1157
|
-
const
|
|
1158
|
-
},
|
|
1160
|
+
const Pe = /* @__PURE__ */ new WeakMap(), De = () => {
|
|
1161
|
+
}, ee = (
|
|
1159
1162
|
/*#__NOINLINE__*/
|
|
1160
1163
|
De()
|
|
1161
|
-
), ur = Object,
|
|
1162
|
-
const n =
|
|
1164
|
+
), ur = Object, N = (t) => t === ee, be = (t) => typeof t == "function", Me = (t, e) => Ue(Ue({}, t), e), Zs = (t) => be(t.then), Mn = {}, rn = {}, Nr = "undefined", Jt = typeof window != Nr, cr = typeof document != Nr, Fa = Jt && "Deno" in window, Wa = () => Jt && typeof window.requestAnimationFrame != Nr, Ds = (t, e) => {
|
|
1165
|
+
const n = Pe.get(t);
|
|
1163
1166
|
return [
|
|
1164
1167
|
// Getter
|
|
1165
|
-
() => !
|
|
1168
|
+
() => !N(e) && t.get(e) || Mn,
|
|
1166
1169
|
// Setter
|
|
1167
1170
|
(r) => {
|
|
1168
|
-
if (!
|
|
1171
|
+
if (!N(e)) {
|
|
1169
1172
|
const s = t.get(e);
|
|
1170
1173
|
e in rn || (rn[e] = s), n[5](e, Me(s, r), s || Mn);
|
|
1171
1174
|
}
|
|
@@ -1173,7 +1176,7 @@ const Re = /* @__PURE__ */ new WeakMap(), De = () => {
|
|
|
1173
1176
|
// Subscriber
|
|
1174
1177
|
n[6],
|
|
1175
1178
|
// Get server cache snapshot
|
|
1176
|
-
() => !
|
|
1179
|
+
() => !N(e) && e in rn ? rn[e] : !N(e) && t.get(e) || Mn
|
|
1177
1180
|
];
|
|
1178
1181
|
};
|
|
1179
1182
|
let dr = !0;
|
|
@@ -1185,7 +1188,7 @@ const za = () => dr, [lr, fr] = Jt && window.addEventListener ? [
|
|
|
1185
1188
|
De
|
|
1186
1189
|
], Va = () => {
|
|
1187
1190
|
const t = cr && document.visibilityState;
|
|
1188
|
-
return
|
|
1191
|
+
return N(t) || t !== "hidden";
|
|
1189
1192
|
}, Ua = (t) => (cr && document.addEventListener("visibilitychange", t), lr("focus", t), () => {
|
|
1190
1193
|
cr && document.removeEventListener("visibilitychange", t), fr("focus", t);
|
|
1191
1194
|
}), Ba = (t) => {
|
|
@@ -1221,14 +1224,14 @@ const hr = (t) => {
|
|
|
1221
1224
|
if (s) {
|
|
1222
1225
|
a = "#";
|
|
1223
1226
|
const o = ur.keys(t).sort();
|
|
1224
|
-
for (; !
|
|
1225
|
-
|
|
1227
|
+
for (; !N(i = o.pop()); )
|
|
1228
|
+
N(t[i]) || (a += i + ":" + hr(t[i]) + ",");
|
|
1226
1229
|
sn.set(t, a);
|
|
1227
1230
|
}
|
|
1228
1231
|
} else
|
|
1229
1232
|
a = n ? t.toJSON() : e == "symbol" ? t.toString() : e == "string" ? JSON.stringify(t) : "" + t;
|
|
1230
1233
|
return a;
|
|
1231
|
-
},
|
|
1234
|
+
}, Pr = (t) => {
|
|
1232
1235
|
if (be(t))
|
|
1233
1236
|
try {
|
|
1234
1237
|
t = t();
|
|
@@ -1265,21 +1268,21 @@ function Ms(...t) {
|
|
|
1265
1268
|
return p(n);
|
|
1266
1269
|
function p(k) {
|
|
1267
1270
|
return Be(this, null, function* () {
|
|
1268
|
-
const [g] =
|
|
1271
|
+
const [g] = Pr(k);
|
|
1269
1272
|
if (!g) return;
|
|
1270
|
-
const [b, l] = Ds(e, g), [v,
|
|
1273
|
+
const [b, l] = Ds(e, g), [v, m, z, R] = Pe.get(e), q = () => {
|
|
1271
1274
|
const le = v[g];
|
|
1272
|
-
return (be(a.revalidate) ? a.revalidate(b().data, k) : a.revalidate !== !1) && (delete z[g], delete
|
|
1275
|
+
return (be(a.revalidate) ? a.revalidate(b().data, k) : a.revalidate !== !1) && (delete z[g], delete R[g], le && le[0]) ? le[0](Is).then(() => b().data) : b().data;
|
|
1273
1276
|
};
|
|
1274
1277
|
if (t.length < 3)
|
|
1275
1278
|
return q();
|
|
1276
1279
|
let D = r, B;
|
|
1277
|
-
const
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
+
const j = pr();
|
|
1281
|
+
m[g] = [
|
|
1282
|
+
j,
|
|
1280
1283
|
0
|
|
1281
1284
|
];
|
|
1282
|
-
const $ = !
|
|
1285
|
+
const $ = !N(u), Se = b(), M = Se.data, rt = Se._c, ze = N(rt) ? M : rt;
|
|
1283
1286
|
if ($ && (u = be(u) ? u(ze, M) : u, l({
|
|
1284
1287
|
data: u,
|
|
1285
1288
|
_c: ze
|
|
@@ -1292,30 +1295,30 @@ function Ms(...t) {
|
|
|
1292
1295
|
if (D && Zs(D))
|
|
1293
1296
|
if (D = yield D.catch((le) => {
|
|
1294
1297
|
B = le;
|
|
1295
|
-
}),
|
|
1298
|
+
}), j !== m[g][0]) {
|
|
1296
1299
|
if (B) throw B;
|
|
1297
1300
|
return D;
|
|
1298
1301
|
} else B && $ && c(B) && (i = !0, l({
|
|
1299
1302
|
data: ze,
|
|
1300
|
-
_c:
|
|
1303
|
+
_c: ee
|
|
1301
1304
|
}));
|
|
1302
1305
|
if (i && !B)
|
|
1303
1306
|
if (be(i)) {
|
|
1304
1307
|
const le = i(D, ze);
|
|
1305
1308
|
l({
|
|
1306
1309
|
data: le,
|
|
1307
|
-
error:
|
|
1308
|
-
_c:
|
|
1310
|
+
error: ee,
|
|
1311
|
+
_c: ee
|
|
1309
1312
|
});
|
|
1310
1313
|
} else
|
|
1311
1314
|
l({
|
|
1312
1315
|
data: D,
|
|
1313
|
-
error:
|
|
1314
|
-
_c:
|
|
1316
|
+
error: ee,
|
|
1317
|
+
_c: ee
|
|
1315
1318
|
});
|
|
1316
|
-
if (
|
|
1319
|
+
if (m[g][1] = pr(), Promise.resolve(q()).then(() => {
|
|
1317
1320
|
l({
|
|
1318
|
-
_c:
|
|
1321
|
+
_c: ee
|
|
1319
1322
|
});
|
|
1320
1323
|
}), B) {
|
|
1321
1324
|
if (h) throw B;
|
|
@@ -1330,8 +1333,8 @@ const fs = (t, e) => {
|
|
|
1330
1333
|
for (const n in t)
|
|
1331
1334
|
t[n][0] && t[n][0](e);
|
|
1332
1335
|
}, Xa = (t, e) => {
|
|
1333
|
-
if (!
|
|
1334
|
-
const n = Me(Ka, e), r = {}, s = Ms.bind(
|
|
1336
|
+
if (!Pe.has(t)) {
|
|
1337
|
+
const n = Me(Ka, e), r = {}, s = Ms.bind(ee, t);
|
|
1335
1338
|
let a = De;
|
|
1336
1339
|
const i = {}, o = (h, p) => {
|
|
1337
1340
|
const k = i[h] || [];
|
|
@@ -1343,7 +1346,7 @@ const fs = (t, e) => {
|
|
|
1343
1346
|
for (const b of g)
|
|
1344
1347
|
b(p, k);
|
|
1345
1348
|
}, c = () => {
|
|
1346
|
-
if (!
|
|
1349
|
+
if (!Pe.has(t) && (Pe.set(t, [
|
|
1347
1350
|
r,
|
|
1348
1351
|
{},
|
|
1349
1352
|
{},
|
|
@@ -1352,9 +1355,9 @@ const fs = (t, e) => {
|
|
|
1352
1355
|
u,
|
|
1353
1356
|
o
|
|
1354
1357
|
]), !Zt)) {
|
|
1355
|
-
const h = n.initFocus(setTimeout.bind(
|
|
1358
|
+
const h = n.initFocus(setTimeout.bind(ee, fs.bind(ee, r, Rs))), p = n.initReconnect(setTimeout.bind(ee, fs.bind(ee, r, js)));
|
|
1356
1359
|
a = () => {
|
|
1357
|
-
h && h(), p && p(),
|
|
1360
|
+
h && h(), p && p(), Pe.delete(t);
|
|
1358
1361
|
};
|
|
1359
1362
|
}
|
|
1360
1363
|
};
|
|
@@ -1367,11 +1370,11 @@ const fs = (t, e) => {
|
|
|
1367
1370
|
}
|
|
1368
1371
|
return [
|
|
1369
1372
|
t,
|
|
1370
|
-
|
|
1373
|
+
Pe.get(t)[4]
|
|
1371
1374
|
];
|
|
1372
1375
|
}, Ya = (t, e, n, r, s) => {
|
|
1373
1376
|
const a = n.errorRetryCount, i = s.retryCount, o = ~~((Math.random() + 0.5) * (1 << (i < 8 ? i : 8))) * n.errorRetryInterval;
|
|
1374
|
-
!
|
|
1377
|
+
!N(a) && i > a || setTimeout(r, o, s);
|
|
1375
1378
|
}, Qa = or, [Ls, ei] = Xa(/* @__PURE__ */ new Map()), ti = Me(
|
|
1376
1379
|
{
|
|
1377
1380
|
// events
|
|
@@ -1417,11 +1420,11 @@ const fs = (t, e) => {
|
|
|
1417
1420
|
null,
|
|
1418
1421
|
(t[1] === null ? t[2] : t[1]) || {}
|
|
1419
1422
|
], ui = () => Me(ti, ha(ri)), ci = (t) => (e, n, r) => t(e, n && ((...a) => {
|
|
1420
|
-
const [i] =
|
|
1423
|
+
const [i] = Pr(e), [, , , o] = Pe.get(Ls);
|
|
1421
1424
|
if (i.startsWith(si))
|
|
1422
1425
|
return n(...a);
|
|
1423
1426
|
const u = o[i];
|
|
1424
|
-
return
|
|
1427
|
+
return N(u) ? n(...a) : (delete o[i], u);
|
|
1425
1428
|
}), r), di = ai.concat(ci), li = (t) => function(...n) {
|
|
1426
1429
|
const r = ui(), [s, a, i] = oi(n), o = ni(r, i);
|
|
1427
1430
|
let u = t;
|
|
@@ -1459,20 +1462,20 @@ const Wn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1459
1462
|
}), zn = {
|
|
1460
1463
|
dedupe: !0
|
|
1461
1464
|
}, hi = (t, e, n) => {
|
|
1462
|
-
const { cache: r, compare: s, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale: u, refreshInterval: c, refreshWhenHidden: h, refreshWhenOffline: p, keepPreviousData: k } = n, [g, b, l, v] =
|
|
1465
|
+
const { cache: r, compare: s, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale: u, refreshInterval: c, refreshWhenHidden: h, refreshWhenOffline: p, keepPreviousData: k } = n, [g, b, l, v] = Pe.get(r), [m, z] = Pr(t), R = qe(!1), q = qe(!1), D = qe(m), B = qe(e), j = qe(n), $ = () => j.current, Se = () => $().isVisible() && $().isOnline(), [M, rt, ze, le] = Ds(r, m), st = qe({}).current, Yt = N(i) ? N(n.fallback) ? ee : n.fallback[m] : i, Dr = (I, Z) => {
|
|
1463
1466
|
for (const H in st) {
|
|
1464
1467
|
const W = H;
|
|
1465
1468
|
if (W === "data") {
|
|
1466
|
-
if (!s(
|
|
1469
|
+
if (!s(I[W], Z[W]) && (!N(I[W]) || !s(en, Z[W])))
|
|
1467
1470
|
return !1;
|
|
1468
|
-
} else if (Z[W] !==
|
|
1471
|
+
} else if (Z[W] !== I[W])
|
|
1469
1472
|
return !1;
|
|
1470
1473
|
}
|
|
1471
1474
|
return !0;
|
|
1472
1475
|
}, Mr = pa(() => {
|
|
1473
|
-
const
|
|
1474
|
-
const Oe = Me(
|
|
1475
|
-
return delete Oe._k,
|
|
1476
|
+
const I = !m || !e ? !1 : N(o) ? $().isPaused() || a ? !1 : u !== !1 : o, Z = (Y) => {
|
|
1477
|
+
const Oe = Me(Y);
|
|
1478
|
+
return delete Oe._k, I ? Ue({
|
|
1476
1479
|
isValidating: !0,
|
|
1477
1480
|
isLoading: !0
|
|
1478
1481
|
}, Oe) : Oe;
|
|
@@ -1480,64 +1483,64 @@ const Wn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1480
1483
|
let K = ye;
|
|
1481
1484
|
return [
|
|
1482
1485
|
() => {
|
|
1483
|
-
const
|
|
1484
|
-
return Dr(
|
|
1486
|
+
const Y = Z(M());
|
|
1487
|
+
return Dr(Y, K) ? (K.data = Y.data, K.isLoading = Y.isLoading, K.isValidating = Y.isValidating, K.error = Y.error, K) : (K = Y, Y);
|
|
1485
1488
|
},
|
|
1486
1489
|
() => ot
|
|
1487
1490
|
];
|
|
1488
1491
|
}, [
|
|
1489
1492
|
r,
|
|
1490
|
-
|
|
1493
|
+
m
|
|
1491
1494
|
]), at = $a.useSyncExternalStore(an(
|
|
1492
|
-
(
|
|
1493
|
-
Dr(H, Z) ||
|
|
1495
|
+
(I) => ze(m, (Z, H) => {
|
|
1496
|
+
Dr(H, Z) || I();
|
|
1494
1497
|
}),
|
|
1495
1498
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1496
1499
|
[
|
|
1497
1500
|
r,
|
|
1498
|
-
|
|
1501
|
+
m
|
|
1499
1502
|
]
|
|
1500
|
-
), Mr[0], Mr[1]), Lr = !
|
|
1501
|
-
(
|
|
1503
|
+
), Mr[0], Mr[1]), Lr = !R.current, ea = g[m] && g[m].length > 0, it = at.data, Ve = N(it) ? Yt && Zs(Yt) ? Wn(Yt) : Yt : it, Qt = at.error, Cn = qe(Ve), en = k ? N(it) ? N(Cn.current) ? Ve : Cn.current : it : Ve, $r = ea && !N(Qt) ? !1 : Lr && !N(o) ? o : $().isPaused() ? !1 : a ? N(Ve) ? !1 : u : N(Ve) || u, Fr = !!(m && e && Lr && $r), ta = N(at.isValidating) ? Fr : at.isValidating, na = N(at.isLoading) ? Fr : at.isLoading, wt = an(
|
|
1504
|
+
(I) => Be(void 0, null, function* () {
|
|
1502
1505
|
const Z = B.current;
|
|
1503
|
-
if (!
|
|
1506
|
+
if (!m || !Z || q.current || $().isPaused())
|
|
1504
1507
|
return !1;
|
|
1505
1508
|
let H, W, ye = !0;
|
|
1506
|
-
const ot =
|
|
1509
|
+
const ot = I || {}, K = !l[m] || !ot.dedupe, Y = () => ds ? !q.current && m === D.current && R.current : m === D.current, Oe = {
|
|
1507
1510
|
isValidating: !1,
|
|
1508
1511
|
isLoading: !1
|
|
1509
1512
|
}, zr = () => {
|
|
1510
1513
|
rt(Oe);
|
|
1511
1514
|
}, Vr = () => {
|
|
1512
|
-
const ce = l[
|
|
1513
|
-
ce && ce[1] === W && delete l[
|
|
1515
|
+
const ce = l[m];
|
|
1516
|
+
ce && ce[1] === W && delete l[m];
|
|
1514
1517
|
}, Ur = {
|
|
1515
1518
|
isValidating: !0
|
|
1516
1519
|
};
|
|
1517
|
-
|
|
1520
|
+
N(M().data) && (Ur.isLoading = !0);
|
|
1518
1521
|
try {
|
|
1519
|
-
if (K && (rt(Ur), n.loadingTimeout &&
|
|
1520
|
-
ye &&
|
|
1521
|
-
}, n.loadingTimeout), l[
|
|
1522
|
+
if (K && (rt(Ur), n.loadingTimeout && N(M().data) && setTimeout(() => {
|
|
1523
|
+
ye && Y() && $().onLoadingSlow(m, n);
|
|
1524
|
+
}, n.loadingTimeout), l[m] = [
|
|
1522
1525
|
Z(z),
|
|
1523
1526
|
pr()
|
|
1524
|
-
]), [H, W] = l[
|
|
1525
|
-
return K &&
|
|
1526
|
-
Oe.error =
|
|
1527
|
-
const ce = b[
|
|
1528
|
-
if (!
|
|
1527
|
+
]), [H, W] = l[m], H = yield H, K && setTimeout(Vr, n.dedupingInterval), !l[m] || l[m][1] !== W)
|
|
1528
|
+
return K && Y() && $().onDiscarded(m), !1;
|
|
1529
|
+
Oe.error = ee;
|
|
1530
|
+
const ce = b[m];
|
|
1531
|
+
if (!N(ce) && // case 1
|
|
1529
1532
|
(W <= ce[0] || // case 2
|
|
1530
1533
|
W <= ce[1] || // case 3
|
|
1531
1534
|
ce[1] === 0))
|
|
1532
|
-
return zr(), K &&
|
|
1535
|
+
return zr(), K && Y() && $().onDiscarded(m), !1;
|
|
1533
1536
|
const Te = M().data;
|
|
1534
|
-
Oe.data = s(Te, H) ? Te : H, K &&
|
|
1537
|
+
Oe.data = s(Te, H) ? Te : H, K && Y() && $().onSuccess(H, m, n);
|
|
1535
1538
|
} catch (ce) {
|
|
1536
1539
|
Vr();
|
|
1537
|
-
const Te = $(), { shouldRetryOnError:
|
|
1538
|
-
Te.isPaused() || (Oe.error = ce, K &&
|
|
1539
|
-
const
|
|
1540
|
-
|
|
1540
|
+
const Te = $(), { shouldRetryOnError: Nn } = Te;
|
|
1541
|
+
Te.isPaused() || (Oe.error = ce, K && Y() && (Te.onError(ce, m, Te), (Nn === !0 || be(Nn) && Nn(ce)) && (!$().revalidateOnFocus || !$().revalidateOnReconnect || Se()) && Te.onErrorRetry(ce, m, Te, (ra) => {
|
|
1542
|
+
const Pn = g[m];
|
|
1543
|
+
Pn && Pn[0] && Pn[0](us, ra);
|
|
1541
1544
|
}, {
|
|
1542
1545
|
retryCount: (ot.retryCount || 0) + 1,
|
|
1543
1546
|
dedupe: !0
|
|
@@ -1557,70 +1560,70 @@ const Wn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1557
1560
|
// even though it might cause unexpected behaviors.
|
|
1558
1561
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1559
1562
|
[
|
|
1560
|
-
|
|
1563
|
+
m,
|
|
1561
1564
|
r
|
|
1562
1565
|
]
|
|
1563
1566
|
), Wr = an(
|
|
1564
1567
|
// Use callback to make sure `keyRef.current` returns latest result every time
|
|
1565
|
-
(...
|
|
1568
|
+
(...I) => Ms(r, D.current, ...I),
|
|
1566
1569
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1567
1570
|
[]
|
|
1568
1571
|
);
|
|
1569
1572
|
if (Ln(() => {
|
|
1570
|
-
B.current = e,
|
|
1573
|
+
B.current = e, j.current = n, N(it) || (Cn.current = it);
|
|
1571
1574
|
}), Ln(() => {
|
|
1572
|
-
if (!
|
|
1573
|
-
const
|
|
1575
|
+
if (!m) return;
|
|
1576
|
+
const I = wt.bind(ee, zn);
|
|
1574
1577
|
let Z = 0;
|
|
1575
|
-
const W = fi(
|
|
1576
|
-
if (ye ==
|
|
1578
|
+
const W = fi(m, g, (ye, ot = {}) => {
|
|
1579
|
+
if (ye == Rs) {
|
|
1577
1580
|
const K = Date.now();
|
|
1578
|
-
$().revalidateOnFocus && K > Z && Se() && (Z = K + $().focusThrottleInterval,
|
|
1579
|
-
} else if (ye ==
|
|
1580
|
-
$().revalidateOnReconnect && Se() &&
|
|
1581
|
+
$().revalidateOnFocus && K > Z && Se() && (Z = K + $().focusThrottleInterval, I());
|
|
1582
|
+
} else if (ye == js)
|
|
1583
|
+
$().revalidateOnReconnect && Se() && I();
|
|
1581
1584
|
else {
|
|
1582
|
-
if (ye ==
|
|
1585
|
+
if (ye == Is)
|
|
1583
1586
|
return wt();
|
|
1584
1587
|
if (ye == us)
|
|
1585
1588
|
return wt(ot);
|
|
1586
1589
|
}
|
|
1587
1590
|
});
|
|
1588
|
-
return q.current = !1, D.current =
|
|
1591
|
+
return q.current = !1, D.current = m, R.current = !0, rt({
|
|
1589
1592
|
_k: z
|
|
1590
|
-
}), $r && (
|
|
1593
|
+
}), $r && (N(Ve) || Zt ? I() : Ha(I)), () => {
|
|
1591
1594
|
q.current = !0, W();
|
|
1592
1595
|
};
|
|
1593
1596
|
}, [
|
|
1594
|
-
|
|
1597
|
+
m
|
|
1595
1598
|
]), Ln(() => {
|
|
1596
|
-
let
|
|
1599
|
+
let I;
|
|
1597
1600
|
function Z() {
|
|
1598
1601
|
const W = be(c) ? c(M().data) : c;
|
|
1599
|
-
W &&
|
|
1602
|
+
W && I !== -1 && (I = setTimeout(H, W));
|
|
1600
1603
|
}
|
|
1601
1604
|
function H() {
|
|
1602
1605
|
!M().error && (h || $().isVisible()) && (p || $().isOnline()) ? wt(zn).then(Z) : Z();
|
|
1603
1606
|
}
|
|
1604
1607
|
return Z(), () => {
|
|
1605
|
-
|
|
1608
|
+
I && (clearTimeout(I), I = -1);
|
|
1606
1609
|
};
|
|
1607
1610
|
}, [
|
|
1608
1611
|
c,
|
|
1609
1612
|
h,
|
|
1610
1613
|
p,
|
|
1611
|
-
|
|
1612
|
-
]), ma(en), a &&
|
|
1614
|
+
m
|
|
1615
|
+
]), ma(en), a && N(Ve) && m) {
|
|
1613
1616
|
if (!ds && Zt)
|
|
1614
1617
|
throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
1615
|
-
B.current = e,
|
|
1616
|
-
const
|
|
1617
|
-
if (!
|
|
1618
|
-
const Z = Wr(
|
|
1618
|
+
B.current = e, j.current = n, q.current = !1;
|
|
1619
|
+
const I = v[m];
|
|
1620
|
+
if (!N(I)) {
|
|
1621
|
+
const Z = Wr(I);
|
|
1619
1622
|
Wn(Z);
|
|
1620
1623
|
}
|
|
1621
|
-
if (
|
|
1624
|
+
if (N(Qt)) {
|
|
1622
1625
|
const Z = wt(zn);
|
|
1623
|
-
|
|
1626
|
+
N(en) || (Z.status = "fulfilled", Z.value = !0), Wn(Z);
|
|
1624
1627
|
} else
|
|
1625
1628
|
throw Qt;
|
|
1626
1629
|
}
|
|
@@ -1723,7 +1726,7 @@ const _ = C.arrayToEnum([
|
|
|
1723
1726
|
"never",
|
|
1724
1727
|
"map",
|
|
1725
1728
|
"set"
|
|
1726
|
-
]),
|
|
1729
|
+
]), Ne = (t) => {
|
|
1727
1730
|
switch (typeof t) {
|
|
1728
1731
|
case "undefined":
|
|
1729
1732
|
return _.undefined;
|
|
@@ -1903,7 +1906,7 @@ const gn = (t) => {
|
|
|
1903
1906
|
message: o
|
|
1904
1907
|
});
|
|
1905
1908
|
}, ki = [];
|
|
1906
|
-
function
|
|
1909
|
+
function y(t, e) {
|
|
1907
1910
|
const n = yn(), r = gn({
|
|
1908
1911
|
issueData: e,
|
|
1909
1912
|
data: t.data,
|
|
@@ -1921,7 +1924,7 @@ function m(t, e) {
|
|
|
1921
1924
|
});
|
|
1922
1925
|
t.common.issues.push(r);
|
|
1923
1926
|
}
|
|
1924
|
-
class
|
|
1927
|
+
class X {
|
|
1925
1928
|
constructor() {
|
|
1926
1929
|
this.value = "valid";
|
|
1927
1930
|
}
|
|
@@ -1950,7 +1953,7 @@ class J {
|
|
|
1950
1953
|
value: i
|
|
1951
1954
|
});
|
|
1952
1955
|
}
|
|
1953
|
-
return
|
|
1956
|
+
return X.mergeObjectSync(e, r);
|
|
1954
1957
|
});
|
|
1955
1958
|
}
|
|
1956
1959
|
static mergeObjectSync(e, n) {
|
|
@@ -1966,7 +1969,7 @@ class J {
|
|
|
1966
1969
|
}
|
|
1967
1970
|
const S = Object.freeze({
|
|
1968
1971
|
status: "aborted"
|
|
1969
|
-
}), _n = (t) => ({ status: "dirty", value: t }),
|
|
1972
|
+
}), _n = (t) => ({ status: "dirty", value: t }), te = (t) => ({ status: "valid", value: t }), yr = (t) => t.status === "aborted", gr = (t) => t.status === "dirty", et = (t) => t.status === "valid", Dt = (t) => typeof Promise != "undefined" && t instanceof Promise;
|
|
1970
1973
|
function vn(t, e, n, r) {
|
|
1971
1974
|
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");
|
|
1972
1975
|
return e.get(t);
|
|
@@ -2020,13 +2023,13 @@ class T {
|
|
|
2020
2023
|
return this._def.description;
|
|
2021
2024
|
}
|
|
2022
2025
|
_getType(e) {
|
|
2023
|
-
return
|
|
2026
|
+
return Ne(e.data);
|
|
2024
2027
|
}
|
|
2025
2028
|
_getOrReturnCtx(e, n) {
|
|
2026
2029
|
return n || {
|
|
2027
2030
|
common: e.parent.common,
|
|
2028
2031
|
data: e.data,
|
|
2029
|
-
parsedType:
|
|
2032
|
+
parsedType: Ne(e.data),
|
|
2030
2033
|
schemaErrorMap: this._def.errorMap,
|
|
2031
2034
|
path: e.path,
|
|
2032
2035
|
parent: e.parent
|
|
@@ -2034,11 +2037,11 @@ class T {
|
|
|
2034
2037
|
}
|
|
2035
2038
|
_processInputParams(e) {
|
|
2036
2039
|
return {
|
|
2037
|
-
status: new
|
|
2040
|
+
status: new X(),
|
|
2038
2041
|
ctx: {
|
|
2039
2042
|
common: e.parent.common,
|
|
2040
2043
|
data: e.data,
|
|
2041
|
-
parsedType:
|
|
2044
|
+
parsedType: Ne(e.data),
|
|
2042
2045
|
schemaErrorMap: this._def.errorMap,
|
|
2043
2046
|
path: e.path,
|
|
2044
2047
|
parent: e.parent
|
|
@@ -2073,7 +2076,7 @@ class T {
|
|
|
2073
2076
|
schemaErrorMap: this._def.errorMap,
|
|
2074
2077
|
parent: null,
|
|
2075
2078
|
data: e,
|
|
2076
|
-
parsedType:
|
|
2079
|
+
parsedType: Ne(e)
|
|
2077
2080
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
2078
2081
|
return ms(s, a);
|
|
2079
2082
|
}
|
|
@@ -2088,7 +2091,7 @@ class T {
|
|
|
2088
2091
|
schemaErrorMap: this._def.errorMap,
|
|
2089
2092
|
parent: null,
|
|
2090
2093
|
data: e,
|
|
2091
|
-
parsedType:
|
|
2094
|
+
parsedType: Ne(e)
|
|
2092
2095
|
};
|
|
2093
2096
|
if (!this["~standard"].async)
|
|
2094
2097
|
try {
|
|
@@ -2130,7 +2133,7 @@ class T {
|
|
|
2130
2133
|
schemaErrorMap: this._def.errorMap,
|
|
2131
2134
|
parent: null,
|
|
2132
2135
|
data: e,
|
|
2133
|
-
parsedType:
|
|
2136
|
+
parsedType: Ne(e)
|
|
2134
2137
|
}, s = this._parse({ data: e, path: r.path, parent: r }), a = yield Dt(s) ? s : Promise.resolve(s);
|
|
2135
2138
|
return ms(r, a);
|
|
2136
2139
|
});
|
|
@@ -2201,7 +2204,7 @@ class T {
|
|
|
2201
2204
|
}));
|
|
2202
2205
|
}
|
|
2203
2206
|
brand() {
|
|
2204
|
-
return new
|
|
2207
|
+
return new Rr(d({
|
|
2205
2208
|
typeName: E.ZodBranded,
|
|
2206
2209
|
type: this
|
|
2207
2210
|
}, O(this._def)));
|
|
@@ -2233,9 +2236,9 @@ class T {
|
|
|
2233
2236
|
return this.safeParse(null).success;
|
|
2234
2237
|
}
|
|
2235
2238
|
}
|
|
2236
|
-
const Ei = /^c[^\s-]{8,}$/i, xi = /^[0-9a-z]+$/, Si = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Oi = /^[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, Ti = /^[a-z0-9_-]{21}$/i, Ai = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Ci = /^[-+]?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)?)??$/,
|
|
2239
|
+
const Ei = /^c[^\s-]{8,}$/i, xi = /^[0-9a-z]+$/, Si = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Oi = /^[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, Ti = /^[a-z0-9_-]{21}$/i, Ai = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Ci = /^[-+]?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)?)??$/, Ni = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Pi = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
2237
2240
|
let Vn;
|
|
2238
|
-
const
|
|
2241
|
+
const Ri = /^(?:(?: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])$/, ji = /^(?:(?: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])$/, Ii = /^(([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]))$/, Zi = /^(([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])$/, Di = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Mi = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, zs = "((\\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])))", Li = new RegExp(`^${zs}$`);
|
|
2239
2242
|
function Vs(t) {
|
|
2240
2243
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
2241
2244
|
return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
@@ -2249,7 +2252,7 @@ function Us(t) {
|
|
|
2249
2252
|
return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
|
|
2250
2253
|
}
|
|
2251
2254
|
function Fi(t, e) {
|
|
2252
|
-
return !!((e === "v4" || !e) &&
|
|
2255
|
+
return !!((e === "v4" || !e) && Ri.test(t) || (e === "v6" || !e) && Ii.test(t));
|
|
2253
2256
|
}
|
|
2254
2257
|
function Wi(t, e) {
|
|
2255
2258
|
if (!Ai.test(t))
|
|
@@ -2262,23 +2265,23 @@ function Wi(t, e) {
|
|
|
2262
2265
|
}
|
|
2263
2266
|
}
|
|
2264
2267
|
function zi(t, e) {
|
|
2265
|
-
return !!((e === "v4" || !e) &&
|
|
2268
|
+
return !!((e === "v4" || !e) && ji.test(t) || (e === "v6" || !e) && Zi.test(t));
|
|
2266
2269
|
}
|
|
2267
2270
|
class he extends T {
|
|
2268
2271
|
_parse(e) {
|
|
2269
2272
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== _.string) {
|
|
2270
2273
|
const s = this._getOrReturnCtx(e);
|
|
2271
|
-
return
|
|
2274
|
+
return y(s, {
|
|
2272
2275
|
code: f.invalid_type,
|
|
2273
2276
|
expected: _.string,
|
|
2274
2277
|
received: s.parsedType
|
|
2275
2278
|
}), S;
|
|
2276
2279
|
}
|
|
2277
|
-
const n = new
|
|
2280
|
+
const n = new X();
|
|
2278
2281
|
let r;
|
|
2279
2282
|
for (const s of this._def.checks)
|
|
2280
2283
|
if (s.kind === "min")
|
|
2281
|
-
e.data.length < s.value && (r = this._getOrReturnCtx(e, r),
|
|
2284
|
+
e.data.length < s.value && (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2282
2285
|
code: f.too_small,
|
|
2283
2286
|
minimum: s.value,
|
|
2284
2287
|
type: "string",
|
|
@@ -2287,7 +2290,7 @@ class he extends T {
|
|
|
2287
2290
|
message: s.message
|
|
2288
2291
|
}), n.dirty());
|
|
2289
2292
|
else if (s.kind === "max")
|
|
2290
|
-
e.data.length > s.value && (r = this._getOrReturnCtx(e, r),
|
|
2293
|
+
e.data.length > s.value && (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2291
2294
|
code: f.too_big,
|
|
2292
2295
|
maximum: s.value,
|
|
2293
2296
|
type: "string",
|
|
@@ -2297,14 +2300,14 @@ class he extends T {
|
|
|
2297
2300
|
}), n.dirty());
|
|
2298
2301
|
else if (s.kind === "length") {
|
|
2299
2302
|
const a = e.data.length > s.value, i = e.data.length < s.value;
|
|
2300
|
-
(a || i) && (r = this._getOrReturnCtx(e, r), a ?
|
|
2303
|
+
(a || i) && (r = this._getOrReturnCtx(e, r), a ? y(r, {
|
|
2301
2304
|
code: f.too_big,
|
|
2302
2305
|
maximum: s.value,
|
|
2303
2306
|
type: "string",
|
|
2304
2307
|
inclusive: !0,
|
|
2305
2308
|
exact: !0,
|
|
2306
2309
|
message: s.message
|
|
2307
|
-
}) : i &&
|
|
2310
|
+
}) : i && y(r, {
|
|
2308
2311
|
code: f.too_small,
|
|
2309
2312
|
minimum: s.value,
|
|
2310
2313
|
type: "string",
|
|
@@ -2313,43 +2316,43 @@ class he extends T {
|
|
|
2313
2316
|
message: s.message
|
|
2314
2317
|
}), n.dirty());
|
|
2315
2318
|
} else if (s.kind === "email")
|
|
2316
|
-
|
|
2319
|
+
Ni.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2317
2320
|
validation: "email",
|
|
2318
2321
|
code: f.invalid_string,
|
|
2319
2322
|
message: s.message
|
|
2320
2323
|
}), n.dirty());
|
|
2321
2324
|
else if (s.kind === "emoji")
|
|
2322
|
-
Vn || (Vn = new RegExp(
|
|
2325
|
+
Vn || (Vn = new RegExp(Pi, "u")), Vn.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2323
2326
|
validation: "emoji",
|
|
2324
2327
|
code: f.invalid_string,
|
|
2325
2328
|
message: s.message
|
|
2326
2329
|
}), n.dirty());
|
|
2327
2330
|
else if (s.kind === "uuid")
|
|
2328
|
-
Oi.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
2331
|
+
Oi.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2329
2332
|
validation: "uuid",
|
|
2330
2333
|
code: f.invalid_string,
|
|
2331
2334
|
message: s.message
|
|
2332
2335
|
}), n.dirty());
|
|
2333
2336
|
else if (s.kind === "nanoid")
|
|
2334
|
-
Ti.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
2337
|
+
Ti.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2335
2338
|
validation: "nanoid",
|
|
2336
2339
|
code: f.invalid_string,
|
|
2337
2340
|
message: s.message
|
|
2338
2341
|
}), n.dirty());
|
|
2339
2342
|
else if (s.kind === "cuid")
|
|
2340
|
-
Ei.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
2343
|
+
Ei.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2341
2344
|
validation: "cuid",
|
|
2342
2345
|
code: f.invalid_string,
|
|
2343
2346
|
message: s.message
|
|
2344
2347
|
}), n.dirty());
|
|
2345
2348
|
else if (s.kind === "cuid2")
|
|
2346
|
-
xi.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
2349
|
+
xi.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2347
2350
|
validation: "cuid2",
|
|
2348
2351
|
code: f.invalid_string,
|
|
2349
2352
|
message: s.message
|
|
2350
2353
|
}), n.dirty());
|
|
2351
2354
|
else if (s.kind === "ulid")
|
|
2352
|
-
Si.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
2355
|
+
Si.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2353
2356
|
validation: "ulid",
|
|
2354
2357
|
code: f.invalid_string,
|
|
2355
2358
|
message: s.message
|
|
@@ -2358,61 +2361,61 @@ class he extends T {
|
|
|
2358
2361
|
try {
|
|
2359
2362
|
new URL(e.data);
|
|
2360
2363
|
} catch (a) {
|
|
2361
|
-
r = this._getOrReturnCtx(e, r),
|
|
2364
|
+
r = this._getOrReturnCtx(e, r), y(r, {
|
|
2362
2365
|
validation: "url",
|
|
2363
2366
|
code: f.invalid_string,
|
|
2364
2367
|
message: s.message
|
|
2365
2368
|
}), n.dirty();
|
|
2366
2369
|
}
|
|
2367
|
-
else s.kind === "regex" ? (s.regex.lastIndex = 0, s.regex.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
2370
|
+
else s.kind === "regex" ? (s.regex.lastIndex = 0, s.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2368
2371
|
validation: "regex",
|
|
2369
2372
|
code: f.invalid_string,
|
|
2370
2373
|
message: s.message
|
|
2371
|
-
}), n.dirty())) : s.kind === "trim" ? e.data = e.data.trim() : s.kind === "includes" ? e.data.includes(s.value, s.position) || (r = this._getOrReturnCtx(e, r),
|
|
2374
|
+
}), n.dirty())) : s.kind === "trim" ? e.data = e.data.trim() : s.kind === "includes" ? e.data.includes(s.value, s.position) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2372
2375
|
code: f.invalid_string,
|
|
2373
2376
|
validation: { includes: s.value, position: s.position },
|
|
2374
2377
|
message: s.message
|
|
2375
|
-
}), n.dirty()) : s.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : s.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : s.kind === "startsWith" ? e.data.startsWith(s.value) || (r = this._getOrReturnCtx(e, r),
|
|
2378
|
+
}), n.dirty()) : s.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : s.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : s.kind === "startsWith" ? e.data.startsWith(s.value) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2376
2379
|
code: f.invalid_string,
|
|
2377
2380
|
validation: { startsWith: s.value },
|
|
2378
2381
|
message: s.message
|
|
2379
|
-
}), n.dirty()) : s.kind === "endsWith" ? e.data.endsWith(s.value) || (r = this._getOrReturnCtx(e, r),
|
|
2382
|
+
}), n.dirty()) : s.kind === "endsWith" ? e.data.endsWith(s.value) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2380
2383
|
code: f.invalid_string,
|
|
2381
2384
|
validation: { endsWith: s.value },
|
|
2382
2385
|
message: s.message
|
|
2383
|
-
}), n.dirty()) : s.kind === "datetime" ? Us(s).test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
2386
|
+
}), n.dirty()) : s.kind === "datetime" ? Us(s).test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2384
2387
|
code: f.invalid_string,
|
|
2385
2388
|
validation: "datetime",
|
|
2386
2389
|
message: s.message
|
|
2387
|
-
}), n.dirty()) : s.kind === "date" ? Li.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
2390
|
+
}), n.dirty()) : s.kind === "date" ? Li.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2388
2391
|
code: f.invalid_string,
|
|
2389
2392
|
validation: "date",
|
|
2390
2393
|
message: s.message
|
|
2391
|
-
}), n.dirty()) : s.kind === "time" ? $i(s).test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
2394
|
+
}), n.dirty()) : s.kind === "time" ? $i(s).test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2392
2395
|
code: f.invalid_string,
|
|
2393
2396
|
validation: "time",
|
|
2394
2397
|
message: s.message
|
|
2395
|
-
}), n.dirty()) : s.kind === "duration" ? Ci.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
2398
|
+
}), n.dirty()) : s.kind === "duration" ? Ci.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2396
2399
|
validation: "duration",
|
|
2397
2400
|
code: f.invalid_string,
|
|
2398
2401
|
message: s.message
|
|
2399
|
-
}), n.dirty()) : s.kind === "ip" ? Fi(e.data, s.version) || (r = this._getOrReturnCtx(e, r),
|
|
2402
|
+
}), n.dirty()) : s.kind === "ip" ? Fi(e.data, s.version) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2400
2403
|
validation: "ip",
|
|
2401
2404
|
code: f.invalid_string,
|
|
2402
2405
|
message: s.message
|
|
2403
|
-
}), n.dirty()) : s.kind === "jwt" ? Wi(e.data, s.alg) || (r = this._getOrReturnCtx(e, r),
|
|
2406
|
+
}), n.dirty()) : s.kind === "jwt" ? Wi(e.data, s.alg) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2404
2407
|
validation: "jwt",
|
|
2405
2408
|
code: f.invalid_string,
|
|
2406
2409
|
message: s.message
|
|
2407
|
-
}), n.dirty()) : s.kind === "cidr" ? zi(e.data, s.version) || (r = this._getOrReturnCtx(e, r),
|
|
2410
|
+
}), n.dirty()) : s.kind === "cidr" ? zi(e.data, s.version) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2408
2411
|
validation: "cidr",
|
|
2409
2412
|
code: f.invalid_string,
|
|
2410
2413
|
message: s.message
|
|
2411
|
-
}), n.dirty()) : s.kind === "base64" ? Di.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
2414
|
+
}), n.dirty()) : s.kind === "base64" ? Di.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2412
2415
|
validation: "base64",
|
|
2413
2416
|
code: f.invalid_string,
|
|
2414
2417
|
message: s.message
|
|
2415
|
-
}), n.dirty()) : s.kind === "base64url" ? Mi.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
2418
|
+
}), n.dirty()) : s.kind === "base64url" ? Mi.test(e.data) || (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2416
2419
|
validation: "base64url",
|
|
2417
2420
|
code: f.invalid_string,
|
|
2418
2421
|
message: s.message
|
|
@@ -2646,39 +2649,39 @@ class Le extends T {
|
|
|
2646
2649
|
_parse(e) {
|
|
2647
2650
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== _.number) {
|
|
2648
2651
|
const s = this._getOrReturnCtx(e);
|
|
2649
|
-
return
|
|
2652
|
+
return y(s, {
|
|
2650
2653
|
code: f.invalid_type,
|
|
2651
2654
|
expected: _.number,
|
|
2652
2655
|
received: s.parsedType
|
|
2653
2656
|
}), S;
|
|
2654
2657
|
}
|
|
2655
2658
|
let n;
|
|
2656
|
-
const r = new
|
|
2659
|
+
const r = new X();
|
|
2657
2660
|
for (const s of this._def.checks)
|
|
2658
|
-
s.kind === "int" ? C.isInteger(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
2661
|
+
s.kind === "int" ? C.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2659
2662
|
code: f.invalid_type,
|
|
2660
2663
|
expected: "integer",
|
|
2661
2664
|
received: "float",
|
|
2662
2665
|
message: s.message
|
|
2663
|
-
}), r.dirty()) : s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (n = this._getOrReturnCtx(e, n),
|
|
2666
|
+
}), r.dirty()) : s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2664
2667
|
code: f.too_small,
|
|
2665
2668
|
minimum: s.value,
|
|
2666
2669
|
type: "number",
|
|
2667
2670
|
inclusive: s.inclusive,
|
|
2668
2671
|
exact: !1,
|
|
2669
2672
|
message: s.message
|
|
2670
|
-
}), r.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (n = this._getOrReturnCtx(e, n),
|
|
2673
|
+
}), r.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2671
2674
|
code: f.too_big,
|
|
2672
2675
|
maximum: s.value,
|
|
2673
2676
|
type: "number",
|
|
2674
2677
|
inclusive: s.inclusive,
|
|
2675
2678
|
exact: !1,
|
|
2676
2679
|
message: s.message
|
|
2677
|
-
}), r.dirty()) : s.kind === "multipleOf" ? Vi(e.data, s.value) !== 0 && (n = this._getOrReturnCtx(e, n),
|
|
2680
|
+
}), r.dirty()) : s.kind === "multipleOf" ? Vi(e.data, s.value) !== 0 && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2678
2681
|
code: f.not_multiple_of,
|
|
2679
2682
|
multipleOf: s.value,
|
|
2680
2683
|
message: s.message
|
|
2681
|
-
}), r.dirty()) : s.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
2684
|
+
}), r.dirty()) : s.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2682
2685
|
code: f.not_finite,
|
|
2683
2686
|
message: s.message
|
|
2684
2687
|
}), r.dirty()) : C.assertNever(s);
|
|
@@ -2822,21 +2825,21 @@ class $e extends T {
|
|
|
2822
2825
|
if (this._getType(e) !== _.bigint)
|
|
2823
2826
|
return this._getInvalidInput(e);
|
|
2824
2827
|
let n;
|
|
2825
|
-
const r = new
|
|
2828
|
+
const r = new X();
|
|
2826
2829
|
for (const s of this._def.checks)
|
|
2827
|
-
s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (n = this._getOrReturnCtx(e, n),
|
|
2830
|
+
s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2828
2831
|
code: f.too_small,
|
|
2829
2832
|
type: "bigint",
|
|
2830
2833
|
minimum: s.value,
|
|
2831
2834
|
inclusive: s.inclusive,
|
|
2832
2835
|
message: s.message
|
|
2833
|
-
}), r.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (n = this._getOrReturnCtx(e, n),
|
|
2836
|
+
}), r.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2834
2837
|
code: f.too_big,
|
|
2835
2838
|
type: "bigint",
|
|
2836
2839
|
maximum: s.value,
|
|
2837
2840
|
inclusive: s.inclusive,
|
|
2838
2841
|
message: s.message
|
|
2839
|
-
}), r.dirty()) : s.kind === "multipleOf" ? e.data % s.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n),
|
|
2842
|
+
}), r.dirty()) : s.kind === "multipleOf" ? e.data % s.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2840
2843
|
code: f.not_multiple_of,
|
|
2841
2844
|
multipleOf: s.value,
|
|
2842
2845
|
message: s.message
|
|
@@ -2845,7 +2848,7 @@ class $e extends T {
|
|
|
2845
2848
|
}
|
|
2846
2849
|
_getInvalidInput(e) {
|
|
2847
2850
|
const n = this._getOrReturnCtx(e);
|
|
2848
|
-
return
|
|
2851
|
+
return y(n, {
|
|
2849
2852
|
code: f.invalid_type,
|
|
2850
2853
|
expected: _.bigint,
|
|
2851
2854
|
received: n.parsedType
|
|
@@ -2945,13 +2948,13 @@ class Mt extends T {
|
|
|
2945
2948
|
_parse(e) {
|
|
2946
2949
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== _.boolean) {
|
|
2947
2950
|
const n = this._getOrReturnCtx(e);
|
|
2948
|
-
return
|
|
2951
|
+
return y(n, {
|
|
2949
2952
|
code: f.invalid_type,
|
|
2950
2953
|
expected: _.boolean,
|
|
2951
2954
|
received: n.parsedType
|
|
2952
2955
|
}), S;
|
|
2953
2956
|
}
|
|
2954
|
-
return
|
|
2957
|
+
return te(e.data);
|
|
2955
2958
|
}
|
|
2956
2959
|
}
|
|
2957
2960
|
Mt.create = (t) => new Mt(d({
|
|
@@ -2962,7 +2965,7 @@ class tt extends T {
|
|
|
2962
2965
|
_parse(e) {
|
|
2963
2966
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== _.date) {
|
|
2964
2967
|
const s = this._getOrReturnCtx(e);
|
|
2965
|
-
return
|
|
2968
|
+
return y(s, {
|
|
2966
2969
|
code: f.invalid_type,
|
|
2967
2970
|
expected: _.date,
|
|
2968
2971
|
received: s.parsedType
|
|
@@ -2970,21 +2973,21 @@ class tt extends T {
|
|
|
2970
2973
|
}
|
|
2971
2974
|
if (isNaN(e.data.getTime())) {
|
|
2972
2975
|
const s = this._getOrReturnCtx(e);
|
|
2973
|
-
return
|
|
2976
|
+
return y(s, {
|
|
2974
2977
|
code: f.invalid_date
|
|
2975
2978
|
}), S;
|
|
2976
2979
|
}
|
|
2977
|
-
const n = new
|
|
2980
|
+
const n = new X();
|
|
2978
2981
|
let r;
|
|
2979
2982
|
for (const s of this._def.checks)
|
|
2980
|
-
s.kind === "min" ? e.data.getTime() < s.value && (r = this._getOrReturnCtx(e, r),
|
|
2983
|
+
s.kind === "min" ? e.data.getTime() < s.value && (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2981
2984
|
code: f.too_small,
|
|
2982
2985
|
message: s.message,
|
|
2983
2986
|
inclusive: !0,
|
|
2984
2987
|
exact: !1,
|
|
2985
2988
|
minimum: s.value,
|
|
2986
2989
|
type: "date"
|
|
2987
|
-
}), n.dirty()) : s.kind === "max" ? e.data.getTime() > s.value && (r = this._getOrReturnCtx(e, r),
|
|
2990
|
+
}), n.dirty()) : s.kind === "max" ? e.data.getTime() > s.value && (r = this._getOrReturnCtx(e, r), y(r, {
|
|
2988
2991
|
code: f.too_big,
|
|
2989
2992
|
message: s.message,
|
|
2990
2993
|
inclusive: !0,
|
|
@@ -3038,13 +3041,13 @@ class bn extends T {
|
|
|
3038
3041
|
_parse(e) {
|
|
3039
3042
|
if (this._getType(e) !== _.symbol) {
|
|
3040
3043
|
const n = this._getOrReturnCtx(e);
|
|
3041
|
-
return
|
|
3044
|
+
return y(n, {
|
|
3042
3045
|
code: f.invalid_type,
|
|
3043
3046
|
expected: _.symbol,
|
|
3044
3047
|
received: n.parsedType
|
|
3045
3048
|
}), S;
|
|
3046
3049
|
}
|
|
3047
|
-
return
|
|
3050
|
+
return te(e.data);
|
|
3048
3051
|
}
|
|
3049
3052
|
}
|
|
3050
3053
|
bn.create = (t) => new bn(d({
|
|
@@ -3054,13 +3057,13 @@ class Lt extends T {
|
|
|
3054
3057
|
_parse(e) {
|
|
3055
3058
|
if (this._getType(e) !== _.undefined) {
|
|
3056
3059
|
const n = this._getOrReturnCtx(e);
|
|
3057
|
-
return
|
|
3060
|
+
return y(n, {
|
|
3058
3061
|
code: f.invalid_type,
|
|
3059
3062
|
expected: _.undefined,
|
|
3060
3063
|
received: n.parsedType
|
|
3061
3064
|
}), S;
|
|
3062
3065
|
}
|
|
3063
|
-
return
|
|
3066
|
+
return te(e.data);
|
|
3064
3067
|
}
|
|
3065
3068
|
}
|
|
3066
3069
|
Lt.create = (t) => new Lt(d({
|
|
@@ -3070,13 +3073,13 @@ class $t extends T {
|
|
|
3070
3073
|
_parse(e) {
|
|
3071
3074
|
if (this._getType(e) !== _.null) {
|
|
3072
3075
|
const n = this._getOrReturnCtx(e);
|
|
3073
|
-
return
|
|
3076
|
+
return y(n, {
|
|
3074
3077
|
code: f.invalid_type,
|
|
3075
3078
|
expected: _.null,
|
|
3076
3079
|
received: n.parsedType
|
|
3077
3080
|
}), S;
|
|
3078
3081
|
}
|
|
3079
|
-
return
|
|
3082
|
+
return te(e.data);
|
|
3080
3083
|
}
|
|
3081
3084
|
}
|
|
3082
3085
|
$t.create = (t) => new $t(d({
|
|
@@ -3087,7 +3090,7 @@ class _t extends T {
|
|
|
3087
3090
|
super(...arguments), this._any = !0;
|
|
3088
3091
|
}
|
|
3089
3092
|
_parse(e) {
|
|
3090
|
-
return
|
|
3093
|
+
return te(e.data);
|
|
3091
3094
|
}
|
|
3092
3095
|
}
|
|
3093
3096
|
_t.create = (t) => new _t(d({
|
|
@@ -3098,36 +3101,36 @@ class Xe extends T {
|
|
|
3098
3101
|
super(...arguments), this._unknown = !0;
|
|
3099
3102
|
}
|
|
3100
3103
|
_parse(e) {
|
|
3101
|
-
return
|
|
3104
|
+
return te(e.data);
|
|
3102
3105
|
}
|
|
3103
3106
|
}
|
|
3104
3107
|
Xe.create = (t) => new Xe(d({
|
|
3105
3108
|
typeName: E.ZodUnknown
|
|
3106
3109
|
}, O(t)));
|
|
3107
|
-
class
|
|
3110
|
+
class Re extends T {
|
|
3108
3111
|
_parse(e) {
|
|
3109
3112
|
const n = this._getOrReturnCtx(e);
|
|
3110
|
-
return
|
|
3113
|
+
return y(n, {
|
|
3111
3114
|
code: f.invalid_type,
|
|
3112
3115
|
expected: _.never,
|
|
3113
3116
|
received: n.parsedType
|
|
3114
3117
|
}), S;
|
|
3115
3118
|
}
|
|
3116
3119
|
}
|
|
3117
|
-
|
|
3120
|
+
Re.create = (t) => new Re(d({
|
|
3118
3121
|
typeName: E.ZodNever
|
|
3119
3122
|
}, O(t)));
|
|
3120
3123
|
class wn extends T {
|
|
3121
3124
|
_parse(e) {
|
|
3122
3125
|
if (this._getType(e) !== _.undefined) {
|
|
3123
3126
|
const n = this._getOrReturnCtx(e);
|
|
3124
|
-
return
|
|
3127
|
+
return y(n, {
|
|
3125
3128
|
code: f.invalid_type,
|
|
3126
3129
|
expected: _.void,
|
|
3127
3130
|
received: n.parsedType
|
|
3128
3131
|
}), S;
|
|
3129
3132
|
}
|
|
3130
|
-
return
|
|
3133
|
+
return te(e.data);
|
|
3131
3134
|
}
|
|
3132
3135
|
}
|
|
3133
3136
|
wn.create = (t) => new wn(d({
|
|
@@ -3137,14 +3140,14 @@ class pe extends T {
|
|
|
3137
3140
|
_parse(e) {
|
|
3138
3141
|
const { ctx: n, status: r } = this._processInputParams(e), s = this._def;
|
|
3139
3142
|
if (n.parsedType !== _.array)
|
|
3140
|
-
return
|
|
3143
|
+
return y(n, {
|
|
3141
3144
|
code: f.invalid_type,
|
|
3142
3145
|
expected: _.array,
|
|
3143
3146
|
received: n.parsedType
|
|
3144
3147
|
}), S;
|
|
3145
3148
|
if (s.exactLength !== null) {
|
|
3146
3149
|
const i = n.data.length > s.exactLength.value, o = n.data.length < s.exactLength.value;
|
|
3147
|
-
(i || o) && (
|
|
3150
|
+
(i || o) && (y(n, {
|
|
3148
3151
|
code: i ? f.too_big : f.too_small,
|
|
3149
3152
|
minimum: o ? s.exactLength.value : void 0,
|
|
3150
3153
|
maximum: i ? s.exactLength.value : void 0,
|
|
@@ -3154,14 +3157,14 @@ class pe extends T {
|
|
|
3154
3157
|
message: s.exactLength.message
|
|
3155
3158
|
}), r.dirty());
|
|
3156
3159
|
}
|
|
3157
|
-
if (s.minLength !== null && n.data.length < s.minLength.value && (
|
|
3160
|
+
if (s.minLength !== null && n.data.length < s.minLength.value && (y(n, {
|
|
3158
3161
|
code: f.too_small,
|
|
3159
3162
|
minimum: s.minLength.value,
|
|
3160
3163
|
type: "array",
|
|
3161
3164
|
inclusive: !0,
|
|
3162
3165
|
exact: !1,
|
|
3163
3166
|
message: s.minLength.message
|
|
3164
|
-
}), r.dirty()), s.maxLength !== null && n.data.length > s.maxLength.value && (
|
|
3167
|
+
}), r.dirty()), s.maxLength !== null && n.data.length > s.maxLength.value && (y(n, {
|
|
3165
3168
|
code: f.too_big,
|
|
3166
3169
|
maximum: s.maxLength.value,
|
|
3167
3170
|
type: "array",
|
|
@@ -3169,9 +3172,9 @@ class pe extends T {
|
|
|
3169
3172
|
exact: !1,
|
|
3170
3173
|
message: s.maxLength.message
|
|
3171
3174
|
}), r.dirty()), n.common.async)
|
|
3172
|
-
return Promise.all([...n.data].map((i, o) => s.type._parseAsync(new Ee(n, i, n.path, o)))).then((i) =>
|
|
3175
|
+
return Promise.all([...n.data].map((i, o) => s.type._parseAsync(new Ee(n, i, n.path, o)))).then((i) => X.mergeArray(r, i));
|
|
3173
3176
|
const a = [...n.data].map((i, o) => s.type._parseSync(new Ee(n, i, n.path, o)));
|
|
3174
|
-
return
|
|
3177
|
+
return X.mergeArray(r, a);
|
|
3175
3178
|
}
|
|
3176
3179
|
get element() {
|
|
3177
3180
|
return this._def.type;
|
|
@@ -3229,14 +3232,14 @@ class F extends T {
|
|
|
3229
3232
|
_parse(e) {
|
|
3230
3233
|
if (this._getType(e) !== _.object) {
|
|
3231
3234
|
const u = this._getOrReturnCtx(e);
|
|
3232
|
-
return
|
|
3235
|
+
return y(u, {
|
|
3233
3236
|
code: f.invalid_type,
|
|
3234
3237
|
expected: _.object,
|
|
3235
3238
|
received: u.parsedType
|
|
3236
3239
|
}), S;
|
|
3237
3240
|
}
|
|
3238
3241
|
const { status: n, ctx: r } = this._processInputParams(e), { shape: s, keys: a } = this._getCached(), i = [];
|
|
3239
|
-
if (!(this._def.catchall instanceof
|
|
3242
|
+
if (!(this._def.catchall instanceof Re && this._def.unknownKeys === "strip"))
|
|
3240
3243
|
for (const u in r.data)
|
|
3241
3244
|
a.includes(u) || i.push(u);
|
|
3242
3245
|
const o = [];
|
|
@@ -3248,7 +3251,7 @@ class F extends T {
|
|
|
3248
3251
|
alwaysSet: u in r.data
|
|
3249
3252
|
});
|
|
3250
3253
|
}
|
|
3251
|
-
if (this._def.catchall instanceof
|
|
3254
|
+
if (this._def.catchall instanceof Re) {
|
|
3252
3255
|
const u = this._def.unknownKeys;
|
|
3253
3256
|
if (u === "passthrough")
|
|
3254
3257
|
for (const c of i)
|
|
@@ -3257,7 +3260,7 @@ class F extends T {
|
|
|
3257
3260
|
value: { status: "valid", value: r.data[c] }
|
|
3258
3261
|
});
|
|
3259
3262
|
else if (u === "strict")
|
|
3260
|
-
i.length > 0 && (
|
|
3263
|
+
i.length > 0 && (y(r, {
|
|
3261
3264
|
code: f.unrecognized_keys,
|
|
3262
3265
|
keys: i
|
|
3263
3266
|
}), n.dirty());
|
|
@@ -3287,7 +3290,7 @@ class F extends T {
|
|
|
3287
3290
|
});
|
|
3288
3291
|
}
|
|
3289
3292
|
return u;
|
|
3290
|
-
})).then((u) =>
|
|
3293
|
+
})).then((u) => X.mergeObjectSync(n, u)) : X.mergeObjectSync(n, o);
|
|
3291
3294
|
}
|
|
3292
3295
|
get shape() {
|
|
3293
3296
|
return this._def.shape();
|
|
@@ -3469,19 +3472,19 @@ class F extends T {
|
|
|
3469
3472
|
F.create = (t, e) => new F(d({
|
|
3470
3473
|
shape: () => t,
|
|
3471
3474
|
unknownKeys: "strip",
|
|
3472
|
-
catchall:
|
|
3475
|
+
catchall: Re.create(),
|
|
3473
3476
|
typeName: E.ZodObject
|
|
3474
3477
|
}, O(e)));
|
|
3475
3478
|
F.strictCreate = (t, e) => new F(d({
|
|
3476
3479
|
shape: () => t,
|
|
3477
3480
|
unknownKeys: "strict",
|
|
3478
|
-
catchall:
|
|
3481
|
+
catchall: Re.create(),
|
|
3479
3482
|
typeName: E.ZodObject
|
|
3480
3483
|
}, O(e)));
|
|
3481
3484
|
F.lazycreate = (t, e) => new F(d({
|
|
3482
3485
|
shape: t,
|
|
3483
3486
|
unknownKeys: "strip",
|
|
3484
|
-
catchall:
|
|
3487
|
+
catchall: Re.create(),
|
|
3485
3488
|
typeName: E.ZodObject
|
|
3486
3489
|
}, O(e)));
|
|
3487
3490
|
class Ft extends T {
|
|
@@ -3495,7 +3498,7 @@ class Ft extends T {
|
|
|
3495
3498
|
if (o.result.status === "dirty")
|
|
3496
3499
|
return n.common.issues.push(...o.ctx.common.issues), o.result;
|
|
3497
3500
|
const i = a.map((o) => new ie(o.ctx.common.issues));
|
|
3498
|
-
return
|
|
3501
|
+
return y(n, {
|
|
3499
3502
|
code: f.invalid_union,
|
|
3500
3503
|
unionErrors: i
|
|
3501
3504
|
}), S;
|
|
@@ -3538,7 +3541,7 @@ class Ft extends T {
|
|
|
3538
3541
|
if (a)
|
|
3539
3542
|
return n.common.issues.push(...a.ctx.common.issues), a.result;
|
|
3540
3543
|
const o = i.map((u) => new ie(u));
|
|
3541
|
-
return
|
|
3544
|
+
return y(n, {
|
|
3542
3545
|
code: f.invalid_union,
|
|
3543
3546
|
unionErrors: o
|
|
3544
3547
|
}), S;
|
|
@@ -3552,12 +3555,12 @@ Ft.create = (t, e) => new Ft(d({
|
|
|
3552
3555
|
options: t,
|
|
3553
3556
|
typeName: E.ZodUnion
|
|
3554
3557
|
}, O(e)));
|
|
3555
|
-
const
|
|
3558
|
+
const je = (t) => t instanceof Vt ? je(t.schema) : t instanceof me ? je(t.innerType()) : t instanceof Ut ? [t.value] : t instanceof Fe ? t.options : t instanceof Bt ? C.objectValues(t.enum) : t instanceof qt ? je(t._def.innerType) : t instanceof Lt ? [void 0] : t instanceof $t ? [null] : t instanceof we ? [void 0, ...je(t.unwrap())] : t instanceof We ? [null, ...je(t.unwrap())] : t instanceof Rr || t instanceof Ht ? je(t.unwrap()) : t instanceof Kt ? je(t._def.innerType) : [];
|
|
3556
3559
|
class An extends T {
|
|
3557
3560
|
_parse(e) {
|
|
3558
3561
|
const { ctx: n } = this._processInputParams(e);
|
|
3559
3562
|
if (n.parsedType !== _.object)
|
|
3560
|
-
return
|
|
3563
|
+
return y(n, {
|
|
3561
3564
|
code: f.invalid_type,
|
|
3562
3565
|
expected: _.object,
|
|
3563
3566
|
received: n.parsedType
|
|
@@ -3571,7 +3574,7 @@ class An extends T {
|
|
|
3571
3574
|
data: n.data,
|
|
3572
3575
|
path: n.path,
|
|
3573
3576
|
parent: n
|
|
3574
|
-
}) : (
|
|
3577
|
+
}) : (y(n, {
|
|
3575
3578
|
code: f.invalid_union_discriminator,
|
|
3576
3579
|
options: Array.from(this.optionsMap.keys()),
|
|
3577
3580
|
path: [r]
|
|
@@ -3597,7 +3600,7 @@ class An extends T {
|
|
|
3597
3600
|
static create(e, n, r) {
|
|
3598
3601
|
const s = /* @__PURE__ */ new Map();
|
|
3599
3602
|
for (const a of n) {
|
|
3600
|
-
const i =
|
|
3603
|
+
const i = je(a.shape[e]);
|
|
3601
3604
|
if (!i.length)
|
|
3602
3605
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
3603
3606
|
for (const o of i) {
|
|
@@ -3615,7 +3618,7 @@ class An extends T {
|
|
|
3615
3618
|
}
|
|
3616
3619
|
}
|
|
3617
3620
|
function _r(t, e) {
|
|
3618
|
-
const n =
|
|
3621
|
+
const n = Ne(t), r = Ne(e);
|
|
3619
3622
|
if (t === e)
|
|
3620
3623
|
return { valid: !0, data: t };
|
|
3621
3624
|
if (n === _.object && r === _.object) {
|
|
@@ -3646,7 +3649,7 @@ class Wt extends T {
|
|
|
3646
3649
|
if (yr(a) || yr(i))
|
|
3647
3650
|
return S;
|
|
3648
3651
|
const o = _r(a.value, i.value);
|
|
3649
|
-
return o.valid ? ((gr(a) || gr(i)) && n.dirty(), { status: n.value, value: o.data }) : (
|
|
3652
|
+
return o.valid ? ((gr(a) || gr(i)) && n.dirty(), { status: n.value, value: o.data }) : (y(r, {
|
|
3650
3653
|
code: f.invalid_intersection_types
|
|
3651
3654
|
}), S);
|
|
3652
3655
|
};
|
|
@@ -3681,20 +3684,20 @@ class xe extends T {
|
|
|
3681
3684
|
_parse(e) {
|
|
3682
3685
|
const { status: n, ctx: r } = this._processInputParams(e);
|
|
3683
3686
|
if (r.parsedType !== _.array)
|
|
3684
|
-
return
|
|
3687
|
+
return y(r, {
|
|
3685
3688
|
code: f.invalid_type,
|
|
3686
3689
|
expected: _.array,
|
|
3687
3690
|
received: r.parsedType
|
|
3688
3691
|
}), S;
|
|
3689
3692
|
if (r.data.length < this._def.items.length)
|
|
3690
|
-
return
|
|
3693
|
+
return y(r, {
|
|
3691
3694
|
code: f.too_small,
|
|
3692
3695
|
minimum: this._def.items.length,
|
|
3693
3696
|
inclusive: !0,
|
|
3694
3697
|
exact: !1,
|
|
3695
3698
|
type: "array"
|
|
3696
3699
|
}), S;
|
|
3697
|
-
!this._def.rest && r.data.length > this._def.items.length && (
|
|
3700
|
+
!this._def.rest && r.data.length > this._def.items.length && (y(r, {
|
|
3698
3701
|
code: f.too_big,
|
|
3699
3702
|
maximum: this._def.items.length,
|
|
3700
3703
|
inclusive: !0,
|
|
@@ -3705,7 +3708,7 @@ class xe extends T {
|
|
|
3705
3708
|
const o = this._def.items[i] || this._def.rest;
|
|
3706
3709
|
return o ? o._parse(new Ee(r, a, r.path, i)) : null;
|
|
3707
3710
|
}).filter((a) => !!a);
|
|
3708
|
-
return r.common.async ? Promise.all(s).then((a) =>
|
|
3711
|
+
return r.common.async ? Promise.all(s).then((a) => X.mergeArray(n, a)) : X.mergeArray(n, s);
|
|
3709
3712
|
}
|
|
3710
3713
|
get items() {
|
|
3711
3714
|
return this._def.items;
|
|
@@ -3735,7 +3738,7 @@ class zt extends T {
|
|
|
3735
3738
|
_parse(e) {
|
|
3736
3739
|
const { status: n, ctx: r } = this._processInputParams(e);
|
|
3737
3740
|
if (r.parsedType !== _.object)
|
|
3738
|
-
return
|
|
3741
|
+
return y(r, {
|
|
3739
3742
|
code: f.invalid_type,
|
|
3740
3743
|
expected: _.object,
|
|
3741
3744
|
received: r.parsedType
|
|
@@ -3747,7 +3750,7 @@ class zt extends T {
|
|
|
3747
3750
|
value: i._parse(new Ee(r, r.data[o], r.path, o)),
|
|
3748
3751
|
alwaysSet: o in r.data
|
|
3749
3752
|
});
|
|
3750
|
-
return r.common.async ?
|
|
3753
|
+
return r.common.async ? X.mergeObjectAsync(n, s) : X.mergeObjectSync(n, s);
|
|
3751
3754
|
}
|
|
3752
3755
|
get element() {
|
|
3753
3756
|
return this._def.valueType;
|
|
@@ -3774,7 +3777,7 @@ class kn extends T {
|
|
|
3774
3777
|
_parse(e) {
|
|
3775
3778
|
const { status: n, ctx: r } = this._processInputParams(e);
|
|
3776
3779
|
if (r.parsedType !== _.map)
|
|
3777
|
-
return
|
|
3780
|
+
return y(r, {
|
|
3778
3781
|
code: f.invalid_type,
|
|
3779
3782
|
expected: _.map,
|
|
3780
3783
|
received: r.parsedType
|
|
@@ -3815,20 +3818,20 @@ class nt extends T {
|
|
|
3815
3818
|
_parse(e) {
|
|
3816
3819
|
const { status: n, ctx: r } = this._processInputParams(e);
|
|
3817
3820
|
if (r.parsedType !== _.set)
|
|
3818
|
-
return
|
|
3821
|
+
return y(r, {
|
|
3819
3822
|
code: f.invalid_type,
|
|
3820
3823
|
expected: _.set,
|
|
3821
3824
|
received: r.parsedType
|
|
3822
3825
|
}), S;
|
|
3823
3826
|
const s = this._def;
|
|
3824
|
-
s.minSize !== null && r.data.size < s.minSize.value && (
|
|
3827
|
+
s.minSize !== null && r.data.size < s.minSize.value && (y(r, {
|
|
3825
3828
|
code: f.too_small,
|
|
3826
3829
|
minimum: s.minSize.value,
|
|
3827
3830
|
type: "set",
|
|
3828
3831
|
inclusive: !0,
|
|
3829
3832
|
exact: !1,
|
|
3830
3833
|
message: s.minSize.message
|
|
3831
|
-
}), n.dirty()), s.maxSize !== null && r.data.size > s.maxSize.value && (
|
|
3834
|
+
}), n.dirty()), s.maxSize !== null && r.data.size > s.maxSize.value && (y(r, {
|
|
3832
3835
|
code: f.too_big,
|
|
3833
3836
|
maximum: s.maxSize.value,
|
|
3834
3837
|
type: "set",
|
|
@@ -3879,7 +3882,7 @@ class pt extends T {
|
|
|
3879
3882
|
_parse(e) {
|
|
3880
3883
|
const { ctx: n } = this._processInputParams(e);
|
|
3881
3884
|
if (n.parsedType !== _.function)
|
|
3882
|
-
return
|
|
3885
|
+
return y(n, {
|
|
3883
3886
|
code: f.invalid_type,
|
|
3884
3887
|
expected: _.function,
|
|
3885
3888
|
received: n.parsedType
|
|
@@ -3919,7 +3922,7 @@ class pt extends T {
|
|
|
3919
3922
|
const a = { errorMap: n.common.contextualErrorMap }, i = n.data;
|
|
3920
3923
|
if (this._def.returns instanceof vt) {
|
|
3921
3924
|
const o = this;
|
|
3922
|
-
return
|
|
3925
|
+
return te(function(...u) {
|
|
3923
3926
|
return ke(this, null, function* () {
|
|
3924
3927
|
const c = new ie([]), h = yield o._def.args.parseAsync(u, a).catch((k) => {
|
|
3925
3928
|
throw c.addIssue(r(u, k)), c;
|
|
@@ -3931,7 +3934,7 @@ class pt extends T {
|
|
|
3931
3934
|
});
|
|
3932
3935
|
} else {
|
|
3933
3936
|
const o = this;
|
|
3934
|
-
return
|
|
3937
|
+
return te(function(...u) {
|
|
3935
3938
|
const c = o._def.args.safeParse(u, a);
|
|
3936
3939
|
if (!c.success)
|
|
3937
3940
|
throw new ie([r(u, c.error)]);
|
|
@@ -3989,7 +3992,7 @@ class Ut extends T {
|
|
|
3989
3992
|
_parse(e) {
|
|
3990
3993
|
if (e.data !== this._def.value) {
|
|
3991
3994
|
const n = this._getOrReturnCtx(e);
|
|
3992
|
-
return
|
|
3995
|
+
return y(n, {
|
|
3993
3996
|
received: n.data,
|
|
3994
3997
|
code: f.invalid_literal,
|
|
3995
3998
|
expected: this._def.value
|
|
@@ -4018,7 +4021,7 @@ class Fe extends T {
|
|
|
4018
4021
|
_parse(e) {
|
|
4019
4022
|
if (typeof e.data != "string") {
|
|
4020
4023
|
const n = this._getOrReturnCtx(e), r = this._def.values;
|
|
4021
|
-
return
|
|
4024
|
+
return y(n, {
|
|
4022
4025
|
expected: C.joinValues(r),
|
|
4023
4026
|
received: n.parsedType,
|
|
4024
4027
|
code: f.invalid_type
|
|
@@ -4026,13 +4029,13 @@ class Fe extends T {
|
|
|
4026
4029
|
}
|
|
4027
4030
|
if (vn(this, St) || Ws(this, St, new Set(this._def.values)), !vn(this, St).has(e.data)) {
|
|
4028
4031
|
const n = this._getOrReturnCtx(e), r = this._def.values;
|
|
4029
|
-
return
|
|
4032
|
+
return y(n, {
|
|
4030
4033
|
received: n.data,
|
|
4031
4034
|
code: f.invalid_enum_value,
|
|
4032
4035
|
options: r
|
|
4033
4036
|
}), S;
|
|
4034
4037
|
}
|
|
4035
|
-
return
|
|
4038
|
+
return te(e.data);
|
|
4036
4039
|
}
|
|
4037
4040
|
get options() {
|
|
4038
4041
|
return this._def.values;
|
|
@@ -4072,7 +4075,7 @@ class Bt extends T {
|
|
|
4072
4075
|
const n = C.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
|
|
4073
4076
|
if (r.parsedType !== _.string && r.parsedType !== _.number) {
|
|
4074
4077
|
const s = C.objectValues(n);
|
|
4075
|
-
return
|
|
4078
|
+
return y(r, {
|
|
4076
4079
|
expected: C.joinValues(s),
|
|
4077
4080
|
received: r.parsedType,
|
|
4078
4081
|
code: f.invalid_type
|
|
@@ -4080,13 +4083,13 @@ class Bt extends T {
|
|
|
4080
4083
|
}
|
|
4081
4084
|
if (vn(this, Ot) || Ws(this, Ot, new Set(C.getValidEnumValues(this._def.values))), !vn(this, Ot).has(e.data)) {
|
|
4082
4085
|
const s = C.objectValues(n);
|
|
4083
|
-
return
|
|
4086
|
+
return y(r, {
|
|
4084
4087
|
received: r.data,
|
|
4085
4088
|
code: f.invalid_enum_value,
|
|
4086
4089
|
options: s
|
|
4087
4090
|
}), S;
|
|
4088
4091
|
}
|
|
4089
|
-
return
|
|
4092
|
+
return te(e.data);
|
|
4090
4093
|
}
|
|
4091
4094
|
get enum() {
|
|
4092
4095
|
return this._def.values;
|
|
@@ -4104,13 +4107,13 @@ class vt extends T {
|
|
|
4104
4107
|
_parse(e) {
|
|
4105
4108
|
const { ctx: n } = this._processInputParams(e);
|
|
4106
4109
|
if (n.parsedType !== _.promise && n.common.async === !1)
|
|
4107
|
-
return
|
|
4110
|
+
return y(n, {
|
|
4108
4111
|
code: f.invalid_type,
|
|
4109
4112
|
expected: _.promise,
|
|
4110
4113
|
received: n.parsedType
|
|
4111
4114
|
}), S;
|
|
4112
4115
|
const r = n.parsedType === _.promise ? n.data : Promise.resolve(n.data);
|
|
4113
|
-
return
|
|
4116
|
+
return te(r.then((s) => this._def.type.parseAsync(s, {
|
|
4114
4117
|
path: n.path,
|
|
4115
4118
|
errorMap: n.common.contextualErrorMap
|
|
4116
4119
|
})));
|
|
@@ -4130,7 +4133,7 @@ class me extends T {
|
|
|
4130
4133
|
_parse(e) {
|
|
4131
4134
|
const { status: n, ctx: r } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
4132
4135
|
addIssue: (i) => {
|
|
4133
|
-
|
|
4136
|
+
y(r, i), i.fatal ? n.abort() : n.dirty();
|
|
4134
4137
|
},
|
|
4135
4138
|
get path() {
|
|
4136
4139
|
return r.path;
|
|
@@ -4209,7 +4212,7 @@ me.createWithPreprocess = (t, e, n) => new me(d({
|
|
|
4209
4212
|
}, O(n)));
|
|
4210
4213
|
class we extends T {
|
|
4211
4214
|
_parse(e) {
|
|
4212
|
-
return this._getType(e) === _.undefined ?
|
|
4215
|
+
return this._getType(e) === _.undefined ? te(void 0) : this._def.innerType._parse(e);
|
|
4213
4216
|
}
|
|
4214
4217
|
unwrap() {
|
|
4215
4218
|
return this._def.innerType;
|
|
@@ -4221,7 +4224,7 @@ we.create = (t, e) => new we(d({
|
|
|
4221
4224
|
}, O(e)));
|
|
4222
4225
|
class We extends T {
|
|
4223
4226
|
_parse(e) {
|
|
4224
|
-
return this._getType(e) === _.null ?
|
|
4227
|
+
return this._getType(e) === _.null ? te(null) : this._def.innerType._parse(e);
|
|
4225
4228
|
}
|
|
4226
4229
|
unwrap() {
|
|
4227
4230
|
return this._def.innerType;
|
|
@@ -4292,7 +4295,7 @@ class En extends T {
|
|
|
4292
4295
|
_parse(e) {
|
|
4293
4296
|
if (this._getType(e) !== _.nan) {
|
|
4294
4297
|
const n = this._getOrReturnCtx(e);
|
|
4295
|
-
return
|
|
4298
|
+
return y(n, {
|
|
4296
4299
|
code: f.invalid_type,
|
|
4297
4300
|
expected: _.nan,
|
|
4298
4301
|
received: n.parsedType
|
|
@@ -4305,7 +4308,7 @@ En.create = (t) => new En(d({
|
|
|
4305
4308
|
typeName: E.ZodNaN
|
|
4306
4309
|
}, O(t)));
|
|
4307
4310
|
const Ui = Symbol("zod_brand");
|
|
4308
|
-
class
|
|
4311
|
+
class Rr extends T {
|
|
4309
4312
|
_parse(e) {
|
|
4310
4313
|
const { ctx: n } = this._processInputParams(e), r = n.data;
|
|
4311
4314
|
return this._def.type._parse({
|
|
@@ -4389,7 +4392,7 @@ var E;
|
|
|
4389
4392
|
})(E || (E = {}));
|
|
4390
4393
|
const qi = (t, e = {
|
|
4391
4394
|
message: `Input not instance of ${t.name}`
|
|
4392
|
-
}) => qs((n) => n instanceof t, e), Ks = he.create, Hs = Le.create, Ki = En.create, Hi = $e.create, Gs = Mt.create, Gi = tt.create, Ji = bn.create, Xi = Lt.create, Yi = $t.create, Qi = _t.create, eo = Xe.create, to =
|
|
4395
|
+
}) => qs((n) => n instanceof t, e), Ks = he.create, Hs = Le.create, Ki = En.create, Hi = $e.create, Gs = Mt.create, Gi = tt.create, Ji = bn.create, Xi = Lt.create, Yi = $t.create, Qi = _t.create, eo = Xe.create, to = Re.create, no = wn.create, ro = pe.create, so = F.create, ao = F.strictCreate, io = Ft.create, oo = An.create, uo = Wt.create, co = xe.create, lo = zt.create, fo = kn.create, ho = nt.create, po = pt.create, mo = Vt.create, yo = Ut.create, go = Fe.create, _o = Bt.create, vo = vt.create, ys = me.create, bo = we.create, wo = We.create, ko = me.createWithPreprocess, Eo = Xt.create, xo = () => Ks().optional(), So = () => Hs().optional(), Oo = () => Gs().optional(), To = {
|
|
4393
4396
|
string: (t) => he.create(x(d({}, t), { coerce: !0 })),
|
|
4394
4397
|
number: (t) => Le.create(x(d({}, t), { coerce: !0 })),
|
|
4395
4398
|
boolean: (t) => Mt.create(x(d({}, t), {
|
|
@@ -4398,18 +4401,18 @@ const qi = (t, e = {
|
|
|
4398
4401
|
bigint: (t) => $e.create(x(d({}, t), { coerce: !0 })),
|
|
4399
4402
|
date: (t) => tt.create(x(d({}, t), { coerce: !0 }))
|
|
4400
4403
|
}, Ao = S;
|
|
4401
|
-
var
|
|
4404
|
+
var G = /* @__PURE__ */ Object.freeze({
|
|
4402
4405
|
__proto__: null,
|
|
4403
4406
|
defaultErrorMap: gt,
|
|
4404
4407
|
setErrorMap: wi,
|
|
4405
4408
|
getErrorMap: yn,
|
|
4406
4409
|
makeIssue: gn,
|
|
4407
4410
|
EMPTY_PATH: ki,
|
|
4408
|
-
addIssueToContext:
|
|
4409
|
-
ParseStatus:
|
|
4411
|
+
addIssueToContext: y,
|
|
4412
|
+
ParseStatus: X,
|
|
4410
4413
|
INVALID: S,
|
|
4411
4414
|
DIRTY: _n,
|
|
4412
|
-
OK:
|
|
4415
|
+
OK: te,
|
|
4413
4416
|
isAborted: yr,
|
|
4414
4417
|
isDirty: gr,
|
|
4415
4418
|
isValid: et,
|
|
@@ -4421,7 +4424,7 @@ var se = /* @__PURE__ */ Object.freeze({
|
|
|
4421
4424
|
return mr;
|
|
4422
4425
|
},
|
|
4423
4426
|
ZodParsedType: _,
|
|
4424
|
-
getParsedType:
|
|
4427
|
+
getParsedType: Ne,
|
|
4425
4428
|
ZodType: T,
|
|
4426
4429
|
datetimeRegex: Us,
|
|
4427
4430
|
ZodString: he,
|
|
@@ -4434,7 +4437,7 @@ var se = /* @__PURE__ */ Object.freeze({
|
|
|
4434
4437
|
ZodNull: $t,
|
|
4435
4438
|
ZodAny: _t,
|
|
4436
4439
|
ZodUnknown: Xe,
|
|
4437
|
-
ZodNever:
|
|
4440
|
+
ZodNever: Re,
|
|
4438
4441
|
ZodVoid: wn,
|
|
4439
4442
|
ZodArray: pe,
|
|
4440
4443
|
ZodObject: F,
|
|
@@ -4459,7 +4462,7 @@ var se = /* @__PURE__ */ Object.freeze({
|
|
|
4459
4462
|
ZodCatch: Kt,
|
|
4460
4463
|
ZodNaN: En,
|
|
4461
4464
|
BRAND: Ui,
|
|
4462
|
-
ZodBranded:
|
|
4465
|
+
ZodBranded: Rr,
|
|
4463
4466
|
ZodPipeline: Xt,
|
|
4464
4467
|
ZodReadonly: Ht,
|
|
4465
4468
|
custom: qs,
|
|
@@ -4514,14 +4517,14 @@ var se = /* @__PURE__ */ Object.freeze({
|
|
|
4514
4517
|
quotelessJson: bi,
|
|
4515
4518
|
ZodError: ie
|
|
4516
4519
|
});
|
|
4517
|
-
|
|
4518
|
-
language:
|
|
4520
|
+
G.object({
|
|
4521
|
+
language: G.enum(["typescript", "javascript"]).optional()
|
|
4519
4522
|
}).and(
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
framework:
|
|
4523
|
-
model:
|
|
4524
|
-
styling:
|
|
4523
|
+
G.union([
|
|
4524
|
+
G.object({
|
|
4525
|
+
framework: G.literal("react"),
|
|
4526
|
+
model: G.string().optional(),
|
|
4527
|
+
styling: G.enum([
|
|
4525
4528
|
"plain_css",
|
|
4526
4529
|
"css_modules",
|
|
4527
4530
|
"styled_components",
|
|
@@ -4530,26 +4533,29 @@ se.object({
|
|
|
4530
4533
|
"scss",
|
|
4531
4534
|
"inline_styles"
|
|
4532
4535
|
]),
|
|
4533
|
-
uiLibrary:
|
|
4534
|
-
enableUILibraryTheming:
|
|
4536
|
+
uiLibrary: G.enum(["mui", "antd", "radix", "shadcn"]).optional(),
|
|
4537
|
+
enableUILibraryTheming: G.boolean().optional(),
|
|
4538
|
+
enableCompactStructure: G.boolean().optional(),
|
|
4539
|
+
enableAutoSplit: G.boolean().optional(),
|
|
4540
|
+
autoSplitThreshold: G.number().optional()
|
|
4535
4541
|
}),
|
|
4536
|
-
|
|
4537
|
-
framework:
|
|
4538
|
-
styling:
|
|
4539
|
-
enableTranslation:
|
|
4542
|
+
G.object({
|
|
4543
|
+
framework: G.literal("html"),
|
|
4544
|
+
styling: G.enum(["plain_css", "inline_styles"]),
|
|
4545
|
+
enableTranslation: G.boolean().optional()
|
|
4540
4546
|
})
|
|
4541
4547
|
])
|
|
4542
4548
|
);
|
|
4543
|
-
var Co = Object.defineProperty,
|
|
4549
|
+
var Co = Object.defineProperty, No = Object.defineProperties, Po = Object.getOwnPropertyDescriptors, gs = Object.getOwnPropertySymbols, Ro = Object.prototype.hasOwnProperty, jo = Object.prototype.propertyIsEnumerable, _s = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), Js = (t) => {
|
|
4544
4550
|
throw TypeError(t);
|
|
4545
4551
|
}, vs = (t, e, n) => e in t ? Co(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, ae = (t, e) => {
|
|
4546
4552
|
for (var n in e || (e = {}))
|
|
4547
|
-
|
|
4553
|
+
Ro.call(e, n) && vs(t, n, e[n]);
|
|
4548
4554
|
if (gs)
|
|
4549
4555
|
for (var n of gs(e))
|
|
4550
|
-
|
|
4556
|
+
jo.call(e, n) && vs(t, n, e[n]);
|
|
4551
4557
|
return t;
|
|
4552
|
-
},
|
|
4558
|
+
}, jr = (t, e) => No(t, Po(e)), Ir = (t, e, n) => e.has(t) || Js("Cannot " + n), P = (t, e, n) => (Ir(t, e, "read from private field"), n ? n.call(t) : e.get(t)), de = (t, e, n) => e.has(t) ? Js("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), J = (t, e, n, r) => (Ir(t, e, "write to private field"), e.set(t, n), n), ve = (t, e, n) => (Ir(t, e, "access private method"), n), V = (t, e, n) => new Promise((r, s) => {
|
|
4553
4559
|
var a = (u) => {
|
|
4554
4560
|
try {
|
|
4555
4561
|
o(n.next(u));
|
|
@@ -4564,7 +4570,7 @@ var Co = Object.defineProperty, Po = Object.defineProperties, Ro = Object.getOwn
|
|
|
4564
4570
|
}
|
|
4565
4571
|
}, o = (u) => u.done ? r(u.value) : Promise.resolve(u.value).then(a, i);
|
|
4566
4572
|
o((n = n.apply(t, e)).next());
|
|
4567
|
-
}),
|
|
4573
|
+
}), Io = (t, e, n) => (e = t[_s("asyncIterator")]) ? e.call(t) : (t = t[_s("iterator")](), e = {}, n = (r, s) => (s = t[r]) && (e[r] = (a) => new Promise((i, o, u) => (a = s.call(t, a), u = a.done, Promise.resolve(a.value).then((c) => i({ value: c, done: u }), o)))), n("next"), n("return"), e), Zo = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
4568
4574
|
function Do(t) {
|
|
4569
4575
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
4570
4576
|
}
|
|
@@ -4574,42 +4580,42 @@ function Lo() {
|
|
|
4574
4580
|
(function(n, r) {
|
|
4575
4581
|
t.exports = r();
|
|
4576
4582
|
})(Mo, function() {
|
|
4577
|
-
var n = typeof Promise == "function", r = typeof self == "object" ? self : Zo, s = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", u = typeof WeakSet != "undefined", c = typeof DataView != "undefined", h = s && typeof Symbol.iterator != "undefined", p = s && 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()), l = g && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), v = h && typeof Array.prototype[Symbol.iterator] == "function",
|
|
4578
|
-
function B(
|
|
4579
|
-
var $ = typeof
|
|
4583
|
+
var n = typeof Promise == "function", r = typeof self == "object" ? self : Zo, s = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", u = typeof WeakSet != "undefined", c = typeof DataView != "undefined", h = s && typeof Symbol.iterator != "undefined", p = s && 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()), l = g && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), v = h && typeof Array.prototype[Symbol.iterator] == "function", m = v && Object.getPrototypeOf([][Symbol.iterator]()), z = h && typeof String.prototype[Symbol.iterator] == "function", R = z && Object.getPrototypeOf(""[Symbol.iterator]()), q = 8, D = -1;
|
|
4584
|
+
function B(j) {
|
|
4585
|
+
var $ = typeof j;
|
|
4580
4586
|
if ($ !== "object")
|
|
4581
4587
|
return $;
|
|
4582
|
-
if (
|
|
4588
|
+
if (j === null)
|
|
4583
4589
|
return "null";
|
|
4584
|
-
if (
|
|
4590
|
+
if (j === r)
|
|
4585
4591
|
return "global";
|
|
4586
|
-
if (Array.isArray(
|
|
4592
|
+
if (Array.isArray(j) && (p === !1 || !(Symbol.toStringTag in j)))
|
|
4587
4593
|
return "Array";
|
|
4588
4594
|
if (typeof window == "object" && window !== null) {
|
|
4589
|
-
if (typeof window.location == "object" &&
|
|
4595
|
+
if (typeof window.location == "object" && j === window.location)
|
|
4590
4596
|
return "Location";
|
|
4591
|
-
if (typeof window.document == "object" &&
|
|
4597
|
+
if (typeof window.document == "object" && j === window.document)
|
|
4592
4598
|
return "Document";
|
|
4593
4599
|
if (typeof window.navigator == "object") {
|
|
4594
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
4600
|
+
if (typeof window.navigator.mimeTypes == "object" && j === window.navigator.mimeTypes)
|
|
4595
4601
|
return "MimeTypeArray";
|
|
4596
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
4602
|
+
if (typeof window.navigator.plugins == "object" && j === window.navigator.plugins)
|
|
4597
4603
|
return "PluginArray";
|
|
4598
4604
|
}
|
|
4599
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
4600
|
-
if (
|
|
4605
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && j instanceof window.HTMLElement) {
|
|
4606
|
+
if (j.tagName === "BLOCKQUOTE")
|
|
4601
4607
|
return "HTMLQuoteElement";
|
|
4602
|
-
if (
|
|
4608
|
+
if (j.tagName === "TD")
|
|
4603
4609
|
return "HTMLTableDataCellElement";
|
|
4604
|
-
if (
|
|
4610
|
+
if (j.tagName === "TH")
|
|
4605
4611
|
return "HTMLTableHeaderCellElement";
|
|
4606
4612
|
}
|
|
4607
4613
|
}
|
|
4608
|
-
var Se = p &&
|
|
4614
|
+
var Se = p && j[Symbol.toStringTag];
|
|
4609
4615
|
if (typeof Se == "string")
|
|
4610
4616
|
return Se;
|
|
4611
|
-
var M = Object.getPrototypeOf(
|
|
4612
|
-
return M === RegExp.prototype ? "RegExp" : M === Date.prototype ? "Date" : n && M === Promise.prototype ? "Promise" : i && M === Set.prototype ? "Set" : a && M === Map.prototype ? "Map" : u && M === WeakSet.prototype ? "WeakSet" : o && M === WeakMap.prototype ? "WeakMap" : c && M === DataView.prototype ? "DataView" : a && M === l ? "Map Iterator" : i && M === b ? "Set Iterator" : v && M ===
|
|
4617
|
+
var M = Object.getPrototypeOf(j);
|
|
4618
|
+
return M === RegExp.prototype ? "RegExp" : M === Date.prototype ? "Date" : n && M === Promise.prototype ? "Promise" : i && M === Set.prototype ? "Set" : a && M === Map.prototype ? "Map" : u && M === WeakSet.prototype ? "WeakSet" : o && M === WeakMap.prototype ? "WeakMap" : c && M === DataView.prototype ? "DataView" : a && M === l ? "Map Iterator" : i && M === b ? "Set Iterator" : v && M === m ? "Array Iterator" : z && M === R ? "String Iterator" : M === null ? "Object" : Object.prototype.toString.call(j).slice(q, D);
|
|
4613
4619
|
}
|
|
4614
4620
|
return B;
|
|
4615
4621
|
});
|
|
@@ -4741,7 +4747,7 @@ function nu(t) {
|
|
|
4741
4747
|
function Ae(t, e) {
|
|
4742
4748
|
return Un[e].from ? Un[e].from(t) : new Un[e](t);
|
|
4743
4749
|
}
|
|
4744
|
-
function
|
|
4750
|
+
function Q(t) {
|
|
4745
4751
|
return t;
|
|
4746
4752
|
}
|
|
4747
4753
|
function ks() {
|
|
@@ -4778,23 +4784,23 @@ const iu = /* @__PURE__ */ new Map([
|
|
|
4778
4784
|
["Uint8Array", Ae],
|
|
4779
4785
|
["Uint8ClampedArray", Ae],
|
|
4780
4786
|
// shallow copy
|
|
4781
|
-
["Array Iterator",
|
|
4782
|
-
["Map Iterator",
|
|
4783
|
-
["Promise",
|
|
4784
|
-
["Set Iterator",
|
|
4785
|
-
["String Iterator",
|
|
4786
|
-
["function",
|
|
4787
|
-
["global",
|
|
4787
|
+
["Array Iterator", Q],
|
|
4788
|
+
["Map Iterator", Q],
|
|
4789
|
+
["Promise", Q],
|
|
4790
|
+
["Set Iterator", Q],
|
|
4791
|
+
["String Iterator", Q],
|
|
4792
|
+
["function", Q],
|
|
4793
|
+
["global", Q],
|
|
4788
4794
|
// NOTE: WeakMap and WeakSet cannot get entries
|
|
4789
|
-
["WeakMap",
|
|
4790
|
-
["WeakSet",
|
|
4795
|
+
["WeakMap", Q],
|
|
4796
|
+
["WeakSet", Q],
|
|
4791
4797
|
// primitives
|
|
4792
|
-
["boolean",
|
|
4793
|
-
["null",
|
|
4794
|
-
["number",
|
|
4795
|
-
["string",
|
|
4796
|
-
["symbol",
|
|
4797
|
-
["undefined",
|
|
4798
|
+
["boolean", Q],
|
|
4799
|
+
["null", Q],
|
|
4800
|
+
["number", Q],
|
|
4801
|
+
["string", Q],
|
|
4802
|
+
["symbol", Q],
|
|
4803
|
+
["undefined", Q],
|
|
4798
4804
|
// collections
|
|
4799
4805
|
// NOTE: return empty value, because recursively copy later.
|
|
4800
4806
|
["Arguments", ks],
|
|
@@ -4883,14 +4889,14 @@ const uu = (t) => new Promise((e) => setTimeout(e, t));
|
|
|
4883
4889
|
var cn, Ge, dn, Er, Xs;
|
|
4884
4890
|
class cu {
|
|
4885
4891
|
constructor({ maxAttempts: e = 3, func: n }) {
|
|
4886
|
-
de(this, Er), de(this, cn), de(this, Ge), de(this, dn),
|
|
4892
|
+
de(this, Er), de(this, cn), de(this, Ge), de(this, dn), J(this, cn, e), J(this, dn, n), J(this, Ge, 0);
|
|
4887
4893
|
}
|
|
4888
4894
|
run() {
|
|
4889
4895
|
return V(this, null, function* () {
|
|
4890
4896
|
try {
|
|
4891
|
-
return yield
|
|
4897
|
+
return yield P(this, dn).call(this);
|
|
4892
4898
|
} catch (e) {
|
|
4893
|
-
if (
|
|
4899
|
+
if (J(this, Ge, P(this, Ge) + 1), P(this, Ge) > P(this, cn))
|
|
4894
4900
|
throw console.error("Max attempts reached"), e;
|
|
4895
4901
|
const n = ve(this, Er, Xs).call(this);
|
|
4896
4902
|
return yield uu(n), yield this.run();
|
|
@@ -4899,7 +4905,7 @@ class cu {
|
|
|
4899
4905
|
}
|
|
4900
4906
|
}
|
|
4901
4907
|
cn = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap(), dn = /* @__PURE__ */ new WeakMap(), Er = /* @__PURE__ */ new WeakSet(), Xs = function() {
|
|
4902
|
-
return
|
|
4908
|
+
return P(this, Ge) * 1e3 * 1.5;
|
|
4903
4909
|
};
|
|
4904
4910
|
function du() {
|
|
4905
4911
|
return typeof CompressionStream != "undefined";
|
|
@@ -4908,7 +4914,7 @@ function lu(t) {
|
|
|
4908
4914
|
return V(this, null, function* () {
|
|
4909
4915
|
const e = new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")), n = [];
|
|
4910
4916
|
try {
|
|
4911
|
-
for (var r =
|
|
4917
|
+
for (var r = Io(e), s, a, i; s = !(a = yield r.next()).done; s = !1) {
|
|
4912
4918
|
const o = a.value;
|
|
4913
4919
|
n.push(o);
|
|
4914
4920
|
}
|
|
@@ -4990,10 +4996,10 @@ function xr() {
|
|
|
4990
4996
|
return Math.floor(Date.now() / 1e3).toString();
|
|
4991
4997
|
}
|
|
4992
4998
|
const mu = 5 * 60 * 1e3, yu = 1 * 1e3;
|
|
4993
|
-
var Je,
|
|
4999
|
+
var Je, ne, ge, Sr, Or, At;
|
|
4994
5000
|
class gu {
|
|
4995
5001
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: n }) {
|
|
4996
|
-
de(this, ge), de(this, Je), de(this,
|
|
5002
|
+
de(this, ge), de(this, Je), de(this, ne), this.baseAddress = n, J(this, Je, e), J(this, ne, {}), this.plugins = [];
|
|
4997
5003
|
}
|
|
4998
5004
|
get headers() {
|
|
4999
5005
|
throw new Error("Missing implementation");
|
|
@@ -5005,47 +5011,47 @@ class gu {
|
|
|
5005
5011
|
this.plugins = this.plugins.filter((n) => n.name !== e);
|
|
5006
5012
|
}
|
|
5007
5013
|
withOptions(e = {}) {
|
|
5008
|
-
return
|
|
5014
|
+
return J(this, ne, e), this;
|
|
5009
5015
|
}
|
|
5010
5016
|
get(e) {
|
|
5011
5017
|
return V(this, arguments, function* (n, r = {}) {
|
|
5012
5018
|
const { overrideBaseAddress: s, overrideDefaultHeaders: a } = r, i = s != null ? s : this.baseAddress;
|
|
5013
5019
|
let o = a != null ? a : this.headers;
|
|
5014
|
-
const u = kt(
|
|
5015
|
-
return
|
|
5020
|
+
const u = kt(P(this, ne));
|
|
5021
|
+
return J(this, ne, {}), u.extraHeaders && (o = ae(ae({}, o), u.extraHeaders)), u.requestValidation && (o = jr(ae({}, o), { "X-Request-Nonce": Ys(), "X-Request-Timestamp": xr() })), u.async ? yield ve(this, ge, Or).call(this, `${i}${n}`, u.async, { headers: o }) : yield ve(this, ge, Sr).call(this, `${i}${n}`, u, { headers: o });
|
|
5016
5022
|
});
|
|
5017
5023
|
}
|
|
5018
5024
|
post(e, n) {
|
|
5019
5025
|
return V(this, arguments, function* (r, s, a = {}) {
|
|
5020
|
-
const i = kt(
|
|
5021
|
-
return
|
|
5026
|
+
const i = kt(P(this, ne));
|
|
5027
|
+
return J(this, ne, {}), ve(this, ge, At).call(this, r, "POST", s, a, i);
|
|
5022
5028
|
});
|
|
5023
5029
|
}
|
|
5024
5030
|
put(e, n) {
|
|
5025
5031
|
return V(this, arguments, function* (r, s, a = {}) {
|
|
5026
|
-
const i = kt(
|
|
5027
|
-
return
|
|
5032
|
+
const i = kt(P(this, ne));
|
|
5033
|
+
return J(this, ne, {}), ve(this, ge, At).call(this, r, "PUT", s, a, i);
|
|
5028
5034
|
});
|
|
5029
5035
|
}
|
|
5030
5036
|
delete(e, n) {
|
|
5031
5037
|
return V(this, arguments, function* (r, s, a = {}) {
|
|
5032
|
-
const i = kt(
|
|
5033
|
-
return
|
|
5038
|
+
const i = kt(P(this, ne));
|
|
5039
|
+
return J(this, ne, {}), ve(this, ge, At).call(this, r, "DELETE", s, a, i);
|
|
5034
5040
|
});
|
|
5035
5041
|
}
|
|
5036
5042
|
patch(e, n) {
|
|
5037
5043
|
return V(this, arguments, function* (r, s, a = {}) {
|
|
5038
|
-
const i = kt(
|
|
5039
|
-
return
|
|
5044
|
+
const i = kt(P(this, ne));
|
|
5045
|
+
return J(this, ne, {}), ve(this, ge, At).call(this, r, "PATCH", s, a, i);
|
|
5040
5046
|
});
|
|
5041
5047
|
}
|
|
5042
5048
|
}
|
|
5043
|
-
Je = /* @__PURE__ */ new WeakMap(),
|
|
5049
|
+
Je = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakSet(), Sr = function(t, e, n) {
|
|
5044
5050
|
return V(this, null, function* () {
|
|
5045
5051
|
const r = () => V(this, null, function* () {
|
|
5046
5052
|
var u, c;
|
|
5047
5053
|
try {
|
|
5048
|
-
return yield
|
|
5054
|
+
return yield P(this, Je).call(this, t, ae(ae({}, n), e.abortSignal && { signal: e.abortSignal }));
|
|
5049
5055
|
} catch (h) {
|
|
5050
5056
|
throw h instanceof Error && h.name === "AbortError" ? new Tt({ canceled: (c = (u = e.abortSignal) == null ? void 0 : u.aborted) != null ? c : !1 }) : h;
|
|
5051
5057
|
}
|
|
@@ -5105,7 +5111,7 @@ Je = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
5105
5111
|
} = e, c = `${t}/async`, h = `${t}/async/job`;
|
|
5106
5112
|
let p;
|
|
5107
5113
|
try {
|
|
5108
|
-
p = yield
|
|
5114
|
+
p = yield P(this, Je).call(this, c, ae(ae({}, n), i && { signal: i }));
|
|
5109
5115
|
} catch (b) {
|
|
5110
5116
|
throw b instanceof Error && b.name === "AbortError" ? new Tt({ canceled: (r = i == null ? void 0 : i.aborted) != null ? r : !1 }) : b;
|
|
5111
5117
|
}
|
|
@@ -5126,40 +5132,40 @@ Je = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), ge = /*
|
|
|
5126
5132
|
return new Promise((b, l) => V(this, null, function* () {
|
|
5127
5133
|
const v = setTimeout(() => {
|
|
5128
5134
|
l(new Error("Job timed out"));
|
|
5129
|
-
}, u),
|
|
5135
|
+
}, u), m = (z = 0) => V(this, null, function* () {
|
|
5130
5136
|
if (i != null && i.aborted) {
|
|
5131
|
-
clearTimeout(v),
|
|
5137
|
+
clearTimeout(v), P(this, Je).call(this, `${h}/${g}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
5132
5138
|
l(new Tt({ canceled: !0 }));
|
|
5133
|
-
}).catch((
|
|
5139
|
+
}).catch((R) => {
|
|
5134
5140
|
l(new Tt({ canceled: !1 }));
|
|
5135
5141
|
});
|
|
5136
5142
|
return;
|
|
5137
5143
|
}
|
|
5138
5144
|
try {
|
|
5139
|
-
const
|
|
5140
|
-
if (
|
|
5145
|
+
const R = yield (yield P(this, Je).call(this, `${h}/${g}`, { headers: this.headers })).json();
|
|
5146
|
+
if (R.status === "success") {
|
|
5141
5147
|
clearTimeout(v);
|
|
5142
|
-
const q =
|
|
5148
|
+
const q = R.response_json;
|
|
5143
5149
|
b(q);
|
|
5144
|
-
} else if (
|
|
5145
|
-
clearTimeout(v), l(new pu(
|
|
5150
|
+
} else if (R.status === "failed")
|
|
5151
|
+
clearTimeout(v), l(new pu(R.response_json));
|
|
5146
5152
|
else {
|
|
5147
|
-
a && a(
|
|
5153
|
+
a && a(R.response_json);
|
|
5148
5154
|
const q = o(z);
|
|
5149
|
-
setTimeout(() =>
|
|
5155
|
+
setTimeout(() => m(z + 1), q);
|
|
5150
5156
|
}
|
|
5151
|
-
} catch (
|
|
5152
|
-
l(
|
|
5157
|
+
} catch (R) {
|
|
5158
|
+
l(R);
|
|
5153
5159
|
}
|
|
5154
5160
|
});
|
|
5155
|
-
|
|
5161
|
+
m();
|
|
5156
5162
|
}));
|
|
5157
5163
|
});
|
|
5158
5164
|
}, At = function(t, e, n, r, s) {
|
|
5159
5165
|
return V(this, null, function* () {
|
|
5160
5166
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = r, o = a != null ? a : this.baseAddress;
|
|
5161
5167
|
let u = i != null ? i : this.headers;
|
|
5162
|
-
s.extraHeaders && (u = ae(ae({}, u), s.extraHeaders)), s.requestValidation && (u =
|
|
5168
|
+
s.extraHeaders && (u = ae(ae({}, u), s.extraHeaders)), s.requestValidation && (u = jr(ae({}, u), { "X-Request-Nonce": Ys(), "X-Request-Timestamp": xr() }));
|
|
5163
5169
|
let c = r.skipBodyJsonStringify ? n : JSON.stringify(n);
|
|
5164
5170
|
return s.compress && du() && (u["Content-Encoding"] = "gzip", c = yield lu(c)), s.async ? yield ve(this, ge, Or).call(this, `${o}${t}`, s.async, {
|
|
5165
5171
|
method: e,
|
|
@@ -5192,21 +5198,21 @@ const xs = (t, e, n, r) => t instanceof Tt ? t : new hu({ resource: e, api: Stri
|
|
|
5192
5198
|
var Ct;
|
|
5193
5199
|
class _u {
|
|
5194
5200
|
constructor(e) {
|
|
5195
|
-
de(this, Ct), this.resourceName = "Files",
|
|
5201
|
+
de(this, Ct), this.resourceName = "Files", J(this, Ct, e);
|
|
5196
5202
|
}
|
|
5197
5203
|
get(e) {
|
|
5198
5204
|
return V(this, arguments, function* ({ fileKey: n, params: r = {} }) {
|
|
5199
5205
|
const s = new URLSearchParams(ae({
|
|
5200
5206
|
plugin_data: "857346721138427857"
|
|
5201
5207
|
}, r)).toString(), a = `v1/files/${n}?${s}`;
|
|
5202
|
-
return yield
|
|
5208
|
+
return yield P(this, Ct).get(a);
|
|
5203
5209
|
});
|
|
5204
5210
|
}
|
|
5205
5211
|
getImageFills(e) {
|
|
5206
5212
|
return V(this, arguments, function* ({ fileKey: n }) {
|
|
5207
5213
|
var r, s;
|
|
5208
5214
|
const a = `v1/files/${n}/images`;
|
|
5209
|
-
return (s = (r = (yield
|
|
5215
|
+
return (s = (r = (yield P(this, Ct).get(a)).meta) == null ? void 0 : r.images) != null ? s : {};
|
|
5210
5216
|
});
|
|
5211
5217
|
}
|
|
5212
5218
|
}
|
|
@@ -5218,7 +5224,7 @@ const vu = (t, e, n) => {
|
|
|
5218
5224
|
var _e, Tr, Qs;
|
|
5219
5225
|
class wu {
|
|
5220
5226
|
constructor(e) {
|
|
5221
|
-
de(this, Tr), de(this, _e), this.resourceName = "Images",
|
|
5227
|
+
de(this, Tr), de(this, _e), this.resourceName = "Images", J(this, _e, e);
|
|
5222
5228
|
}
|
|
5223
5229
|
/**
|
|
5224
5230
|
* Return the URL for the _layer_ images for the given nodes.
|
|
@@ -5226,29 +5232,29 @@ class wu {
|
|
|
5226
5232
|
*/
|
|
5227
5233
|
get(e) {
|
|
5228
5234
|
return V(this, arguments, function* ({ fileKey: n, nodeIds: r, format: s = "jpg", scale: a }) {
|
|
5229
|
-
const i = vu(n, r, s), o =
|
|
5235
|
+
const i = vu(n, r, s), o = P(this, _e).cache.images.entries.get(i);
|
|
5230
5236
|
if (bu(o))
|
|
5231
5237
|
return o.result;
|
|
5232
|
-
o &&
|
|
5233
|
-
const u =
|
|
5238
|
+
o && P(this, _e).cache.images.entries.delete(i);
|
|
5239
|
+
const u = P(this, _e).cache.images.pendingRequests.get(i);
|
|
5234
5240
|
if (u)
|
|
5235
5241
|
return u;
|
|
5236
5242
|
const c = ve(this, Tr, Qs).call(this, i, n, r, s, a);
|
|
5237
|
-
|
|
5243
|
+
P(this, _e).cache.images.pendingRequests.set(i, c);
|
|
5238
5244
|
try {
|
|
5239
5245
|
return yield c;
|
|
5240
5246
|
} finally {
|
|
5241
|
-
|
|
5247
|
+
P(this, _e).cache.images.pendingRequests.delete(i);
|
|
5242
5248
|
}
|
|
5243
5249
|
});
|
|
5244
5250
|
}
|
|
5245
5251
|
}
|
|
5246
5252
|
_e = /* @__PURE__ */ new WeakMap(), Tr = /* @__PURE__ */ new WeakSet(), Qs = function(t, e, n, r, s) {
|
|
5247
5253
|
return V(this, null, function* () {
|
|
5248
|
-
const a = yield
|
|
5254
|
+
const a = yield P(this, _e).get(
|
|
5249
5255
|
`v1/images/${e}?ids=${n}&format=${r}${s ? `&scale=${s}` : ""}`
|
|
5250
5256
|
);
|
|
5251
|
-
return
|
|
5257
|
+
return P(this, _e).cache.images.entries.set(t, {
|
|
5252
5258
|
result: a,
|
|
5253
5259
|
ts: Date.now()
|
|
5254
5260
|
}), a;
|
|
@@ -5257,27 +5263,27 @@ _e = /* @__PURE__ */ new WeakMap(), Tr = /* @__PURE__ */ new WeakSet(), Qs = fun
|
|
|
5257
5263
|
var ln;
|
|
5258
5264
|
class ku {
|
|
5259
5265
|
constructor(e) {
|
|
5260
|
-
de(this, ln), this.resourceName = "Nodes",
|
|
5266
|
+
de(this, ln), this.resourceName = "Nodes", J(this, ln, e);
|
|
5261
5267
|
}
|
|
5262
5268
|
get(e) {
|
|
5263
5269
|
return V(this, arguments, function* ({ fileKey: n, nodeIds: r, params: s = {} }) {
|
|
5264
|
-
const a =
|
|
5270
|
+
const a = jr(ae({}, s), {
|
|
5265
5271
|
ids: r.join(",")
|
|
5266
5272
|
}), i = new URLSearchParams(ae({
|
|
5267
5273
|
plugin_data: "857346721138427857"
|
|
5268
5274
|
}, a)).toString(), o = `v1/files/${n}/nodes?${i}`;
|
|
5269
|
-
return yield
|
|
5275
|
+
return yield P(this, ln).get(o);
|
|
5270
5276
|
});
|
|
5271
5277
|
}
|
|
5272
5278
|
}
|
|
5273
5279
|
ln = /* @__PURE__ */ new WeakMap();
|
|
5274
|
-
var
|
|
5280
|
+
var Ie;
|
|
5275
5281
|
class Eu extends gu {
|
|
5276
5282
|
constructor({
|
|
5277
5283
|
baseAddress: e = "https://api.figma.com/",
|
|
5278
5284
|
fetch: n = globalThis.fetch.bind(globalThis)
|
|
5279
5285
|
} = {}) {
|
|
5280
|
-
super({ fetch: n, baseAddress: e }), de(this,
|
|
5286
|
+
super({ fetch: n, baseAddress: e }), de(this, Ie, ""), this.cache = {
|
|
5281
5287
|
images: {
|
|
5282
5288
|
entries: /* @__PURE__ */ new Map(),
|
|
5283
5289
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
@@ -5287,19 +5293,19 @@ class Eu extends gu {
|
|
|
5287
5293
|
set token(e) {
|
|
5288
5294
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
5289
5295
|
throw new Error("Invalid Figma access token");
|
|
5290
|
-
|
|
5296
|
+
J(this, Ie, e);
|
|
5291
5297
|
}
|
|
5292
5298
|
get token() {
|
|
5293
|
-
return
|
|
5299
|
+
return P(this, Ie);
|
|
5294
5300
|
}
|
|
5295
5301
|
get headers() {
|
|
5296
5302
|
const e = {
|
|
5297
5303
|
"Content-Type": "application/json"
|
|
5298
5304
|
};
|
|
5299
|
-
return
|
|
5305
|
+
return P(this, Ie).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = P(this, Ie) : P(this, Ie).startsWith("figu_") && (e.Authorization = `Bearer ${P(this, Ie)}`), e;
|
|
5300
5306
|
}
|
|
5301
5307
|
}
|
|
5302
|
-
|
|
5308
|
+
Ie = /* @__PURE__ */ new WeakMap();
|
|
5303
5309
|
const xu = (t) => ke(void 0, [t], function* ({
|
|
5304
5310
|
fileKey: e,
|
|
5305
5311
|
authToken: n,
|