@animaapp/anima-sdk-react 0.6.28 → 0.6.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +562 -562
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var ia = Object.defineProperty, oa = Object.defineProperties;
|
|
|
2
2
|
var ca = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Vr = Object.getOwnPropertySymbols;
|
|
4
4
|
var ua = Object.prototype.hasOwnProperty, da = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var Kr = (t, e, n) => e in t ? ia(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n,
|
|
5
|
+
var Kr = (t, e, n) => e in t ? ia(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Be = (t, e) => {
|
|
6
6
|
for (var n in e || (e = {}))
|
|
7
7
|
ua.call(e, n) && Kr(t, n, e[n]);
|
|
8
8
|
if (Vr)
|
|
@@ -10,7 +10,7 @@ var Kr = (t, e, n) => e in t ? ia(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
10
10
|
da.call(e, n) && Kr(t, n, e[n]);
|
|
11
11
|
return t;
|
|
12
12
|
}, Br = (t, e) => oa(t, ca(e));
|
|
13
|
-
var
|
|
13
|
+
var Ze = (t, e, n) => new Promise((r, s) => {
|
|
14
14
|
var a = (c) => {
|
|
15
15
|
try {
|
|
16
16
|
o(n.next(c));
|
|
@@ -26,7 +26,7 @@ var Ie = (t, e, n) => new Promise((r, s) => {
|
|
|
26
26
|
}, o = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(a, i);
|
|
27
27
|
o((n = n.apply(t, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import Gt, { useState as la, useCallback as sn, createContext as fa, useEffect as ha, useLayoutEffect as pa, useContext as ma, useRef as
|
|
29
|
+
import Gt, { useState as la, useCallback as sn, createContext as fa, useEffect as ha, useLayoutEffect as pa, useContext as ma, useRef as qe, useMemo as ya, useDebugValue as ga } from "react";
|
|
30
30
|
const va = (t) => {
|
|
31
31
|
let e = "";
|
|
32
32
|
const n = new Uint8Array(t), r = n.byteLength;
|
|
@@ -34,14 +34,14 @@ const va = (t) => {
|
|
|
34
34
|
e += String.fromCharCode(n[s]);
|
|
35
35
|
return btoa(e);
|
|
36
36
|
};
|
|
37
|
-
var _a = Object.defineProperty, ba = Object.defineProperties, wa = Object.getOwnPropertyDescriptors, qr = Object.getOwnPropertySymbols, ka = Object.prototype.hasOwnProperty,
|
|
37
|
+
var _a = Object.defineProperty, ba = Object.defineProperties, wa = Object.getOwnPropertyDescriptors, qr = Object.getOwnPropertySymbols, ka = Object.prototype.hasOwnProperty, Ea = Object.prototype.propertyIsEnumerable, Hr = (t, e, n) => e in t ? _a(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, d = (t, e) => {
|
|
38
38
|
for (var n in e || (e = {}))
|
|
39
39
|
ka.call(e, n) && Hr(t, n, e[n]);
|
|
40
40
|
if (qr)
|
|
41
41
|
for (var n of qr(e))
|
|
42
|
-
|
|
42
|
+
Ea.call(e, n) && Hr(t, n, e[n]);
|
|
43
43
|
return t;
|
|
44
|
-
},
|
|
44
|
+
}, S = (t, e) => ba(t, wa(e)), Se = (t, e, n) => new Promise((r, s) => {
|
|
45
45
|
var a = (c) => {
|
|
46
46
|
try {
|
|
47
47
|
o(n.next(c));
|
|
@@ -67,14 +67,14 @@ class Gr extends Error {
|
|
|
67
67
|
super(), this.name = e, this.message = n, this.detail = s, this.status = r;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
const
|
|
71
|
-
class
|
|
70
|
+
const Sa = "Figma Token Issue";
|
|
71
|
+
class xa extends Error {
|
|
72
72
|
constructor({
|
|
73
73
|
fileKey: e,
|
|
74
74
|
reason: n,
|
|
75
75
|
cause: r
|
|
76
76
|
}) {
|
|
77
|
-
super(
|
|
77
|
+
super(Sa), this.fileKey = e, this.reason = n, this.cause = r;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
const Oa = "Rate Limit Exceeded";
|
|
@@ -106,7 +106,7 @@ const Pa = (t, e) => {
|
|
|
106
106
|
if (((n = t == null ? void 0 : t.cause) == null ? void 0 : n.message) === "Fetch Error") {
|
|
107
107
|
const { err: r, status: s } = t.cause.body;
|
|
108
108
|
if (s === 403)
|
|
109
|
-
return new
|
|
109
|
+
return new xa({
|
|
110
110
|
fileKey: e,
|
|
111
111
|
reason: r,
|
|
112
112
|
cause: t
|
|
@@ -129,7 +129,7 @@ var Za = Object.defineProperty, Da = Object.defineProperties, Ma = Object.getOwn
|
|
|
129
129
|
for (var n of Jr(e))
|
|
130
130
|
$a.call(e, n) && Yr(t, n, e[n]);
|
|
131
131
|
return t;
|
|
132
|
-
}, Tr = (t, e) => Da(t, Ma(e)), Ar = (t, e, n) => e.has(t) || Ts("Cannot " + n), P = (t, e, n) => (Ar(t, e, "read from private field"), n ? n.call(t) : e.get(t)),
|
|
132
|
+
}, Tr = (t, e) => Da(t, Ma(e)), Ar = (t, e, n) => e.has(t) || Ts("Cannot " + n), P = (t, e, n) => (Ar(t, e, "read from private field"), n ? n.call(t) : e.get(t)), he = (t, e, n) => e.has(t) ? Ts("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), J = (t, e, n, r) => (Ar(t, e, "write to private field"), e.set(t, n), n), we = (t, e, n) => (Ar(t, e, "access private method"), n), B = (t, e, n) => new Promise((r, s) => {
|
|
133
133
|
var a = (c) => {
|
|
134
134
|
try {
|
|
135
135
|
o(n.next(c));
|
|
@@ -185,11 +185,11 @@ function Va() {
|
|
|
185
185
|
return "HTMLTableHeaderCellElement";
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
var
|
|
189
|
-
if (typeof
|
|
190
|
-
return
|
|
191
|
-
var
|
|
192
|
-
return
|
|
188
|
+
var de = p && D[Symbol.toStringTag];
|
|
189
|
+
if (typeof de == "string")
|
|
190
|
+
return de;
|
|
191
|
+
var L = Object.getPrototypeOf(D);
|
|
192
|
+
return L === RegExp.prototype ? "RegExp" : L === Date.prototype ? "Date" : n && L === Promise.prototype ? "Promise" : i && L === Set.prototype ? "Set" : a && L === Map.prototype ? "Map" : c && L === WeakSet.prototype ? "WeakSet" : o && L === WeakMap.prototype ? "WeakMap" : u && L === DataView.prototype ? "DataView" : a && L === m ? "Map Iterator" : i && L === b ? "Set Iterator" : g && L === l ? "Array Iterator" : O && L === I ? "String Iterator" : L === null ? "Object" : Object.prototype.toString.call(D).slice(K, Z);
|
|
193
193
|
}
|
|
194
194
|
return U;
|
|
195
195
|
});
|
|
@@ -318,10 +318,10 @@ function oi(t) {
|
|
|
318
318
|
function ci(t) {
|
|
319
319
|
return new String(t);
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function Ne(t, e) {
|
|
322
322
|
return Rn[e].from ? Rn[e].from(t) : new Rn[e](t);
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function Q(t) {
|
|
325
325
|
return t;
|
|
326
326
|
}
|
|
327
327
|
function ts() {
|
|
@@ -348,33 +348,33 @@ const fi = /* @__PURE__ */ new Map([
|
|
|
348
348
|
["String", ci],
|
|
349
349
|
// typed arrays
|
|
350
350
|
// TODO: pass bound function
|
|
351
|
-
["Float32Array",
|
|
352
|
-
["Float64Array",
|
|
353
|
-
["Int16Array",
|
|
354
|
-
["Int32Array",
|
|
355
|
-
["Int8Array",
|
|
356
|
-
["Uint16Array",
|
|
357
|
-
["Uint32Array",
|
|
358
|
-
["Uint8Array",
|
|
359
|
-
["Uint8ClampedArray",
|
|
351
|
+
["Float32Array", Ne],
|
|
352
|
+
["Float64Array", Ne],
|
|
353
|
+
["Int16Array", Ne],
|
|
354
|
+
["Int32Array", Ne],
|
|
355
|
+
["Int8Array", Ne],
|
|
356
|
+
["Uint16Array", Ne],
|
|
357
|
+
["Uint32Array", Ne],
|
|
358
|
+
["Uint8Array", Ne],
|
|
359
|
+
["Uint8ClampedArray", Ne],
|
|
360
360
|
// shallow copy
|
|
361
|
-
["Array Iterator",
|
|
362
|
-
["Map Iterator",
|
|
363
|
-
["Promise",
|
|
364
|
-
["Set Iterator",
|
|
365
|
-
["String Iterator",
|
|
366
|
-
["function",
|
|
367
|
-
["global",
|
|
361
|
+
["Array Iterator", Q],
|
|
362
|
+
["Map Iterator", Q],
|
|
363
|
+
["Promise", Q],
|
|
364
|
+
["Set Iterator", Q],
|
|
365
|
+
["String Iterator", Q],
|
|
366
|
+
["function", Q],
|
|
367
|
+
["global", Q],
|
|
368
368
|
// NOTE: WeakMap and WeakSet cannot get entries
|
|
369
|
-
["WeakMap",
|
|
370
|
-
["WeakSet",
|
|
369
|
+
["WeakMap", Q],
|
|
370
|
+
["WeakSet", Q],
|
|
371
371
|
// primitives
|
|
372
|
-
["boolean",
|
|
373
|
-
["null",
|
|
374
|
-
["number",
|
|
375
|
-
["string",
|
|
376
|
-
["symbol",
|
|
377
|
-
["undefined",
|
|
372
|
+
["boolean", Q],
|
|
373
|
+
["null", Q],
|
|
374
|
+
["number", Q],
|
|
375
|
+
["string", Q],
|
|
376
|
+
["symbol", Q],
|
|
377
|
+
["undefined", Q],
|
|
378
378
|
// collections
|
|
379
379
|
// NOTE: return empty value, because recursively copy later.
|
|
380
380
|
["Arguments", ts],
|
|
@@ -460,26 +460,26 @@ function Gn(t, e, n, r, s) {
|
|
|
460
460
|
return e;
|
|
461
461
|
}
|
|
462
462
|
const pi = (t) => new Promise((e) => setTimeout(e, t));
|
|
463
|
-
var an,
|
|
463
|
+
var an, Ge, on, Jn, As;
|
|
464
464
|
class mi {
|
|
465
465
|
constructor({ maxAttempts: e = 3, func: n }) {
|
|
466
|
-
|
|
466
|
+
he(this, Jn), he(this, an), he(this, Ge), he(this, on), J(this, an, e), J(this, on, n), J(this, Ge, 0);
|
|
467
467
|
}
|
|
468
468
|
run() {
|
|
469
469
|
return B(this, null, function* () {
|
|
470
470
|
try {
|
|
471
471
|
return yield P(this, on).call(this);
|
|
472
472
|
} catch (e) {
|
|
473
|
-
if (
|
|
473
|
+
if (J(this, Ge, P(this, Ge) + 1), P(this, Ge) > P(this, an))
|
|
474
474
|
throw console.error("Max attempts reached"), e;
|
|
475
|
-
const n =
|
|
475
|
+
const n = we(this, Jn, As).call(this);
|
|
476
476
|
return yield pi(n), yield this.run();
|
|
477
477
|
}
|
|
478
478
|
});
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
an = /* @__PURE__ */ new WeakMap(),
|
|
482
|
-
return P(this,
|
|
481
|
+
an = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap(), on = /* @__PURE__ */ new WeakMap(), Jn = /* @__PURE__ */ new WeakSet(), As = function() {
|
|
482
|
+
return P(this, Ge) * 1e3 * 1.5;
|
|
483
483
|
};
|
|
484
484
|
function yi() {
|
|
485
485
|
return typeof CompressionStream != "undefined";
|
|
@@ -544,7 +544,7 @@ class ns extends Error {
|
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
|
-
class
|
|
547
|
+
class Et extends Error {
|
|
548
548
|
constructor(e = {}) {
|
|
549
549
|
const { canceled: n = !1 } = e;
|
|
550
550
|
super("Abort Error"), this.name = "Abort Error", this.canceled = n;
|
|
@@ -570,10 +570,10 @@ function Xn() {
|
|
|
570
570
|
return Math.floor(Date.now() / 1e3).toString();
|
|
571
571
|
}
|
|
572
572
|
const wi = 5 * 60 * 1e3, ki = 1 * 1e3;
|
|
573
|
-
var
|
|
574
|
-
class
|
|
573
|
+
var Je, re, _e, Yn, Qn, St;
|
|
574
|
+
class Ei {
|
|
575
575
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: n }) {
|
|
576
|
-
|
|
576
|
+
he(this, _e), he(this, Je), he(this, re), this.baseAddress = n, J(this, Je, e), J(this, re, {}), this.plugins = [];
|
|
577
577
|
}
|
|
578
578
|
get headers() {
|
|
579
579
|
throw new Error("Missing implementation");
|
|
@@ -585,49 +585,49 @@ class Si {
|
|
|
585
585
|
this.plugins = this.plugins.filter((n) => n.name !== e);
|
|
586
586
|
}
|
|
587
587
|
withOptions(e = {}) {
|
|
588
|
-
return
|
|
588
|
+
return J(this, re, e), this;
|
|
589
589
|
}
|
|
590
590
|
get(e) {
|
|
591
591
|
return B(this, arguments, function* (n, r = {}) {
|
|
592
592
|
const { overrideBaseAddress: s, overrideDefaultHeaders: a } = r, i = s != null ? s : this.baseAddress;
|
|
593
593
|
let o = a != null ? a : this.headers;
|
|
594
594
|
const c = kt(P(this, re));
|
|
595
|
-
return
|
|
595
|
+
return J(this, re, {}), c.extraHeaders && (o = ie(ie({}, o), c.extraHeaders)), c.requestValidation && (o = Tr(ie({}, o), { "X-Request-Nonce": Cs(), "X-Request-Timestamp": Xn() })), c.async ? yield we(this, _e, Qn).call(this, `${i}${n}`, c.async, { headers: o }) : yield we(this, _e, Yn).call(this, `${i}${n}`, c, { headers: o });
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
598
|
post(e, n) {
|
|
599
599
|
return B(this, arguments, function* (r, s, a = {}) {
|
|
600
600
|
const i = kt(P(this, re));
|
|
601
|
-
return
|
|
601
|
+
return J(this, re, {}), we(this, _e, St).call(this, r, "POST", s, a, i);
|
|
602
602
|
});
|
|
603
603
|
}
|
|
604
604
|
put(e, n) {
|
|
605
605
|
return B(this, arguments, function* (r, s, a = {}) {
|
|
606
606
|
const i = kt(P(this, re));
|
|
607
|
-
return
|
|
607
|
+
return J(this, re, {}), we(this, _e, St).call(this, r, "PUT", s, a, i);
|
|
608
608
|
});
|
|
609
609
|
}
|
|
610
610
|
delete(e, n) {
|
|
611
611
|
return B(this, arguments, function* (r, s, a = {}) {
|
|
612
612
|
const i = kt(P(this, re));
|
|
613
|
-
return
|
|
613
|
+
return J(this, re, {}), we(this, _e, St).call(this, r, "DELETE", s, a, i);
|
|
614
614
|
});
|
|
615
615
|
}
|
|
616
616
|
patch(e, n) {
|
|
617
617
|
return B(this, arguments, function* (r, s, a = {}) {
|
|
618
618
|
const i = kt(P(this, re));
|
|
619
|
-
return
|
|
619
|
+
return J(this, re, {}), we(this, _e, St).call(this, r, "PATCH", s, a, i);
|
|
620
620
|
});
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
|
-
|
|
623
|
+
Je = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), _e = /* @__PURE__ */ new WeakSet(), Yn = function(t, e, n) {
|
|
624
624
|
return B(this, null, function* () {
|
|
625
625
|
const r = () => B(this, null, function* () {
|
|
626
626
|
var c, u;
|
|
627
627
|
try {
|
|
628
|
-
return yield P(this,
|
|
628
|
+
return yield P(this, Je).call(this, t, ie(ie({}, n), e.abortSignal && { signal: e.abortSignal }));
|
|
629
629
|
} catch (h) {
|
|
630
|
-
throw h instanceof Error && h.name === "AbortError" ? new
|
|
630
|
+
throw h instanceof Error && h.name === "AbortError" ? new Et({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : h;
|
|
631
631
|
}
|
|
632
632
|
}), { headers: s } = n != null ? n : {}, a = (c, u) => {
|
|
633
633
|
var h, p;
|
|
@@ -685,9 +685,9 @@ Ge = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), ve = /*
|
|
|
685
685
|
} = e, u = `${t}/async`, h = `${t}/async/job`;
|
|
686
686
|
let p;
|
|
687
687
|
try {
|
|
688
|
-
p = yield P(this,
|
|
688
|
+
p = yield P(this, Je).call(this, u, ie(ie({}, n), i && { signal: i }));
|
|
689
689
|
} catch (b) {
|
|
690
|
-
throw b instanceof Error && b.name === "AbortError" ? new
|
|
690
|
+
throw b instanceof Error && b.name === "AbortError" ? new Et({ canceled: (r = i == null ? void 0 : i.aborted) != null ? r : !1 }) : b;
|
|
691
691
|
}
|
|
692
692
|
if (!p.ok) {
|
|
693
693
|
const b = yield p.text().catch();
|
|
@@ -708,15 +708,15 @@ Ge = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), ve = /*
|
|
|
708
708
|
m(new Error("Job timed out"));
|
|
709
709
|
}, c), l = (O = 0) => B(this, null, function* () {
|
|
710
710
|
if (i != null && i.aborted) {
|
|
711
|
-
clearTimeout(g), P(this,
|
|
712
|
-
m(new
|
|
711
|
+
clearTimeout(g), P(this, Je).call(this, `${h}/${v}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
712
|
+
m(new Et({ canceled: !0 }));
|
|
713
713
|
}).catch((I) => {
|
|
714
|
-
m(new
|
|
714
|
+
m(new Et({ canceled: !1 }));
|
|
715
715
|
});
|
|
716
716
|
return;
|
|
717
717
|
}
|
|
718
718
|
try {
|
|
719
|
-
const I = yield (yield P(this,
|
|
719
|
+
const I = yield (yield P(this, Je).call(this, `${h}/${v}`, { headers: this.headers })).json();
|
|
720
720
|
if (I.status === "success") {
|
|
721
721
|
clearTimeout(g);
|
|
722
722
|
const K = I.response_json;
|
|
@@ -735,20 +735,20 @@ Ge = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), ve = /*
|
|
|
735
735
|
l();
|
|
736
736
|
}));
|
|
737
737
|
});
|
|
738
|
-
},
|
|
738
|
+
}, St = function(t, e, n, r, s) {
|
|
739
739
|
return B(this, null, function* () {
|
|
740
740
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = r, o = a != null ? a : this.baseAddress;
|
|
741
741
|
let c = i != null ? i : this.headers;
|
|
742
742
|
s.extraHeaders && (c = ie(ie({}, c), s.extraHeaders)), s.requestValidation && (c = Tr(ie({}, c), { "X-Request-Nonce": Cs(), "X-Request-Timestamp": Xn() }));
|
|
743
743
|
let u = n;
|
|
744
|
-
return typeof FormData != "undefined" && n instanceof FormData ? delete c["Content-Type"] : (u = r.skipBodyJsonStringify ? n : JSON.stringify(n), s.compress && yi() && (c["Content-Encoding"] = "gzip", u = yield gi(u))), s.async ? yield
|
|
744
|
+
return typeof FormData != "undefined" && n instanceof FormData ? delete c["Content-Type"] : (u = r.skipBodyJsonStringify ? n : JSON.stringify(n), s.compress && yi() && (c["Content-Encoding"] = "gzip", u = yield gi(u))), s.async ? yield we(this, _e, Qn).call(this, `${o}${t}`, s.async, {
|
|
745
745
|
method: e,
|
|
746
746
|
headers: c,
|
|
747
747
|
body: u
|
|
748
|
-
}) : yield
|
|
748
|
+
}) : yield we(this, _e, Yn).call(this, `${o}${t}`, s, { method: e, headers: c, body: u });
|
|
749
749
|
});
|
|
750
750
|
};
|
|
751
|
-
const rs = (t, e, n, r) => t instanceof
|
|
751
|
+
const rs = (t, e, n, r) => t instanceof Et ? t : new _i({ resource: e, api: String(n), args: r, cause: t }), In = (t, e) => new Proxy(e, {
|
|
752
752
|
get(n, r) {
|
|
753
753
|
return (...s) => {
|
|
754
754
|
var a;
|
|
@@ -769,36 +769,36 @@ const rs = (t, e, n, r) => t instanceof St ? t : new _i({ resource: e, api: Stri
|
|
|
769
769
|
};
|
|
770
770
|
}
|
|
771
771
|
});
|
|
772
|
-
var
|
|
773
|
-
class
|
|
772
|
+
var xt;
|
|
773
|
+
class Si {
|
|
774
774
|
constructor(e) {
|
|
775
|
-
|
|
775
|
+
he(this, xt), this.resourceName = "Files", J(this, xt, e);
|
|
776
776
|
}
|
|
777
777
|
get(e) {
|
|
778
778
|
return B(this, arguments, function* ({ fileKey: n, params: r = {} }) {
|
|
779
779
|
const s = new URLSearchParams(ie({
|
|
780
780
|
plugin_data: "857346721138427857"
|
|
781
781
|
}, r)).toString(), a = `v1/files/${n}?${s}`;
|
|
782
|
-
return yield P(this,
|
|
782
|
+
return yield P(this, xt).get(a);
|
|
783
783
|
});
|
|
784
784
|
}
|
|
785
785
|
getImageFills(e) {
|
|
786
786
|
return B(this, arguments, function* ({ fileKey: n }) {
|
|
787
787
|
var r, s;
|
|
788
788
|
const a = `v1/files/${n}/images`;
|
|
789
|
-
return (s = (r = (yield P(this,
|
|
789
|
+
return (s = (r = (yield P(this, xt).get(a)).meta) == null ? void 0 : r.images) != null ? s : {};
|
|
790
790
|
});
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
|
-
|
|
794
|
-
const
|
|
793
|
+
xt = /* @__PURE__ */ new WeakMap();
|
|
794
|
+
const xi = (t, e, n) => {
|
|
795
795
|
const r = e.sort();
|
|
796
796
|
return `${t}-${r.join("-")}-${n}`;
|
|
797
797
|
}, Oi = (t) => t ? t.ts > Date.now() - 1e3 * 30 : !1;
|
|
798
|
-
var
|
|
798
|
+
var be, er, Ns;
|
|
799
799
|
class Ti {
|
|
800
800
|
constructor(e) {
|
|
801
|
-
|
|
801
|
+
he(this, er), he(this, be), this.resourceName = "Images", J(this, be, e);
|
|
802
802
|
}
|
|
803
803
|
/**
|
|
804
804
|
* Return the URL for the _layer_ images for the given nodes.
|
|
@@ -806,29 +806,29 @@ class Ti {
|
|
|
806
806
|
*/
|
|
807
807
|
get(e) {
|
|
808
808
|
return B(this, arguments, function* ({ fileKey: n, nodeIds: r, format: s = "jpg", scale: a }) {
|
|
809
|
-
const i =
|
|
809
|
+
const i = xi(n, r, s), o = P(this, be).cache.images.entries.get(i);
|
|
810
810
|
if (Oi(o))
|
|
811
811
|
return o.result;
|
|
812
|
-
o && P(this,
|
|
813
|
-
const c = P(this,
|
|
812
|
+
o && P(this, be).cache.images.entries.delete(i);
|
|
813
|
+
const c = P(this, be).cache.images.pendingRequests.get(i);
|
|
814
814
|
if (c)
|
|
815
815
|
return c;
|
|
816
|
-
const u =
|
|
817
|
-
P(this,
|
|
816
|
+
const u = we(this, er, Ns).call(this, i, n, r, s, a);
|
|
817
|
+
P(this, be).cache.images.pendingRequests.set(i, u);
|
|
818
818
|
try {
|
|
819
819
|
return yield u;
|
|
820
820
|
} finally {
|
|
821
|
-
P(this,
|
|
821
|
+
P(this, be).cache.images.pendingRequests.delete(i);
|
|
822
822
|
}
|
|
823
823
|
});
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
|
-
|
|
826
|
+
be = /* @__PURE__ */ new WeakMap(), er = /* @__PURE__ */ new WeakSet(), Ns = function(t, e, n, r, s) {
|
|
827
827
|
return B(this, null, function* () {
|
|
828
|
-
const a = yield P(this,
|
|
828
|
+
const a = yield P(this, be).get(
|
|
829
829
|
`v1/images/${e}?ids=${n}&format=${r}${s ? `&scale=${s}` : ""}`
|
|
830
830
|
);
|
|
831
|
-
return P(this,
|
|
831
|
+
return P(this, be).cache.images.entries.set(t, {
|
|
832
832
|
result: a,
|
|
833
833
|
ts: Date.now()
|
|
834
834
|
}), a;
|
|
@@ -837,7 +837,7 @@ _e = /* @__PURE__ */ new WeakMap(), er = /* @__PURE__ */ new WeakSet(), Ns = fun
|
|
|
837
837
|
var cn;
|
|
838
838
|
class Ai {
|
|
839
839
|
constructor(e) {
|
|
840
|
-
|
|
840
|
+
he(this, cn), this.resourceName = "Nodes", J(this, cn, e);
|
|
841
841
|
}
|
|
842
842
|
get(e) {
|
|
843
843
|
return B(this, arguments, function* ({ fileKey: n, nodeIds: r, params: s = {} }) {
|
|
@@ -851,35 +851,35 @@ class Ai {
|
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
853
|
cn = /* @__PURE__ */ new WeakMap();
|
|
854
|
-
var
|
|
855
|
-
class Ci extends
|
|
854
|
+
var De;
|
|
855
|
+
class Ci extends Ei {
|
|
856
856
|
constructor({
|
|
857
857
|
baseAddress: e = "https://api.figma.com/",
|
|
858
858
|
fetch: n = globalThis.fetch.bind(globalThis)
|
|
859
859
|
} = {}) {
|
|
860
|
-
super({ fetch: n, baseAddress: e }),
|
|
860
|
+
super({ fetch: n, baseAddress: e }), he(this, De, ""), this.cache = {
|
|
861
861
|
images: {
|
|
862
862
|
entries: /* @__PURE__ */ new Map(),
|
|
863
863
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
864
864
|
}
|
|
865
|
-
}, this.files = In(this, new
|
|
865
|
+
}, this.files = In(this, new Si(this)), this.nodes = In(this, new Ai(this)), this.images = In(this, new Ti(this));
|
|
866
866
|
}
|
|
867
867
|
set token(e) {
|
|
868
868
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
869
869
|
throw new Error("Invalid Figma access token");
|
|
870
|
-
|
|
870
|
+
J(this, De, e);
|
|
871
871
|
}
|
|
872
872
|
get token() {
|
|
873
|
-
return P(this,
|
|
873
|
+
return P(this, De);
|
|
874
874
|
}
|
|
875
875
|
get headers() {
|
|
876
876
|
const e = {
|
|
877
877
|
"Content-Type": "application/json"
|
|
878
878
|
};
|
|
879
|
-
return P(this,
|
|
879
|
+
return P(this, De).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = P(this, De) : P(this, De).startsWith("figu_") && (e.Authorization = `Bearer ${P(this, De)}`), e;
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
|
-
|
|
882
|
+
De = /* @__PURE__ */ new WeakMap();
|
|
883
883
|
const Ni = (t) => Se(void 0, [t], function* ({
|
|
884
884
|
fileKey: e,
|
|
885
885
|
authToken: n,
|
|
@@ -960,7 +960,7 @@ const _ = N.arrayToEnum([
|
|
|
960
960
|
"never",
|
|
961
961
|
"map",
|
|
962
962
|
"set"
|
|
963
|
-
]),
|
|
963
|
+
]), je = (t) => {
|
|
964
964
|
switch (typeof t) {
|
|
965
965
|
case "undefined":
|
|
966
966
|
return _.undefined;
|
|
@@ -1123,11 +1123,11 @@ function ln() {
|
|
|
1123
1123
|
return Rs;
|
|
1124
1124
|
}
|
|
1125
1125
|
const fn = (t) => {
|
|
1126
|
-
const { data: e, path: n, errorMaps: r, issueData: s } = t, a = [...n, ...s.path || []], i =
|
|
1126
|
+
const { data: e, path: n, errorMaps: r, issueData: s } = t, a = [...n, ...s.path || []], i = S(d({}, s), {
|
|
1127
1127
|
path: a
|
|
1128
1128
|
});
|
|
1129
1129
|
if (s.message !== void 0)
|
|
1130
|
-
return
|
|
1130
|
+
return S(d({}, s), {
|
|
1131
1131
|
path: a,
|
|
1132
1132
|
message: s.message
|
|
1133
1133
|
});
|
|
@@ -1135,7 +1135,7 @@ const fn = (t) => {
|
|
|
1135
1135
|
const c = r.filter((u) => !!u).slice().reverse();
|
|
1136
1136
|
for (const u of c)
|
|
1137
1137
|
o = u(i, { data: e, defaultError: o }).message;
|
|
1138
|
-
return
|
|
1138
|
+
return S(d({}, s), {
|
|
1139
1139
|
path: a,
|
|
1140
1140
|
message: o
|
|
1141
1141
|
});
|
|
@@ -1158,7 +1158,7 @@ function y(t, e) {
|
|
|
1158
1158
|
});
|
|
1159
1159
|
t.common.issues.push(r);
|
|
1160
1160
|
}
|
|
1161
|
-
class
|
|
1161
|
+
class X {
|
|
1162
1162
|
constructor() {
|
|
1163
1163
|
this.value = "valid";
|
|
1164
1164
|
}
|
|
@@ -1172,7 +1172,7 @@ class Y {
|
|
|
1172
1172
|
const r = [];
|
|
1173
1173
|
for (const s of n) {
|
|
1174
1174
|
if (s.status === "aborted")
|
|
1175
|
-
return
|
|
1175
|
+
return x;
|
|
1176
1176
|
s.status === "dirty" && e.dirty(), r.push(s.value);
|
|
1177
1177
|
}
|
|
1178
1178
|
return { status: e.value, value: r };
|
|
@@ -1187,7 +1187,7 @@ class Y {
|
|
|
1187
1187
|
value: i
|
|
1188
1188
|
});
|
|
1189
1189
|
}
|
|
1190
|
-
return
|
|
1190
|
+
return X.mergeObjectSync(e, r);
|
|
1191
1191
|
});
|
|
1192
1192
|
}
|
|
1193
1193
|
static mergeObjectSync(e, n) {
|
|
@@ -1195,15 +1195,15 @@ class Y {
|
|
|
1195
1195
|
for (const s of n) {
|
|
1196
1196
|
const { key: a, value: i } = s;
|
|
1197
1197
|
if (a.status === "aborted" || i.status === "aborted")
|
|
1198
|
-
return
|
|
1198
|
+
return x;
|
|
1199
1199
|
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value != "undefined" || s.alwaysSet) && (r[a.value] = i.value);
|
|
1200
1200
|
}
|
|
1201
1201
|
return { status: e.value, value: r };
|
|
1202
1202
|
}
|
|
1203
1203
|
}
|
|
1204
|
-
const
|
|
1204
|
+
const x = Object.freeze({
|
|
1205
1205
|
status: "aborted"
|
|
1206
|
-
}), hn = (t) => ({ status: "dirty", value: t }),
|
|
1206
|
+
}), hn = (t) => ({ status: "dirty", value: t }), te = (t) => ({ status: "valid", value: t }), nr = (t) => t.status === "aborted", rr = (t) => t.status === "dirty", Qe = (t) => t.status === "valid", jt = (t) => typeof Promise != "undefined" && t instanceof Promise;
|
|
1207
1207
|
function pn(t, e, n, r) {
|
|
1208
1208
|
if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1209
1209
|
return e.get(t);
|
|
@@ -1226,7 +1226,7 @@ class xe {
|
|
|
1226
1226
|
}
|
|
1227
1227
|
}
|
|
1228
1228
|
const ss = (t, e) => {
|
|
1229
|
-
if (
|
|
1229
|
+
if (Qe(e))
|
|
1230
1230
|
return { success: !0, data: e.value };
|
|
1231
1231
|
if (!t.common.issues.length)
|
|
1232
1232
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -1257,13 +1257,13 @@ class A {
|
|
|
1257
1257
|
return this._def.description;
|
|
1258
1258
|
}
|
|
1259
1259
|
_getType(e) {
|
|
1260
|
-
return
|
|
1260
|
+
return je(e.data);
|
|
1261
1261
|
}
|
|
1262
1262
|
_getOrReturnCtx(e, n) {
|
|
1263
1263
|
return n || {
|
|
1264
1264
|
common: e.parent.common,
|
|
1265
1265
|
data: e.data,
|
|
1266
|
-
parsedType:
|
|
1266
|
+
parsedType: je(e.data),
|
|
1267
1267
|
schemaErrorMap: this._def.errorMap,
|
|
1268
1268
|
path: e.path,
|
|
1269
1269
|
parent: e.parent
|
|
@@ -1271,11 +1271,11 @@ class A {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
_processInputParams(e) {
|
|
1273
1273
|
return {
|
|
1274
|
-
status: new
|
|
1274
|
+
status: new X(),
|
|
1275
1275
|
ctx: {
|
|
1276
1276
|
common: e.parent.common,
|
|
1277
1277
|
data: e.data,
|
|
1278
|
-
parsedType:
|
|
1278
|
+
parsedType: je(e.data),
|
|
1279
1279
|
schemaErrorMap: this._def.errorMap,
|
|
1280
1280
|
path: e.path,
|
|
1281
1281
|
parent: e.parent
|
|
@@ -1310,7 +1310,7 @@ class A {
|
|
|
1310
1310
|
schemaErrorMap: this._def.errorMap,
|
|
1311
1311
|
parent: null,
|
|
1312
1312
|
data: e,
|
|
1313
|
-
parsedType:
|
|
1313
|
+
parsedType: je(e)
|
|
1314
1314
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
1315
1315
|
return ss(s, a);
|
|
1316
1316
|
}
|
|
@@ -1325,12 +1325,12 @@ class A {
|
|
|
1325
1325
|
schemaErrorMap: this._def.errorMap,
|
|
1326
1326
|
parent: null,
|
|
1327
1327
|
data: e,
|
|
1328
|
-
parsedType:
|
|
1328
|
+
parsedType: je(e)
|
|
1329
1329
|
};
|
|
1330
1330
|
if (!this["~standard"].async)
|
|
1331
1331
|
try {
|
|
1332
1332
|
const a = this._parseSync({ data: e, path: [], parent: s });
|
|
1333
|
-
return
|
|
1333
|
+
return Qe(a) ? {
|
|
1334
1334
|
value: a.value
|
|
1335
1335
|
} : {
|
|
1336
1336
|
issues: s.common.issues
|
|
@@ -1341,7 +1341,7 @@ class A {
|
|
|
1341
1341
|
async: !0
|
|
1342
1342
|
};
|
|
1343
1343
|
}
|
|
1344
|
-
return this._parseAsync({ data: e, path: [], parent: s }).then((a) =>
|
|
1344
|
+
return this._parseAsync({ data: e, path: [], parent: s }).then((a) => Qe(a) ? {
|
|
1345
1345
|
value: a.value
|
|
1346
1346
|
} : {
|
|
1347
1347
|
issues: s.common.issues
|
|
@@ -1367,7 +1367,7 @@ class A {
|
|
|
1367
1367
|
schemaErrorMap: this._def.errorMap,
|
|
1368
1368
|
parent: null,
|
|
1369
1369
|
data: e,
|
|
1370
|
-
parsedType:
|
|
1370
|
+
parsedType: je(e)
|
|
1371
1371
|
}, s = this._parse({ data: e, path: r.path, parent: r }), a = yield jt(s) ? s : Promise.resolve(s);
|
|
1372
1372
|
return ss(r, a);
|
|
1373
1373
|
});
|
|
@@ -1385,9 +1385,9 @@ class A {
|
|
|
1385
1385
|
return this._refinement((r, s) => e(r) ? !0 : (s.addIssue(typeof n == "function" ? n(r, s) : n), !1));
|
|
1386
1386
|
}
|
|
1387
1387
|
_refinement(e) {
|
|
1388
|
-
return new
|
|
1388
|
+
return new ve({
|
|
1389
1389
|
schema: this,
|
|
1390
|
-
typeName:
|
|
1390
|
+
typeName: E.ZodEffects,
|
|
1391
1391
|
effect: { type: "refinement", refinement: e }
|
|
1392
1392
|
});
|
|
1393
1393
|
}
|
|
@@ -1402,16 +1402,16 @@ class A {
|
|
|
1402
1402
|
};
|
|
1403
1403
|
}
|
|
1404
1404
|
optional() {
|
|
1405
|
-
return
|
|
1405
|
+
return Ee.create(this, this._def);
|
|
1406
1406
|
}
|
|
1407
1407
|
nullable() {
|
|
1408
|
-
return
|
|
1408
|
+
return Ue.create(this, this._def);
|
|
1409
1409
|
}
|
|
1410
1410
|
nullish() {
|
|
1411
1411
|
return this.nullable().optional();
|
|
1412
1412
|
}
|
|
1413
1413
|
array() {
|
|
1414
|
-
return
|
|
1414
|
+
return ge.create(this);
|
|
1415
1415
|
}
|
|
1416
1416
|
promise() {
|
|
1417
1417
|
return vt.create(this, this._def);
|
|
@@ -1423,37 +1423,37 @@ class A {
|
|
|
1423
1423
|
return Mt.create(this, e, this._def);
|
|
1424
1424
|
}
|
|
1425
1425
|
transform(e) {
|
|
1426
|
-
return new
|
|
1426
|
+
return new ve(S(d({}, T(this._def)), {
|
|
1427
1427
|
schema: this,
|
|
1428
|
-
typeName:
|
|
1428
|
+
typeName: E.ZodEffects,
|
|
1429
1429
|
effect: { type: "transform", transform: e }
|
|
1430
1430
|
}));
|
|
1431
1431
|
}
|
|
1432
1432
|
default(e) {
|
|
1433
1433
|
const n = typeof e == "function" ? e : () => e;
|
|
1434
|
-
return new zt(
|
|
1434
|
+
return new zt(S(d({}, T(this._def)), {
|
|
1435
1435
|
innerType: this,
|
|
1436
1436
|
defaultValue: n,
|
|
1437
|
-
typeName:
|
|
1437
|
+
typeName: E.ZodDefault
|
|
1438
1438
|
}));
|
|
1439
1439
|
}
|
|
1440
1440
|
brand() {
|
|
1441
1441
|
return new Nr(d({
|
|
1442
|
-
typeName:
|
|
1442
|
+
typeName: E.ZodBranded,
|
|
1443
1443
|
type: this
|
|
1444
1444
|
}, T(this._def)));
|
|
1445
1445
|
}
|
|
1446
1446
|
catch(e) {
|
|
1447
1447
|
const n = typeof e == "function" ? e : () => e;
|
|
1448
|
-
return new Ut(
|
|
1448
|
+
return new Ut(S(d({}, T(this._def)), {
|
|
1449
1449
|
innerType: this,
|
|
1450
1450
|
catchValue: n,
|
|
1451
|
-
typeName:
|
|
1451
|
+
typeName: E.ZodCatch
|
|
1452
1452
|
}));
|
|
1453
1453
|
}
|
|
1454
1454
|
describe(e) {
|
|
1455
1455
|
const n = this.constructor;
|
|
1456
|
-
return new n(
|
|
1456
|
+
return new n(S(d({}, this._def), {
|
|
1457
1457
|
description: e
|
|
1458
1458
|
}));
|
|
1459
1459
|
}
|
|
@@ -1501,7 +1501,7 @@ function Yi(t, e) {
|
|
|
1501
1501
|
function Qi(t, e) {
|
|
1502
1502
|
return !!((e === "v4" || !e) && Vi.test(t) || (e === "v6" || !e) && Bi.test(t));
|
|
1503
1503
|
}
|
|
1504
|
-
class
|
|
1504
|
+
class ye extends A {
|
|
1505
1505
|
_parse(e) {
|
|
1506
1506
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== _.string) {
|
|
1507
1507
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1509,9 +1509,9 @@ class me extends A {
|
|
|
1509
1509
|
code: f.invalid_type,
|
|
1510
1510
|
expected: _.string,
|
|
1511
1511
|
received: s.parsedType
|
|
1512
|
-
}),
|
|
1512
|
+
}), x;
|
|
1513
1513
|
}
|
|
1514
|
-
const n = new
|
|
1514
|
+
const n = new X();
|
|
1515
1515
|
let r;
|
|
1516
1516
|
for (const s of this._def.checks)
|
|
1517
1517
|
if (s.kind === "min")
|
|
@@ -1663,7 +1663,7 @@ class me extends A {
|
|
|
1663
1663
|
}, w.errToObj(r)));
|
|
1664
1664
|
}
|
|
1665
1665
|
_addCheck(e) {
|
|
1666
|
-
return new
|
|
1666
|
+
return new ye(S(d({}, this._def), {
|
|
1667
1667
|
checks: [...this._def.checks, e]
|
|
1668
1668
|
}));
|
|
1669
1669
|
}
|
|
@@ -1789,17 +1789,17 @@ class me extends A {
|
|
|
1789
1789
|
return this.min(1, w.errToObj(e));
|
|
1790
1790
|
}
|
|
1791
1791
|
trim() {
|
|
1792
|
-
return new
|
|
1792
|
+
return new ye(S(d({}, this._def), {
|
|
1793
1793
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1794
1794
|
}));
|
|
1795
1795
|
}
|
|
1796
1796
|
toLowerCase() {
|
|
1797
|
-
return new
|
|
1797
|
+
return new ye(S(d({}, this._def), {
|
|
1798
1798
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1799
1799
|
}));
|
|
1800
1800
|
}
|
|
1801
1801
|
toUpperCase() {
|
|
1802
|
-
return new
|
|
1802
|
+
return new ye(S(d({}, this._def), {
|
|
1803
1803
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1804
1804
|
}));
|
|
1805
1805
|
}
|
|
@@ -1864,11 +1864,11 @@ class me extends A {
|
|
|
1864
1864
|
return e;
|
|
1865
1865
|
}
|
|
1866
1866
|
}
|
|
1867
|
-
|
|
1867
|
+
ye.create = (t) => {
|
|
1868
1868
|
var e;
|
|
1869
|
-
return new
|
|
1869
|
+
return new ye(d({
|
|
1870
1870
|
checks: [],
|
|
1871
|
-
typeName:
|
|
1871
|
+
typeName: E.ZodString,
|
|
1872
1872
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1
|
|
1873
1873
|
}, T(t)));
|
|
1874
1874
|
};
|
|
@@ -1876,7 +1876,7 @@ function eo(t, e) {
|
|
|
1876
1876
|
const n = (t.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, s = n > r ? n : r, a = parseInt(t.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
|
|
1877
1877
|
return a % i / Math.pow(10, s);
|
|
1878
1878
|
}
|
|
1879
|
-
class
|
|
1879
|
+
class Fe extends A {
|
|
1880
1880
|
constructor() {
|
|
1881
1881
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1882
1882
|
}
|
|
@@ -1887,10 +1887,10 @@ class Le extends A {
|
|
|
1887
1887
|
code: f.invalid_type,
|
|
1888
1888
|
expected: _.number,
|
|
1889
1889
|
received: s.parsedType
|
|
1890
|
-
}),
|
|
1890
|
+
}), x;
|
|
1891
1891
|
}
|
|
1892
1892
|
let n;
|
|
1893
|
-
const r = new
|
|
1893
|
+
const r = new X();
|
|
1894
1894
|
for (const s of this._def.checks)
|
|
1895
1895
|
s.kind === "int" ? N.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
1896
1896
|
code: f.invalid_type,
|
|
@@ -1934,7 +1934,7 @@ class Le extends A {
|
|
|
1934
1934
|
return this.setLimit("max", e, !1, w.toString(n));
|
|
1935
1935
|
}
|
|
1936
1936
|
setLimit(e, n, r, s) {
|
|
1937
|
-
return new
|
|
1937
|
+
return new Fe(S(d({}, this._def), {
|
|
1938
1938
|
checks: [
|
|
1939
1939
|
...this._def.checks,
|
|
1940
1940
|
{
|
|
@@ -1947,7 +1947,7 @@ class Le extends A {
|
|
|
1947
1947
|
}));
|
|
1948
1948
|
}
|
|
1949
1949
|
_addCheck(e) {
|
|
1950
|
-
return new
|
|
1950
|
+
return new Fe(S(d({}, this._def), {
|
|
1951
1951
|
checks: [...this._def.checks, e]
|
|
1952
1952
|
}));
|
|
1953
1953
|
}
|
|
@@ -2040,12 +2040,12 @@ class Le extends A {
|
|
|
2040
2040
|
return Number.isFinite(n) && Number.isFinite(e);
|
|
2041
2041
|
}
|
|
2042
2042
|
}
|
|
2043
|
-
|
|
2043
|
+
Fe.create = (t) => new Fe(d({
|
|
2044
2044
|
checks: [],
|
|
2045
|
-
typeName:
|
|
2045
|
+
typeName: E.ZodNumber,
|
|
2046
2046
|
coerce: (t == null ? void 0 : t.coerce) || !1
|
|
2047
2047
|
}, T(t)));
|
|
2048
|
-
class
|
|
2048
|
+
class We extends A {
|
|
2049
2049
|
constructor() {
|
|
2050
2050
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
2051
2051
|
}
|
|
@@ -2059,7 +2059,7 @@ class $e extends A {
|
|
|
2059
2059
|
if (this._getType(e) !== _.bigint)
|
|
2060
2060
|
return this._getInvalidInput(e);
|
|
2061
2061
|
let n;
|
|
2062
|
-
const r = new
|
|
2062
|
+
const r = new X();
|
|
2063
2063
|
for (const s of this._def.checks)
|
|
2064
2064
|
s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2065
2065
|
code: f.too_small,
|
|
@@ -2086,7 +2086,7 @@ class $e extends A {
|
|
|
2086
2086
|
code: f.invalid_type,
|
|
2087
2087
|
expected: _.bigint,
|
|
2088
2088
|
received: n.parsedType
|
|
2089
|
-
}),
|
|
2089
|
+
}), x;
|
|
2090
2090
|
}
|
|
2091
2091
|
gte(e, n) {
|
|
2092
2092
|
return this.setLimit("min", e, !0, w.toString(n));
|
|
@@ -2101,7 +2101,7 @@ class $e extends A {
|
|
|
2101
2101
|
return this.setLimit("max", e, !1, w.toString(n));
|
|
2102
2102
|
}
|
|
2103
2103
|
setLimit(e, n, r, s) {
|
|
2104
|
-
return new
|
|
2104
|
+
return new We(S(d({}, this._def), {
|
|
2105
2105
|
checks: [
|
|
2106
2106
|
...this._def.checks,
|
|
2107
2107
|
{
|
|
@@ -2114,7 +2114,7 @@ class $e extends A {
|
|
|
2114
2114
|
}));
|
|
2115
2115
|
}
|
|
2116
2116
|
_addCheck(e) {
|
|
2117
|
-
return new
|
|
2117
|
+
return new We(S(d({}, this._def), {
|
|
2118
2118
|
checks: [...this._def.checks, e]
|
|
2119
2119
|
}));
|
|
2120
2120
|
}
|
|
@@ -2170,11 +2170,11 @@ class $e extends A {
|
|
|
2170
2170
|
return e;
|
|
2171
2171
|
}
|
|
2172
2172
|
}
|
|
2173
|
-
|
|
2173
|
+
We.create = (t) => {
|
|
2174
2174
|
var e;
|
|
2175
|
-
return new
|
|
2175
|
+
return new We(d({
|
|
2176
2176
|
checks: [],
|
|
2177
|
-
typeName:
|
|
2177
|
+
typeName: E.ZodBigInt,
|
|
2178
2178
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1
|
|
2179
2179
|
}, T(t)));
|
|
2180
2180
|
};
|
|
@@ -2186,16 +2186,16 @@ class It extends A {
|
|
|
2186
2186
|
code: f.invalid_type,
|
|
2187
2187
|
expected: _.boolean,
|
|
2188
2188
|
received: n.parsedType
|
|
2189
|
-
}),
|
|
2189
|
+
}), x;
|
|
2190
2190
|
}
|
|
2191
|
-
return
|
|
2191
|
+
return te(e.data);
|
|
2192
2192
|
}
|
|
2193
2193
|
}
|
|
2194
2194
|
It.create = (t) => new It(d({
|
|
2195
|
-
typeName:
|
|
2195
|
+
typeName: E.ZodBoolean,
|
|
2196
2196
|
coerce: (t == null ? void 0 : t.coerce) || !1
|
|
2197
2197
|
}, T(t)));
|
|
2198
|
-
class
|
|
2198
|
+
class et extends A {
|
|
2199
2199
|
_parse(e) {
|
|
2200
2200
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== _.date) {
|
|
2201
2201
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2203,15 +2203,15 @@ class Qe extends A {
|
|
|
2203
2203
|
code: f.invalid_type,
|
|
2204
2204
|
expected: _.date,
|
|
2205
2205
|
received: s.parsedType
|
|
2206
|
-
}),
|
|
2206
|
+
}), x;
|
|
2207
2207
|
}
|
|
2208
2208
|
if (isNaN(e.data.getTime())) {
|
|
2209
2209
|
const s = this._getOrReturnCtx(e);
|
|
2210
2210
|
return y(s, {
|
|
2211
2211
|
code: f.invalid_date
|
|
2212
|
-
}),
|
|
2212
|
+
}), x;
|
|
2213
2213
|
}
|
|
2214
|
-
const n = new
|
|
2214
|
+
const n = new X();
|
|
2215
2215
|
let r;
|
|
2216
2216
|
for (const s of this._def.checks)
|
|
2217
2217
|
s.kind === "min" ? e.data.getTime() < s.value && (r = this._getOrReturnCtx(e, r), y(r, {
|
|
@@ -2235,7 +2235,7 @@ class Qe extends A {
|
|
|
2235
2235
|
};
|
|
2236
2236
|
}
|
|
2237
2237
|
_addCheck(e) {
|
|
2238
|
-
return new
|
|
2238
|
+
return new et(S(d({}, this._def), {
|
|
2239
2239
|
checks: [...this._def.checks, e]
|
|
2240
2240
|
}));
|
|
2241
2241
|
}
|
|
@@ -2266,10 +2266,10 @@ class Qe extends A {
|
|
|
2266
2266
|
return e != null ? new Date(e) : null;
|
|
2267
2267
|
}
|
|
2268
2268
|
}
|
|
2269
|
-
|
|
2269
|
+
et.create = (t) => new et(d({
|
|
2270
2270
|
checks: [],
|
|
2271
2271
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
2272
|
-
typeName:
|
|
2272
|
+
typeName: E.ZodDate
|
|
2273
2273
|
}, T(t)));
|
|
2274
2274
|
class mn extends A {
|
|
2275
2275
|
_parse(e) {
|
|
@@ -2279,13 +2279,13 @@ class mn extends A {
|
|
|
2279
2279
|
code: f.invalid_type,
|
|
2280
2280
|
expected: _.symbol,
|
|
2281
2281
|
received: n.parsedType
|
|
2282
|
-
}),
|
|
2282
|
+
}), x;
|
|
2283
2283
|
}
|
|
2284
|
-
return
|
|
2284
|
+
return te(e.data);
|
|
2285
2285
|
}
|
|
2286
2286
|
}
|
|
2287
2287
|
mn.create = (t) => new mn(d({
|
|
2288
|
-
typeName:
|
|
2288
|
+
typeName: E.ZodSymbol
|
|
2289
2289
|
}, T(t)));
|
|
2290
2290
|
class Pt extends A {
|
|
2291
2291
|
_parse(e) {
|
|
@@ -2295,13 +2295,13 @@ class Pt extends A {
|
|
|
2295
2295
|
code: f.invalid_type,
|
|
2296
2296
|
expected: _.undefined,
|
|
2297
2297
|
received: n.parsedType
|
|
2298
|
-
}),
|
|
2298
|
+
}), x;
|
|
2299
2299
|
}
|
|
2300
|
-
return
|
|
2300
|
+
return te(e.data);
|
|
2301
2301
|
}
|
|
2302
2302
|
}
|
|
2303
2303
|
Pt.create = (t) => new Pt(d({
|
|
2304
|
-
typeName:
|
|
2304
|
+
typeName: E.ZodUndefined
|
|
2305
2305
|
}, T(t)));
|
|
2306
2306
|
class Zt extends A {
|
|
2307
2307
|
_parse(e) {
|
|
@@ -2311,48 +2311,48 @@ class Zt extends A {
|
|
|
2311
2311
|
code: f.invalid_type,
|
|
2312
2312
|
expected: _.null,
|
|
2313
2313
|
received: n.parsedType
|
|
2314
|
-
}),
|
|
2314
|
+
}), x;
|
|
2315
2315
|
}
|
|
2316
|
-
return
|
|
2316
|
+
return te(e.data);
|
|
2317
2317
|
}
|
|
2318
2318
|
}
|
|
2319
2319
|
Zt.create = (t) => new Zt(d({
|
|
2320
|
-
typeName:
|
|
2320
|
+
typeName: E.ZodNull
|
|
2321
2321
|
}, T(t)));
|
|
2322
2322
|
class gt extends A {
|
|
2323
2323
|
constructor() {
|
|
2324
2324
|
super(...arguments), this._any = !0;
|
|
2325
2325
|
}
|
|
2326
2326
|
_parse(e) {
|
|
2327
|
-
return
|
|
2327
|
+
return te(e.data);
|
|
2328
2328
|
}
|
|
2329
2329
|
}
|
|
2330
2330
|
gt.create = (t) => new gt(d({
|
|
2331
|
-
typeName:
|
|
2331
|
+
typeName: E.ZodAny
|
|
2332
2332
|
}, T(t)));
|
|
2333
|
-
class
|
|
2333
|
+
class Ye extends A {
|
|
2334
2334
|
constructor() {
|
|
2335
2335
|
super(...arguments), this._unknown = !0;
|
|
2336
2336
|
}
|
|
2337
2337
|
_parse(e) {
|
|
2338
|
-
return
|
|
2338
|
+
return te(e.data);
|
|
2339
2339
|
}
|
|
2340
2340
|
}
|
|
2341
|
-
|
|
2342
|
-
typeName:
|
|
2341
|
+
Ye.create = (t) => new Ye(d({
|
|
2342
|
+
typeName: E.ZodUnknown
|
|
2343
2343
|
}, T(t)));
|
|
2344
|
-
class
|
|
2344
|
+
class Pe extends A {
|
|
2345
2345
|
_parse(e) {
|
|
2346
2346
|
const n = this._getOrReturnCtx(e);
|
|
2347
2347
|
return y(n, {
|
|
2348
2348
|
code: f.invalid_type,
|
|
2349
2349
|
expected: _.never,
|
|
2350
2350
|
received: n.parsedType
|
|
2351
|
-
}),
|
|
2351
|
+
}), x;
|
|
2352
2352
|
}
|
|
2353
2353
|
}
|
|
2354
|
-
|
|
2355
|
-
typeName:
|
|
2354
|
+
Pe.create = (t) => new Pe(d({
|
|
2355
|
+
typeName: E.ZodNever
|
|
2356
2356
|
}, T(t)));
|
|
2357
2357
|
class yn extends A {
|
|
2358
2358
|
_parse(e) {
|
|
@@ -2362,15 +2362,15 @@ class yn extends A {
|
|
|
2362
2362
|
code: f.invalid_type,
|
|
2363
2363
|
expected: _.void,
|
|
2364
2364
|
received: n.parsedType
|
|
2365
|
-
}),
|
|
2365
|
+
}), x;
|
|
2366
2366
|
}
|
|
2367
|
-
return
|
|
2367
|
+
return te(e.data);
|
|
2368
2368
|
}
|
|
2369
2369
|
}
|
|
2370
2370
|
yn.create = (t) => new yn(d({
|
|
2371
|
-
typeName:
|
|
2371
|
+
typeName: E.ZodVoid
|
|
2372
2372
|
}, T(t)));
|
|
2373
|
-
class
|
|
2373
|
+
class ge extends A {
|
|
2374
2374
|
_parse(e) {
|
|
2375
2375
|
const { ctx: n, status: r } = this._processInputParams(e), s = this._def;
|
|
2376
2376
|
if (n.parsedType !== _.array)
|
|
@@ -2378,7 +2378,7 @@ class ye extends A {
|
|
|
2378
2378
|
code: f.invalid_type,
|
|
2379
2379
|
expected: _.array,
|
|
2380
2380
|
received: n.parsedType
|
|
2381
|
-
}),
|
|
2381
|
+
}), x;
|
|
2382
2382
|
if (s.exactLength !== null) {
|
|
2383
2383
|
const i = n.data.length > s.exactLength.value, o = n.data.length < s.exactLength.value;
|
|
2384
2384
|
(i || o) && (y(n, {
|
|
@@ -2406,25 +2406,25 @@ class ye extends A {
|
|
|
2406
2406
|
exact: !1,
|
|
2407
2407
|
message: s.maxLength.message
|
|
2408
2408
|
}), r.dirty()), n.common.async)
|
|
2409
|
-
return Promise.all([...n.data].map((i, o) => s.type._parseAsync(new xe(n, i, n.path, o)))).then((i) =>
|
|
2409
|
+
return Promise.all([...n.data].map((i, o) => s.type._parseAsync(new xe(n, i, n.path, o)))).then((i) => X.mergeArray(r, i));
|
|
2410
2410
|
const a = [...n.data].map((i, o) => s.type._parseSync(new xe(n, i, n.path, o)));
|
|
2411
|
-
return
|
|
2411
|
+
return X.mergeArray(r, a);
|
|
2412
2412
|
}
|
|
2413
2413
|
get element() {
|
|
2414
2414
|
return this._def.type;
|
|
2415
2415
|
}
|
|
2416
2416
|
min(e, n) {
|
|
2417
|
-
return new
|
|
2417
|
+
return new ge(S(d({}, this._def), {
|
|
2418
2418
|
minLength: { value: e, message: w.toString(n) }
|
|
2419
2419
|
}));
|
|
2420
2420
|
}
|
|
2421
2421
|
max(e, n) {
|
|
2422
|
-
return new
|
|
2422
|
+
return new ge(S(d({}, this._def), {
|
|
2423
2423
|
maxLength: { value: e, message: w.toString(n) }
|
|
2424
2424
|
}));
|
|
2425
2425
|
}
|
|
2426
2426
|
length(e, n) {
|
|
2427
|
-
return new
|
|
2427
|
+
return new ge(S(d({}, this._def), {
|
|
2428
2428
|
exactLength: { value: e, message: w.toString(n) }
|
|
2429
2429
|
}));
|
|
2430
2430
|
}
|
|
@@ -2432,26 +2432,26 @@ class ye extends A {
|
|
|
2432
2432
|
return this.min(1, e);
|
|
2433
2433
|
}
|
|
2434
2434
|
}
|
|
2435
|
-
|
|
2435
|
+
ge.create = (t, e) => new ge(d({
|
|
2436
2436
|
type: t,
|
|
2437
2437
|
minLength: null,
|
|
2438
2438
|
maxLength: null,
|
|
2439
2439
|
exactLength: null,
|
|
2440
|
-
typeName:
|
|
2440
|
+
typeName: E.ZodArray
|
|
2441
2441
|
}, T(e)));
|
|
2442
2442
|
function ct(t) {
|
|
2443
2443
|
if (t instanceof z) {
|
|
2444
2444
|
const e = {};
|
|
2445
2445
|
for (const n in t.shape) {
|
|
2446
2446
|
const r = t.shape[n];
|
|
2447
|
-
e[n] =
|
|
2447
|
+
e[n] = Ee.create(ct(r));
|
|
2448
2448
|
}
|
|
2449
|
-
return new z(
|
|
2449
|
+
return new z(S(d({}, t._def), {
|
|
2450
2450
|
shape: () => e
|
|
2451
2451
|
}));
|
|
2452
|
-
} else return t instanceof
|
|
2452
|
+
} else return t instanceof ge ? new ge(S(d({}, t._def), {
|
|
2453
2453
|
type: ct(t.element)
|
|
2454
|
-
})) : t instanceof
|
|
2454
|
+
})) : t instanceof Ee ? Ee.create(ct(t.unwrap())) : t instanceof Ue ? Ue.create(ct(t.unwrap())) : t instanceof Oe ? Oe.create(t.items.map((e) => ct(e))) : t;
|
|
2455
2455
|
}
|
|
2456
2456
|
class z extends A {
|
|
2457
2457
|
constructor() {
|
|
@@ -2470,10 +2470,10 @@ class z extends A {
|
|
|
2470
2470
|
code: f.invalid_type,
|
|
2471
2471
|
expected: _.object,
|
|
2472
2472
|
received: c.parsedType
|
|
2473
|
-
}),
|
|
2473
|
+
}), x;
|
|
2474
2474
|
}
|
|
2475
2475
|
const { status: n, ctx: r } = this._processInputParams(e), { shape: s, keys: a } = this._getCached(), i = [];
|
|
2476
|
-
if (!(this._def.catchall instanceof
|
|
2476
|
+
if (!(this._def.catchall instanceof Pe && this._def.unknownKeys === "strip"))
|
|
2477
2477
|
for (const c in r.data)
|
|
2478
2478
|
a.includes(c) || i.push(c);
|
|
2479
2479
|
const o = [];
|
|
@@ -2485,7 +2485,7 @@ class z extends A {
|
|
|
2485
2485
|
alwaysSet: c in r.data
|
|
2486
2486
|
});
|
|
2487
2487
|
}
|
|
2488
|
-
if (this._def.catchall instanceof
|
|
2488
|
+
if (this._def.catchall instanceof Pe) {
|
|
2489
2489
|
const c = this._def.unknownKeys;
|
|
2490
2490
|
if (c === "passthrough")
|
|
2491
2491
|
for (const u of i)
|
|
@@ -2524,13 +2524,13 @@ class z extends A {
|
|
|
2524
2524
|
});
|
|
2525
2525
|
}
|
|
2526
2526
|
return c;
|
|
2527
|
-
})).then((c) =>
|
|
2527
|
+
})).then((c) => X.mergeObjectSync(n, c)) : X.mergeObjectSync(n, o);
|
|
2528
2528
|
}
|
|
2529
2529
|
get shape() {
|
|
2530
2530
|
return this._def.shape();
|
|
2531
2531
|
}
|
|
2532
2532
|
strict(e) {
|
|
2533
|
-
return w.errToObj, new z(d(
|
|
2533
|
+
return w.errToObj, new z(d(S(d({}, this._def), {
|
|
2534
2534
|
unknownKeys: "strict"
|
|
2535
2535
|
}), e !== void 0 ? {
|
|
2536
2536
|
errorMap: (n, r) => {
|
|
@@ -2545,12 +2545,12 @@ class z extends A {
|
|
|
2545
2545
|
} : {}));
|
|
2546
2546
|
}
|
|
2547
2547
|
strip() {
|
|
2548
|
-
return new z(
|
|
2548
|
+
return new z(S(d({}, this._def), {
|
|
2549
2549
|
unknownKeys: "strip"
|
|
2550
2550
|
}));
|
|
2551
2551
|
}
|
|
2552
2552
|
passthrough() {
|
|
2553
|
-
return new z(
|
|
2553
|
+
return new z(S(d({}, this._def), {
|
|
2554
2554
|
unknownKeys: "passthrough"
|
|
2555
2555
|
}));
|
|
2556
2556
|
}
|
|
@@ -2572,7 +2572,7 @@ class z extends A {
|
|
|
2572
2572
|
// }) as any;
|
|
2573
2573
|
// };
|
|
2574
2574
|
extend(e) {
|
|
2575
|
-
return new z(
|
|
2575
|
+
return new z(S(d({}, this._def), {
|
|
2576
2576
|
shape: () => d(d({}, this._def.shape()), e)
|
|
2577
2577
|
}));
|
|
2578
2578
|
}
|
|
@@ -2586,7 +2586,7 @@ class z extends A {
|
|
|
2586
2586
|
unknownKeys: e._def.unknownKeys,
|
|
2587
2587
|
catchall: e._def.catchall,
|
|
2588
2588
|
shape: () => d(d({}, this._def.shape()), e._def.shape()),
|
|
2589
|
-
typeName:
|
|
2589
|
+
typeName: E.ZodObject
|
|
2590
2590
|
});
|
|
2591
2591
|
}
|
|
2592
2592
|
// merge<
|
|
@@ -2649,7 +2649,7 @@ class z extends A {
|
|
|
2649
2649
|
// return merged;
|
|
2650
2650
|
// }
|
|
2651
2651
|
catchall(e) {
|
|
2652
|
-
return new z(
|
|
2652
|
+
return new z(S(d({}, this._def), {
|
|
2653
2653
|
catchall: e
|
|
2654
2654
|
}));
|
|
2655
2655
|
}
|
|
@@ -2657,7 +2657,7 @@ class z extends A {
|
|
|
2657
2657
|
const n = {};
|
|
2658
2658
|
return N.objectKeys(e).forEach((r) => {
|
|
2659
2659
|
e[r] && this.shape[r] && (n[r] = this.shape[r]);
|
|
2660
|
-
}), new z(
|
|
2660
|
+
}), new z(S(d({}, this._def), {
|
|
2661
2661
|
shape: () => n
|
|
2662
2662
|
}));
|
|
2663
2663
|
}
|
|
@@ -2665,7 +2665,7 @@ class z extends A {
|
|
|
2665
2665
|
const n = {};
|
|
2666
2666
|
return N.objectKeys(this.shape).forEach((r) => {
|
|
2667
2667
|
e[r] || (n[r] = this.shape[r]);
|
|
2668
|
-
}), new z(
|
|
2668
|
+
}), new z(S(d({}, this._def), {
|
|
2669
2669
|
shape: () => n
|
|
2670
2670
|
}));
|
|
2671
2671
|
}
|
|
@@ -2680,7 +2680,7 @@ class z extends A {
|
|
|
2680
2680
|
return N.objectKeys(this.shape).forEach((r) => {
|
|
2681
2681
|
const s = this.shape[r];
|
|
2682
2682
|
e && !e[r] ? n[r] = s : n[r] = s.optional();
|
|
2683
|
-
}), new z(
|
|
2683
|
+
}), new z(S(d({}, this._def), {
|
|
2684
2684
|
shape: () => n
|
|
2685
2685
|
}));
|
|
2686
2686
|
}
|
|
@@ -2691,11 +2691,11 @@ class z extends A {
|
|
|
2691
2691
|
n[r] = this.shape[r];
|
|
2692
2692
|
else {
|
|
2693
2693
|
let s = this.shape[r];
|
|
2694
|
-
for (; s instanceof
|
|
2694
|
+
for (; s instanceof Ee; )
|
|
2695
2695
|
s = s._def.innerType;
|
|
2696
2696
|
n[r] = s;
|
|
2697
2697
|
}
|
|
2698
|
-
}), new z(
|
|
2698
|
+
}), new z(S(d({}, this._def), {
|
|
2699
2699
|
shape: () => n
|
|
2700
2700
|
}));
|
|
2701
2701
|
}
|
|
@@ -2706,20 +2706,20 @@ class z extends A {
|
|
|
2706
2706
|
z.create = (t, e) => new z(d({
|
|
2707
2707
|
shape: () => t,
|
|
2708
2708
|
unknownKeys: "strip",
|
|
2709
|
-
catchall:
|
|
2710
|
-
typeName:
|
|
2709
|
+
catchall: Pe.create(),
|
|
2710
|
+
typeName: E.ZodObject
|
|
2711
2711
|
}, T(e)));
|
|
2712
2712
|
z.strictCreate = (t, e) => new z(d({
|
|
2713
2713
|
shape: () => t,
|
|
2714
2714
|
unknownKeys: "strict",
|
|
2715
|
-
catchall:
|
|
2716
|
-
typeName:
|
|
2715
|
+
catchall: Pe.create(),
|
|
2716
|
+
typeName: E.ZodObject
|
|
2717
2717
|
}, T(e)));
|
|
2718
2718
|
z.lazycreate = (t, e) => new z(d({
|
|
2719
2719
|
shape: t,
|
|
2720
2720
|
unknownKeys: "strip",
|
|
2721
|
-
catchall:
|
|
2722
|
-
typeName:
|
|
2721
|
+
catchall: Pe.create(),
|
|
2722
|
+
typeName: E.ZodObject
|
|
2723
2723
|
}, T(e)));
|
|
2724
2724
|
class Dt extends A {
|
|
2725
2725
|
_parse(e) {
|
|
@@ -2735,12 +2735,12 @@ class Dt extends A {
|
|
|
2735
2735
|
return y(n, {
|
|
2736
2736
|
code: f.invalid_union,
|
|
2737
2737
|
unionErrors: i
|
|
2738
|
-
}),
|
|
2738
|
+
}), x;
|
|
2739
2739
|
}
|
|
2740
2740
|
if (n.common.async)
|
|
2741
2741
|
return Promise.all(r.map((a) => Se(this, null, function* () {
|
|
2742
|
-
const i =
|
|
2743
|
-
common:
|
|
2742
|
+
const i = S(d({}, n), {
|
|
2743
|
+
common: S(d({}, n.common), {
|
|
2744
2744
|
issues: []
|
|
2745
2745
|
}),
|
|
2746
2746
|
parent: null
|
|
@@ -2758,8 +2758,8 @@ class Dt extends A {
|
|
|
2758
2758
|
let a;
|
|
2759
2759
|
const i = [];
|
|
2760
2760
|
for (const c of r) {
|
|
2761
|
-
const u =
|
|
2762
|
-
common:
|
|
2761
|
+
const u = S(d({}, n), {
|
|
2762
|
+
common: S(d({}, n.common), {
|
|
2763
2763
|
issues: []
|
|
2764
2764
|
}),
|
|
2765
2765
|
parent: null
|
|
@@ -2778,7 +2778,7 @@ class Dt extends A {
|
|
|
2778
2778
|
return y(n, {
|
|
2779
2779
|
code: f.invalid_union,
|
|
2780
2780
|
unionErrors: o
|
|
2781
|
-
}),
|
|
2781
|
+
}), x;
|
|
2782
2782
|
}
|
|
2783
2783
|
}
|
|
2784
2784
|
get options() {
|
|
@@ -2787,10 +2787,10 @@ class Dt extends A {
|
|
|
2787
2787
|
}
|
|
2788
2788
|
Dt.create = (t, e) => new Dt(d({
|
|
2789
2789
|
options: t,
|
|
2790
|
-
typeName:
|
|
2790
|
+
typeName: E.ZodUnion
|
|
2791
2791
|
}, T(e)));
|
|
2792
|
-
const
|
|
2793
|
-
class
|
|
2792
|
+
const Me = (t) => t instanceof $t ? Me(t.schema) : t instanceof ve ? Me(t.innerType()) : t instanceof Ft ? [t.value] : t instanceof ze ? t.options : t instanceof Wt ? N.objectValues(t.enum) : t instanceof zt ? Me(t._def.innerType) : t instanceof Pt ? [void 0] : t instanceof Zt ? [null] : t instanceof Ee ? [void 0, ...Me(t.unwrap())] : t instanceof Ue ? [null, ...Me(t.unwrap())] : t instanceof Nr || t instanceof Vt ? Me(t.unwrap()) : t instanceof Ut ? Me(t._def.innerType) : [];
|
|
2793
|
+
class En extends A {
|
|
2794
2794
|
_parse(e) {
|
|
2795
2795
|
const { ctx: n } = this._processInputParams(e);
|
|
2796
2796
|
if (n.parsedType !== _.object)
|
|
@@ -2798,7 +2798,7 @@ class Sn extends A {
|
|
|
2798
2798
|
code: f.invalid_type,
|
|
2799
2799
|
expected: _.object,
|
|
2800
2800
|
received: n.parsedType
|
|
2801
|
-
}),
|
|
2801
|
+
}), x;
|
|
2802
2802
|
const r = this.discriminator, s = n.data[r], a = this.optionsMap.get(s);
|
|
2803
2803
|
return a ? n.common.async ? a._parseAsync({
|
|
2804
2804
|
data: n.data,
|
|
@@ -2812,7 +2812,7 @@ class Sn extends A {
|
|
|
2812
2812
|
code: f.invalid_union_discriminator,
|
|
2813
2813
|
options: Array.from(this.optionsMap.keys()),
|
|
2814
2814
|
path: [r]
|
|
2815
|
-
}),
|
|
2815
|
+
}), x);
|
|
2816
2816
|
}
|
|
2817
2817
|
get discriminator() {
|
|
2818
2818
|
return this._def.discriminator;
|
|
@@ -2834,7 +2834,7 @@ class Sn extends A {
|
|
|
2834
2834
|
static create(e, n, r) {
|
|
2835
2835
|
const s = /* @__PURE__ */ new Map();
|
|
2836
2836
|
for (const a of n) {
|
|
2837
|
-
const i =
|
|
2837
|
+
const i = Me(a.shape[e]);
|
|
2838
2838
|
if (!i.length)
|
|
2839
2839
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2840
2840
|
for (const o of i) {
|
|
@@ -2843,8 +2843,8 @@ class Sn extends A {
|
|
|
2843
2843
|
s.set(o, a);
|
|
2844
2844
|
}
|
|
2845
2845
|
}
|
|
2846
|
-
return new
|
|
2847
|
-
typeName:
|
|
2846
|
+
return new En(d({
|
|
2847
|
+
typeName: E.ZodDiscriminatedUnion,
|
|
2848
2848
|
discriminator: e,
|
|
2849
2849
|
options: n,
|
|
2850
2850
|
optionsMap: s
|
|
@@ -2852,7 +2852,7 @@ class Sn extends A {
|
|
|
2852
2852
|
}
|
|
2853
2853
|
}
|
|
2854
2854
|
function sr(t, e) {
|
|
2855
|
-
const n =
|
|
2855
|
+
const n = je(t), r = je(e);
|
|
2856
2856
|
if (t === e)
|
|
2857
2857
|
return { valid: !0, data: t };
|
|
2858
2858
|
if (n === _.object && r === _.object) {
|
|
@@ -2881,11 +2881,11 @@ class Mt extends A {
|
|
|
2881
2881
|
_parse(e) {
|
|
2882
2882
|
const { status: n, ctx: r } = this._processInputParams(e), s = (a, i) => {
|
|
2883
2883
|
if (nr(a) || nr(i))
|
|
2884
|
-
return
|
|
2884
|
+
return x;
|
|
2885
2885
|
const o = sr(a.value, i.value);
|
|
2886
2886
|
return o.valid ? ((rr(a) || rr(i)) && n.dirty(), { status: n.value, value: o.data }) : (y(r, {
|
|
2887
2887
|
code: f.invalid_intersection_types
|
|
2888
|
-
}),
|
|
2888
|
+
}), x);
|
|
2889
2889
|
};
|
|
2890
2890
|
return r.common.async ? Promise.all([
|
|
2891
2891
|
this._def.left._parseAsync({
|
|
@@ -2912,9 +2912,9 @@ class Mt extends A {
|
|
|
2912
2912
|
Mt.create = (t, e, n) => new Mt(d({
|
|
2913
2913
|
left: t,
|
|
2914
2914
|
right: e,
|
|
2915
|
-
typeName:
|
|
2915
|
+
typeName: E.ZodIntersection
|
|
2916
2916
|
}, T(n)));
|
|
2917
|
-
class
|
|
2917
|
+
class Oe extends A {
|
|
2918
2918
|
_parse(e) {
|
|
2919
2919
|
const { status: n, ctx: r } = this._processInputParams(e);
|
|
2920
2920
|
if (r.parsedType !== _.array)
|
|
@@ -2922,7 +2922,7 @@ class Ee extends A {
|
|
|
2922
2922
|
code: f.invalid_type,
|
|
2923
2923
|
expected: _.array,
|
|
2924
2924
|
received: r.parsedType
|
|
2925
|
-
}),
|
|
2925
|
+
}), x;
|
|
2926
2926
|
if (r.data.length < this._def.items.length)
|
|
2927
2927
|
return y(r, {
|
|
2928
2928
|
code: f.too_small,
|
|
@@ -2930,7 +2930,7 @@ class Ee extends A {
|
|
|
2930
2930
|
inclusive: !0,
|
|
2931
2931
|
exact: !1,
|
|
2932
2932
|
type: "array"
|
|
2933
|
-
}),
|
|
2933
|
+
}), x;
|
|
2934
2934
|
!this._def.rest && r.data.length > this._def.items.length && (y(r, {
|
|
2935
2935
|
code: f.too_big,
|
|
2936
2936
|
maximum: this._def.items.length,
|
|
@@ -2942,23 +2942,23 @@ class Ee extends A {
|
|
|
2942
2942
|
const o = this._def.items[i] || this._def.rest;
|
|
2943
2943
|
return o ? o._parse(new xe(r, a, r.path, i)) : null;
|
|
2944
2944
|
}).filter((a) => !!a);
|
|
2945
|
-
return r.common.async ? Promise.all(s).then((a) =>
|
|
2945
|
+
return r.common.async ? Promise.all(s).then((a) => X.mergeArray(n, a)) : X.mergeArray(n, s);
|
|
2946
2946
|
}
|
|
2947
2947
|
get items() {
|
|
2948
2948
|
return this._def.items;
|
|
2949
2949
|
}
|
|
2950
2950
|
rest(e) {
|
|
2951
|
-
return new
|
|
2951
|
+
return new Oe(S(d({}, this._def), {
|
|
2952
2952
|
rest: e
|
|
2953
2953
|
}));
|
|
2954
2954
|
}
|
|
2955
2955
|
}
|
|
2956
|
-
|
|
2956
|
+
Oe.create = (t, e) => {
|
|
2957
2957
|
if (!Array.isArray(t))
|
|
2958
2958
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2959
|
-
return new
|
|
2959
|
+
return new Oe(d({
|
|
2960
2960
|
items: t,
|
|
2961
|
-
typeName:
|
|
2961
|
+
typeName: E.ZodTuple,
|
|
2962
2962
|
rest: null
|
|
2963
2963
|
}, T(e)));
|
|
2964
2964
|
};
|
|
@@ -2976,7 +2976,7 @@ class Lt extends A {
|
|
|
2976
2976
|
code: f.invalid_type,
|
|
2977
2977
|
expected: _.object,
|
|
2978
2978
|
received: r.parsedType
|
|
2979
|
-
}),
|
|
2979
|
+
}), x;
|
|
2980
2980
|
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
2981
2981
|
for (const o in r.data)
|
|
2982
2982
|
s.push({
|
|
@@ -2984,7 +2984,7 @@ class Lt extends A {
|
|
|
2984
2984
|
value: i._parse(new xe(r, r.data[o], r.path, o)),
|
|
2985
2985
|
alwaysSet: o in r.data
|
|
2986
2986
|
});
|
|
2987
|
-
return r.common.async ?
|
|
2987
|
+
return r.common.async ? X.mergeObjectAsync(n, s) : X.mergeObjectSync(n, s);
|
|
2988
2988
|
}
|
|
2989
2989
|
get element() {
|
|
2990
2990
|
return this._def.valueType;
|
|
@@ -2993,11 +2993,11 @@ class Lt extends A {
|
|
|
2993
2993
|
return n instanceof A ? new Lt(d({
|
|
2994
2994
|
keyType: e,
|
|
2995
2995
|
valueType: n,
|
|
2996
|
-
typeName:
|
|
2996
|
+
typeName: E.ZodRecord
|
|
2997
2997
|
}, T(r))) : new Lt(d({
|
|
2998
|
-
keyType:
|
|
2998
|
+
keyType: ye.create(),
|
|
2999
2999
|
valueType: e,
|
|
3000
|
-
typeName:
|
|
3000
|
+
typeName: E.ZodRecord
|
|
3001
3001
|
}, T(n)));
|
|
3002
3002
|
}
|
|
3003
3003
|
}
|
|
@@ -3015,7 +3015,7 @@ class gn extends A {
|
|
|
3015
3015
|
code: f.invalid_type,
|
|
3016
3016
|
expected: _.map,
|
|
3017
3017
|
received: r.parsedType
|
|
3018
|
-
}),
|
|
3018
|
+
}), x;
|
|
3019
3019
|
const s = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, c], u) => ({
|
|
3020
3020
|
key: s._parse(new xe(r, o, r.path, [u, "key"])),
|
|
3021
3021
|
value: a._parse(new xe(r, c, r.path, [u, "value"]))
|
|
@@ -3026,7 +3026,7 @@ class gn extends A {
|
|
|
3026
3026
|
for (const c of i) {
|
|
3027
3027
|
const u = yield c.key, h = yield c.value;
|
|
3028
3028
|
if (u.status === "aborted" || h.status === "aborted")
|
|
3029
|
-
return
|
|
3029
|
+
return x;
|
|
3030
3030
|
(u.status === "dirty" || h.status === "dirty") && n.dirty(), o.set(u.value, h.value);
|
|
3031
3031
|
}
|
|
3032
3032
|
return { status: n.value, value: o };
|
|
@@ -3036,7 +3036,7 @@ class gn extends A {
|
|
|
3036
3036
|
for (const c of i) {
|
|
3037
3037
|
const u = c.key, h = c.value;
|
|
3038
3038
|
if (u.status === "aborted" || h.status === "aborted")
|
|
3039
|
-
return
|
|
3039
|
+
return x;
|
|
3040
3040
|
(u.status === "dirty" || h.status === "dirty") && n.dirty(), o.set(u.value, h.value);
|
|
3041
3041
|
}
|
|
3042
3042
|
return { status: n.value, value: o };
|
|
@@ -3046,9 +3046,9 @@ class gn extends A {
|
|
|
3046
3046
|
gn.create = (t, e, n) => new gn(d({
|
|
3047
3047
|
valueType: e,
|
|
3048
3048
|
keyType: t,
|
|
3049
|
-
typeName:
|
|
3049
|
+
typeName: E.ZodMap
|
|
3050
3050
|
}, T(n)));
|
|
3051
|
-
class
|
|
3051
|
+
class tt extends A {
|
|
3052
3052
|
_parse(e) {
|
|
3053
3053
|
const { status: n, ctx: r } = this._processInputParams(e);
|
|
3054
3054
|
if (r.parsedType !== _.set)
|
|
@@ -3056,7 +3056,7 @@ class et extends A {
|
|
|
3056
3056
|
code: f.invalid_type,
|
|
3057
3057
|
expected: _.set,
|
|
3058
3058
|
received: r.parsedType
|
|
3059
|
-
}),
|
|
3059
|
+
}), x;
|
|
3060
3060
|
const s = this._def;
|
|
3061
3061
|
s.minSize !== null && r.data.size < s.minSize.value && (y(r, {
|
|
3062
3062
|
code: f.too_small,
|
|
@@ -3078,7 +3078,7 @@ class et extends A {
|
|
|
3078
3078
|
const u = /* @__PURE__ */ new Set();
|
|
3079
3079
|
for (const h of c) {
|
|
3080
3080
|
if (h.status === "aborted")
|
|
3081
|
-
return
|
|
3081
|
+
return x;
|
|
3082
3082
|
h.status === "dirty" && n.dirty(), u.add(h.value);
|
|
3083
3083
|
}
|
|
3084
3084
|
return { status: n.value, value: u };
|
|
@@ -3087,12 +3087,12 @@ class et extends A {
|
|
|
3087
3087
|
return r.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
3088
3088
|
}
|
|
3089
3089
|
min(e, n) {
|
|
3090
|
-
return new
|
|
3090
|
+
return new tt(S(d({}, this._def), {
|
|
3091
3091
|
minSize: { value: e, message: w.toString(n) }
|
|
3092
3092
|
}));
|
|
3093
3093
|
}
|
|
3094
3094
|
max(e, n) {
|
|
3095
|
-
return new
|
|
3095
|
+
return new tt(S(d({}, this._def), {
|
|
3096
3096
|
maxSize: { value: e, message: w.toString(n) }
|
|
3097
3097
|
}));
|
|
3098
3098
|
}
|
|
@@ -3103,11 +3103,11 @@ class et extends A {
|
|
|
3103
3103
|
return this.min(1, e);
|
|
3104
3104
|
}
|
|
3105
3105
|
}
|
|
3106
|
-
|
|
3106
|
+
tt.create = (t, e) => new tt(d({
|
|
3107
3107
|
valueType: t,
|
|
3108
3108
|
minSize: null,
|
|
3109
3109
|
maxSize: null,
|
|
3110
|
-
typeName:
|
|
3110
|
+
typeName: E.ZodSet
|
|
3111
3111
|
}, T(e)));
|
|
3112
3112
|
class ht extends A {
|
|
3113
3113
|
constructor() {
|
|
@@ -3120,7 +3120,7 @@ class ht extends A {
|
|
|
3120
3120
|
code: f.invalid_type,
|
|
3121
3121
|
expected: _.function,
|
|
3122
3122
|
received: n.parsedType
|
|
3123
|
-
}),
|
|
3123
|
+
}), x;
|
|
3124
3124
|
function r(o, c) {
|
|
3125
3125
|
return fn({
|
|
3126
3126
|
data: o,
|
|
@@ -3156,7 +3156,7 @@ class ht extends A {
|
|
|
3156
3156
|
const a = { errorMap: n.common.contextualErrorMap }, i = n.data;
|
|
3157
3157
|
if (this._def.returns instanceof vt) {
|
|
3158
3158
|
const o = this;
|
|
3159
|
-
return
|
|
3159
|
+
return te(function(...c) {
|
|
3160
3160
|
return Se(this, null, function* () {
|
|
3161
3161
|
const u = new oe([]), h = yield o._def.args.parseAsync(c, a).catch((k) => {
|
|
3162
3162
|
throw u.addIssue(r(c, k)), u;
|
|
@@ -3168,7 +3168,7 @@ class ht extends A {
|
|
|
3168
3168
|
});
|
|
3169
3169
|
} else {
|
|
3170
3170
|
const o = this;
|
|
3171
|
-
return
|
|
3171
|
+
return te(function(...c) {
|
|
3172
3172
|
const u = o._def.args.safeParse(c, a);
|
|
3173
3173
|
if (!u.success)
|
|
3174
3174
|
throw new oe([r(c, u.error)]);
|
|
@@ -3186,12 +3186,12 @@ class ht extends A {
|
|
|
3186
3186
|
return this._def.returns;
|
|
3187
3187
|
}
|
|
3188
3188
|
args(...e) {
|
|
3189
|
-
return new ht(
|
|
3190
|
-
args:
|
|
3189
|
+
return new ht(S(d({}, this._def), {
|
|
3190
|
+
args: Oe.create(e).rest(Ye.create())
|
|
3191
3191
|
}));
|
|
3192
3192
|
}
|
|
3193
3193
|
returns(e) {
|
|
3194
|
-
return new ht(
|
|
3194
|
+
return new ht(S(d({}, this._def), {
|
|
3195
3195
|
returns: e
|
|
3196
3196
|
}));
|
|
3197
3197
|
}
|
|
@@ -3203,9 +3203,9 @@ class ht extends A {
|
|
|
3203
3203
|
}
|
|
3204
3204
|
static create(e, n, r) {
|
|
3205
3205
|
return new ht(d({
|
|
3206
|
-
args: e ||
|
|
3207
|
-
returns: n ||
|
|
3208
|
-
typeName:
|
|
3206
|
+
args: e || Oe.create([]).rest(Ye.create()),
|
|
3207
|
+
returns: n || Ye.create(),
|
|
3208
|
+
typeName: E.ZodFunction
|
|
3209
3209
|
}, T(r)));
|
|
3210
3210
|
}
|
|
3211
3211
|
}
|
|
@@ -3220,7 +3220,7 @@ class $t extends A {
|
|
|
3220
3220
|
}
|
|
3221
3221
|
$t.create = (t, e) => new $t(d({
|
|
3222
3222
|
getter: t,
|
|
3223
|
-
typeName:
|
|
3223
|
+
typeName: E.ZodLazy
|
|
3224
3224
|
}, T(e)));
|
|
3225
3225
|
class Ft extends A {
|
|
3226
3226
|
_parse(e) {
|
|
@@ -3230,7 +3230,7 @@ class Ft extends A {
|
|
|
3230
3230
|
received: n.data,
|
|
3231
3231
|
code: f.invalid_literal,
|
|
3232
3232
|
expected: this._def.value
|
|
3233
|
-
}),
|
|
3233
|
+
}), x;
|
|
3234
3234
|
}
|
|
3235
3235
|
return { status: "valid", value: e.data };
|
|
3236
3236
|
}
|
|
@@ -3240,15 +3240,15 @@ class Ft extends A {
|
|
|
3240
3240
|
}
|
|
3241
3241
|
Ft.create = (t, e) => new Ft(d({
|
|
3242
3242
|
value: t,
|
|
3243
|
-
typeName:
|
|
3243
|
+
typeName: E.ZodLiteral
|
|
3244
3244
|
}, T(e)));
|
|
3245
3245
|
function Ds(t, e) {
|
|
3246
|
-
return new
|
|
3246
|
+
return new ze(d({
|
|
3247
3247
|
values: t,
|
|
3248
|
-
typeName:
|
|
3248
|
+
typeName: E.ZodEnum
|
|
3249
3249
|
}, T(e)));
|
|
3250
3250
|
}
|
|
3251
|
-
class
|
|
3251
|
+
class ze extends A {
|
|
3252
3252
|
constructor() {
|
|
3253
3253
|
super(...arguments), Ot.set(this, void 0);
|
|
3254
3254
|
}
|
|
@@ -3259,7 +3259,7 @@ class Fe extends A {
|
|
|
3259
3259
|
expected: N.joinValues(r),
|
|
3260
3260
|
received: n.parsedType,
|
|
3261
3261
|
code: f.invalid_type
|
|
3262
|
-
}),
|
|
3262
|
+
}), x;
|
|
3263
3263
|
}
|
|
3264
3264
|
if (pn(this, Ot) || js(this, Ot, new Set(this._def.values)), !pn(this, Ot).has(e.data)) {
|
|
3265
3265
|
const n = this._getOrReturnCtx(e), r = this._def.values;
|
|
@@ -3267,9 +3267,9 @@ class Fe extends A {
|
|
|
3267
3267
|
received: n.data,
|
|
3268
3268
|
code: f.invalid_enum_value,
|
|
3269
3269
|
options: r
|
|
3270
|
-
}),
|
|
3270
|
+
}), x;
|
|
3271
3271
|
}
|
|
3272
|
-
return
|
|
3272
|
+
return te(e.data);
|
|
3273
3273
|
}
|
|
3274
3274
|
get options() {
|
|
3275
3275
|
return this._def.values;
|
|
@@ -3293,14 +3293,14 @@ class Fe extends A {
|
|
|
3293
3293
|
return e;
|
|
3294
3294
|
}
|
|
3295
3295
|
extract(e, n = this._def) {
|
|
3296
|
-
return
|
|
3296
|
+
return ze.create(e, d(d({}, this._def), n));
|
|
3297
3297
|
}
|
|
3298
3298
|
exclude(e, n = this._def) {
|
|
3299
|
-
return
|
|
3299
|
+
return ze.create(this.options.filter((r) => !e.includes(r)), d(d({}, this._def), n));
|
|
3300
3300
|
}
|
|
3301
3301
|
}
|
|
3302
3302
|
Ot = /* @__PURE__ */ new WeakMap();
|
|
3303
|
-
|
|
3303
|
+
ze.create = Ds;
|
|
3304
3304
|
class Wt extends A {
|
|
3305
3305
|
constructor() {
|
|
3306
3306
|
super(...arguments), Tt.set(this, void 0);
|
|
@@ -3313,7 +3313,7 @@ class Wt extends A {
|
|
|
3313
3313
|
expected: N.joinValues(s),
|
|
3314
3314
|
received: r.parsedType,
|
|
3315
3315
|
code: f.invalid_type
|
|
3316
|
-
}),
|
|
3316
|
+
}), x;
|
|
3317
3317
|
}
|
|
3318
3318
|
if (pn(this, Tt) || js(this, Tt, new Set(N.getValidEnumValues(this._def.values))), !pn(this, Tt).has(e.data)) {
|
|
3319
3319
|
const s = N.objectValues(n);
|
|
@@ -3321,9 +3321,9 @@ class Wt extends A {
|
|
|
3321
3321
|
received: r.data,
|
|
3322
3322
|
code: f.invalid_enum_value,
|
|
3323
3323
|
options: s
|
|
3324
|
-
}),
|
|
3324
|
+
}), x;
|
|
3325
3325
|
}
|
|
3326
|
-
return
|
|
3326
|
+
return te(e.data);
|
|
3327
3327
|
}
|
|
3328
3328
|
get enum() {
|
|
3329
3329
|
return this._def.values;
|
|
@@ -3332,7 +3332,7 @@ class Wt extends A {
|
|
|
3332
3332
|
Tt = /* @__PURE__ */ new WeakMap();
|
|
3333
3333
|
Wt.create = (t, e) => new Wt(d({
|
|
3334
3334
|
values: t,
|
|
3335
|
-
typeName:
|
|
3335
|
+
typeName: E.ZodNativeEnum
|
|
3336
3336
|
}, T(e)));
|
|
3337
3337
|
class vt extends A {
|
|
3338
3338
|
unwrap() {
|
|
@@ -3345,9 +3345,9 @@ class vt extends A {
|
|
|
3345
3345
|
code: f.invalid_type,
|
|
3346
3346
|
expected: _.promise,
|
|
3347
3347
|
received: n.parsedType
|
|
3348
|
-
}),
|
|
3348
|
+
}), x;
|
|
3349
3349
|
const r = n.parsedType === _.promise ? n.data : Promise.resolve(n.data);
|
|
3350
|
-
return
|
|
3350
|
+
return te(r.then((s) => this._def.type.parseAsync(s, {
|
|
3351
3351
|
path: n.path,
|
|
3352
3352
|
errorMap: n.common.contextualErrorMap
|
|
3353
3353
|
})));
|
|
@@ -3355,14 +3355,14 @@ class vt extends A {
|
|
|
3355
3355
|
}
|
|
3356
3356
|
vt.create = (t, e) => new vt(d({
|
|
3357
3357
|
type: t,
|
|
3358
|
-
typeName:
|
|
3358
|
+
typeName: E.ZodPromise
|
|
3359
3359
|
}, T(e)));
|
|
3360
|
-
class
|
|
3360
|
+
class ve extends A {
|
|
3361
3361
|
innerType() {
|
|
3362
3362
|
return this._def.schema;
|
|
3363
3363
|
}
|
|
3364
3364
|
sourceType() {
|
|
3365
|
-
return this._def.schema._def.typeName ===
|
|
3365
|
+
return this._def.schema._def.typeName === E.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
3366
3366
|
}
|
|
3367
3367
|
_parse(e) {
|
|
3368
3368
|
const { status: n, ctx: r } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
@@ -3378,23 +3378,23 @@ class ge extends A {
|
|
|
3378
3378
|
if (r.common.async)
|
|
3379
3379
|
return Promise.resolve(i).then((o) => Se(this, null, function* () {
|
|
3380
3380
|
if (n.value === "aborted")
|
|
3381
|
-
return
|
|
3381
|
+
return x;
|
|
3382
3382
|
const c = yield this._def.schema._parseAsync({
|
|
3383
3383
|
data: o,
|
|
3384
3384
|
path: r.path,
|
|
3385
3385
|
parent: r
|
|
3386
3386
|
});
|
|
3387
|
-
return c.status === "aborted" ?
|
|
3387
|
+
return c.status === "aborted" ? x : c.status === "dirty" || n.value === "dirty" ? hn(c.value) : c;
|
|
3388
3388
|
}));
|
|
3389
3389
|
{
|
|
3390
3390
|
if (n.value === "aborted")
|
|
3391
|
-
return
|
|
3391
|
+
return x;
|
|
3392
3392
|
const o = this._def.schema._parseSync({
|
|
3393
3393
|
data: i,
|
|
3394
3394
|
path: r.path,
|
|
3395
3395
|
parent: r
|
|
3396
3396
|
});
|
|
3397
|
-
return o.status === "aborted" ?
|
|
3397
|
+
return o.status === "aborted" ? x : o.status === "dirty" || n.value === "dirty" ? hn(o.value) : o;
|
|
3398
3398
|
}
|
|
3399
3399
|
}
|
|
3400
3400
|
if (s.type === "refinement") {
|
|
@@ -3412,9 +3412,9 @@ class ge extends A {
|
|
|
3412
3412
|
path: r.path,
|
|
3413
3413
|
parent: r
|
|
3414
3414
|
});
|
|
3415
|
-
return o.status === "aborted" ?
|
|
3415
|
+
return o.status === "aborted" ? x : (o.status === "dirty" && n.dirty(), i(o.value), { status: n.value, value: o.value });
|
|
3416
3416
|
} else
|
|
3417
|
-
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => o.status === "aborted" ?
|
|
3417
|
+
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => o.status === "aborted" ? x : (o.status === "dirty" && n.dirty(), i(o.value).then(() => ({ status: n.value, value: o.value }))));
|
|
3418
3418
|
}
|
|
3419
3419
|
if (s.type === "transform")
|
|
3420
3420
|
if (r.common.async === !1) {
|
|
@@ -3423,50 +3423,50 @@ class ge extends A {
|
|
|
3423
3423
|
path: r.path,
|
|
3424
3424
|
parent: r
|
|
3425
3425
|
});
|
|
3426
|
-
if (!
|
|
3426
|
+
if (!Qe(i))
|
|
3427
3427
|
return i;
|
|
3428
3428
|
const o = s.transform(i.value, a);
|
|
3429
3429
|
if (o instanceof Promise)
|
|
3430
3430
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3431
3431
|
return { status: n.value, value: o };
|
|
3432
3432
|
} else
|
|
3433
|
-
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((i) =>
|
|
3433
|
+
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((i) => Qe(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({ status: n.value, value: o })) : i);
|
|
3434
3434
|
N.assertNever(s);
|
|
3435
3435
|
}
|
|
3436
3436
|
}
|
|
3437
|
-
|
|
3437
|
+
ve.create = (t, e, n) => new ve(d({
|
|
3438
3438
|
schema: t,
|
|
3439
|
-
typeName:
|
|
3439
|
+
typeName: E.ZodEffects,
|
|
3440
3440
|
effect: e
|
|
3441
3441
|
}, T(n)));
|
|
3442
|
-
|
|
3442
|
+
ve.createWithPreprocess = (t, e, n) => new ve(d({
|
|
3443
3443
|
schema: e,
|
|
3444
3444
|
effect: { type: "preprocess", transform: t },
|
|
3445
|
-
typeName:
|
|
3445
|
+
typeName: E.ZodEffects
|
|
3446
3446
|
}, T(n)));
|
|
3447
|
-
class
|
|
3447
|
+
class Ee extends A {
|
|
3448
3448
|
_parse(e) {
|
|
3449
|
-
return this._getType(e) === _.undefined ?
|
|
3449
|
+
return this._getType(e) === _.undefined ? te(void 0) : this._def.innerType._parse(e);
|
|
3450
3450
|
}
|
|
3451
3451
|
unwrap() {
|
|
3452
3452
|
return this._def.innerType;
|
|
3453
3453
|
}
|
|
3454
3454
|
}
|
|
3455
|
-
|
|
3455
|
+
Ee.create = (t, e) => new Ee(d({
|
|
3456
3456
|
innerType: t,
|
|
3457
|
-
typeName:
|
|
3457
|
+
typeName: E.ZodOptional
|
|
3458
3458
|
}, T(e)));
|
|
3459
|
-
class
|
|
3459
|
+
class Ue extends A {
|
|
3460
3460
|
_parse(e) {
|
|
3461
|
-
return this._getType(e) === _.null ?
|
|
3461
|
+
return this._getType(e) === _.null ? te(null) : this._def.innerType._parse(e);
|
|
3462
3462
|
}
|
|
3463
3463
|
unwrap() {
|
|
3464
3464
|
return this._def.innerType;
|
|
3465
3465
|
}
|
|
3466
3466
|
}
|
|
3467
|
-
|
|
3467
|
+
Ue.create = (t, e) => new Ue(d({
|
|
3468
3468
|
innerType: t,
|
|
3469
|
-
typeName:
|
|
3469
|
+
typeName: E.ZodNullable
|
|
3470
3470
|
}, T(e)));
|
|
3471
3471
|
class zt extends A {
|
|
3472
3472
|
_parse(e) {
|
|
@@ -3484,13 +3484,13 @@ class zt extends A {
|
|
|
3484
3484
|
}
|
|
3485
3485
|
zt.create = (t, e) => new zt(d({
|
|
3486
3486
|
innerType: t,
|
|
3487
|
-
typeName:
|
|
3487
|
+
typeName: E.ZodDefault,
|
|
3488
3488
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default
|
|
3489
3489
|
}, T(e)));
|
|
3490
3490
|
class Ut extends A {
|
|
3491
3491
|
_parse(e) {
|
|
3492
|
-
const { ctx: n } = this._processInputParams(e), r =
|
|
3493
|
-
common:
|
|
3492
|
+
const { ctx: n } = this._processInputParams(e), r = S(d({}, n), {
|
|
3493
|
+
common: S(d({}, n.common), {
|
|
3494
3494
|
issues: []
|
|
3495
3495
|
})
|
|
3496
3496
|
}), s = this._def.innerType._parse({
|
|
@@ -3522,7 +3522,7 @@ class Ut extends A {
|
|
|
3522
3522
|
}
|
|
3523
3523
|
Ut.create = (t, e) => new Ut(d({
|
|
3524
3524
|
innerType: t,
|
|
3525
|
-
typeName:
|
|
3525
|
+
typeName: E.ZodCatch,
|
|
3526
3526
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
3527
3527
|
}, T(e)));
|
|
3528
3528
|
class vn extends A {
|
|
@@ -3533,13 +3533,13 @@ class vn extends A {
|
|
|
3533
3533
|
code: f.invalid_type,
|
|
3534
3534
|
expected: _.nan,
|
|
3535
3535
|
received: n.parsedType
|
|
3536
|
-
}),
|
|
3536
|
+
}), x;
|
|
3537
3537
|
}
|
|
3538
3538
|
return { status: "valid", value: e.data };
|
|
3539
3539
|
}
|
|
3540
3540
|
}
|
|
3541
3541
|
vn.create = (t) => new vn(d({
|
|
3542
|
-
typeName:
|
|
3542
|
+
typeName: E.ZodNaN
|
|
3543
3543
|
}, T(t)));
|
|
3544
3544
|
const to = Symbol("zod_brand");
|
|
3545
3545
|
class Nr extends A {
|
|
@@ -3565,7 +3565,7 @@ class Jt extends A {
|
|
|
3565
3565
|
path: r.path,
|
|
3566
3566
|
parent: r
|
|
3567
3567
|
});
|
|
3568
|
-
return s.status === "aborted" ?
|
|
3568
|
+
return s.status === "aborted" ? x : s.status === "dirty" ? (n.dirty(), hn(s.value)) : this._def.out._parseAsync({
|
|
3569
3569
|
data: s.value,
|
|
3570
3570
|
path: r.path,
|
|
3571
3571
|
parent: r
|
|
@@ -3577,7 +3577,7 @@ class Jt extends A {
|
|
|
3577
3577
|
path: r.path,
|
|
3578
3578
|
parent: r
|
|
3579
3579
|
});
|
|
3580
|
-
return s.status === "aborted" ?
|
|
3580
|
+
return s.status === "aborted" ? x : s.status === "dirty" ? (n.dirty(), {
|
|
3581
3581
|
status: "dirty",
|
|
3582
3582
|
value: s.value
|
|
3583
3583
|
}) : this._def.out._parseSync({
|
|
@@ -3591,13 +3591,13 @@ class Jt extends A {
|
|
|
3591
3591
|
return new Jt({
|
|
3592
3592
|
in: e,
|
|
3593
3593
|
out: n,
|
|
3594
|
-
typeName:
|
|
3594
|
+
typeName: E.ZodPipeline
|
|
3595
3595
|
});
|
|
3596
3596
|
}
|
|
3597
3597
|
}
|
|
3598
3598
|
class Vt extends A {
|
|
3599
3599
|
_parse(e) {
|
|
3600
|
-
const n = this._def.innerType._parse(e), r = (s) => (
|
|
3600
|
+
const n = this._def.innerType._parse(e), r = (s) => (Qe(s) && (s.value = Object.freeze(s.value)), s);
|
|
3601
3601
|
return jt(n) ? n.then((s) => r(s)) : r(n);
|
|
3602
3602
|
}
|
|
3603
3603
|
unwrap() {
|
|
@@ -3606,7 +3606,7 @@ class Vt extends A {
|
|
|
3606
3606
|
}
|
|
3607
3607
|
Vt.create = (t, e) => new Vt(d({
|
|
3608
3608
|
innerType: t,
|
|
3609
|
-
typeName:
|
|
3609
|
+
typeName: E.ZodReadonly
|
|
3610
3610
|
}, T(e)));
|
|
3611
3611
|
function as(t, e) {
|
|
3612
3612
|
const n = typeof t == "function" ? t(e) : typeof t == "string" ? { message: t } : t;
|
|
@@ -3621,33 +3621,33 @@ function Ms(t, e = {}, n) {
|
|
|
3621
3621
|
var u, h;
|
|
3622
3622
|
if (!c) {
|
|
3623
3623
|
const p = as(e, r), k = (h = (u = p.fatal) !== null && u !== void 0 ? u : n) !== null && h !== void 0 ? h : !0;
|
|
3624
|
-
s.addIssue(
|
|
3624
|
+
s.addIssue(S(d({ code: "custom" }, p), { fatal: k }));
|
|
3625
3625
|
}
|
|
3626
3626
|
});
|
|
3627
3627
|
if (!o) {
|
|
3628
3628
|
const c = as(e, r), u = (i = (a = c.fatal) !== null && a !== void 0 ? a : n) !== null && i !== void 0 ? i : !0;
|
|
3629
|
-
s.addIssue(
|
|
3629
|
+
s.addIssue(S(d({ code: "custom" }, c), { fatal: u }));
|
|
3630
3630
|
}
|
|
3631
3631
|
}) : gt.create();
|
|
3632
3632
|
}
|
|
3633
3633
|
const no = {
|
|
3634
3634
|
object: z.lazycreate
|
|
3635
3635
|
};
|
|
3636
|
-
var
|
|
3636
|
+
var E;
|
|
3637
3637
|
(function(t) {
|
|
3638
3638
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
3639
|
-
})(
|
|
3639
|
+
})(E || (E = {}));
|
|
3640
3640
|
const ro = (t, e = {
|
|
3641
3641
|
message: `Input not instance of ${t.name}`
|
|
3642
|
-
}) => Ms((n) => n instanceof t, e), Ls =
|
|
3643
|
-
string: (t) =>
|
|
3644
|
-
number: (t) =>
|
|
3645
|
-
boolean: (t) => It.create(
|
|
3642
|
+
}) => Ms((n) => n instanceof t, e), Ls = ye.create, $s = Fe.create, so = vn.create, ao = We.create, Fs = It.create, io = et.create, oo = mn.create, co = Pt.create, uo = Zt.create, lo = gt.create, fo = Ye.create, ho = Pe.create, po = yn.create, mo = ge.create, yo = z.create, go = z.strictCreate, vo = Dt.create, _o = En.create, bo = Mt.create, wo = Oe.create, ko = Lt.create, Eo = gn.create, So = tt.create, xo = ht.create, Oo = $t.create, To = Ft.create, Ao = ze.create, Co = Wt.create, No = vt.create, is = ve.create, Ro = Ee.create, jo = Ue.create, Io = ve.createWithPreprocess, Po = Jt.create, Zo = () => Ls().optional(), Do = () => $s().optional(), Mo = () => Fs().optional(), Lo = {
|
|
3643
|
+
string: (t) => ye.create(S(d({}, t), { coerce: !0 })),
|
|
3644
|
+
number: (t) => Fe.create(S(d({}, t), { coerce: !0 })),
|
|
3645
|
+
boolean: (t) => It.create(S(d({}, t), {
|
|
3646
3646
|
coerce: !0
|
|
3647
3647
|
})),
|
|
3648
|
-
bigint: (t) =>
|
|
3649
|
-
date: (t) =>
|
|
3650
|
-
}, $o =
|
|
3648
|
+
bigint: (t) => We.create(S(d({}, t), { coerce: !0 })),
|
|
3649
|
+
date: (t) => et.create(S(d({}, t), { coerce: !0 }))
|
|
3650
|
+
}, $o = x;
|
|
3651
3651
|
var j = /* @__PURE__ */ Object.freeze({
|
|
3652
3652
|
__proto__: null,
|
|
3653
3653
|
defaultErrorMap: yt,
|
|
@@ -3656,13 +3656,13 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
3656
3656
|
makeIssue: fn,
|
|
3657
3657
|
EMPTY_PATH: Ii,
|
|
3658
3658
|
addIssueToContext: y,
|
|
3659
|
-
ParseStatus:
|
|
3660
|
-
INVALID:
|
|
3659
|
+
ParseStatus: X,
|
|
3660
|
+
INVALID: x,
|
|
3661
3661
|
DIRTY: hn,
|
|
3662
|
-
OK:
|
|
3662
|
+
OK: te,
|
|
3663
3663
|
isAborted: nr,
|
|
3664
3664
|
isDirty: rr,
|
|
3665
|
-
isValid:
|
|
3665
|
+
isValid: Qe,
|
|
3666
3666
|
isAsync: jt,
|
|
3667
3667
|
get util() {
|
|
3668
3668
|
return N;
|
|
@@ -3671,40 +3671,40 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
3671
3671
|
return tr;
|
|
3672
3672
|
},
|
|
3673
3673
|
ZodParsedType: _,
|
|
3674
|
-
getParsedType:
|
|
3674
|
+
getParsedType: je,
|
|
3675
3675
|
ZodType: A,
|
|
3676
3676
|
datetimeRegex: Zs,
|
|
3677
|
-
ZodString:
|
|
3678
|
-
ZodNumber:
|
|
3679
|
-
ZodBigInt:
|
|
3677
|
+
ZodString: ye,
|
|
3678
|
+
ZodNumber: Fe,
|
|
3679
|
+
ZodBigInt: We,
|
|
3680
3680
|
ZodBoolean: It,
|
|
3681
|
-
ZodDate:
|
|
3681
|
+
ZodDate: et,
|
|
3682
3682
|
ZodSymbol: mn,
|
|
3683
3683
|
ZodUndefined: Pt,
|
|
3684
3684
|
ZodNull: Zt,
|
|
3685
3685
|
ZodAny: gt,
|
|
3686
|
-
ZodUnknown:
|
|
3687
|
-
ZodNever:
|
|
3686
|
+
ZodUnknown: Ye,
|
|
3687
|
+
ZodNever: Pe,
|
|
3688
3688
|
ZodVoid: yn,
|
|
3689
|
-
ZodArray:
|
|
3689
|
+
ZodArray: ge,
|
|
3690
3690
|
ZodObject: z,
|
|
3691
3691
|
ZodUnion: Dt,
|
|
3692
|
-
ZodDiscriminatedUnion:
|
|
3692
|
+
ZodDiscriminatedUnion: En,
|
|
3693
3693
|
ZodIntersection: Mt,
|
|
3694
|
-
ZodTuple:
|
|
3694
|
+
ZodTuple: Oe,
|
|
3695
3695
|
ZodRecord: Lt,
|
|
3696
3696
|
ZodMap: gn,
|
|
3697
|
-
ZodSet:
|
|
3697
|
+
ZodSet: tt,
|
|
3698
3698
|
ZodFunction: ht,
|
|
3699
3699
|
ZodLazy: $t,
|
|
3700
3700
|
ZodLiteral: Ft,
|
|
3701
|
-
ZodEnum:
|
|
3701
|
+
ZodEnum: ze,
|
|
3702
3702
|
ZodNativeEnum: Wt,
|
|
3703
3703
|
ZodPromise: vt,
|
|
3704
|
-
ZodEffects:
|
|
3705
|
-
ZodTransformer:
|
|
3706
|
-
ZodOptional:
|
|
3707
|
-
ZodNullable:
|
|
3704
|
+
ZodEffects: ve,
|
|
3705
|
+
ZodTransformer: ve,
|
|
3706
|
+
ZodOptional: Ee,
|
|
3707
|
+
ZodNullable: Ue,
|
|
3708
3708
|
ZodDefault: zt,
|
|
3709
3709
|
ZodCatch: Ut,
|
|
3710
3710
|
ZodNaN: vn,
|
|
@@ -3717,7 +3717,7 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
3717
3717
|
ZodSchema: A,
|
|
3718
3718
|
late: no,
|
|
3719
3719
|
get ZodFirstPartyTypeKind() {
|
|
3720
|
-
return
|
|
3720
|
+
return E;
|
|
3721
3721
|
},
|
|
3722
3722
|
coerce: Lo,
|
|
3723
3723
|
any: lo,
|
|
@@ -3728,12 +3728,12 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
3728
3728
|
discriminatedUnion: _o,
|
|
3729
3729
|
effect: is,
|
|
3730
3730
|
enum: Ao,
|
|
3731
|
-
function:
|
|
3731
|
+
function: xo,
|
|
3732
3732
|
instanceof: ro,
|
|
3733
3733
|
intersection: bo,
|
|
3734
3734
|
lazy: Oo,
|
|
3735
3735
|
literal: To,
|
|
3736
|
-
map:
|
|
3736
|
+
map: Eo,
|
|
3737
3737
|
nan: so,
|
|
3738
3738
|
nativeEnum: Co,
|
|
3739
3739
|
never: ho,
|
|
@@ -3749,7 +3749,7 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
3749
3749
|
preprocess: Io,
|
|
3750
3750
|
promise: No,
|
|
3751
3751
|
record: ko,
|
|
3752
|
-
set:
|
|
3752
|
+
set: So,
|
|
3753
3753
|
strictObject: go,
|
|
3754
3754
|
string: Ls,
|
|
3755
3755
|
symbol: oo,
|
|
@@ -3970,24 +3970,24 @@ function us(t) {
|
|
|
3970
3970
|
}
|
|
3971
3971
|
var Ws = (t) => {
|
|
3972
3972
|
throw TypeError(t);
|
|
3973
|
-
}, Rr = (t, e, n) => e.has(t) || Ws("Cannot " + n), C = (t, e, n) => (Rr(t, e, "read from private field"), n ? n.call(t) : e.get(t)), q = (t, e, n) => e.has(t) ? Ws("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), W = (t, e, n, r) => (Rr(t, e, "write to private field"), e.set(t, n), n),
|
|
3973
|
+
}, Rr = (t, e, n) => e.has(t) || Ws("Cannot " + n), C = (t, e, n) => (Rr(t, e, "read from private field"), n ? n.call(t) : e.get(t)), q = (t, e, n) => e.has(t) ? Ws("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), W = (t, e, n, r) => (Rr(t, e, "write to private field"), e.set(t, n), n), Re = (t, e, n) => (Rr(t, e, "access private method"), n), se, Xe, ut, un, _n, Nt, ft, Rt, Le, dt, pt, lt, At, me, ir, or, cr, ds, ur, dr, Ct, lr, fr;
|
|
3974
3974
|
class dn extends EventTarget {
|
|
3975
3975
|
constructor(e, n) {
|
|
3976
3976
|
var r, s;
|
|
3977
|
-
super(), q(this,
|
|
3977
|
+
super(), q(this, me), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, q(this, se), q(this, Xe), q(this, ut), q(this, un), q(this, _n), q(this, Nt), q(this, ft), q(this, Rt, null), q(this, Le), q(this, dt), q(this, pt, null), q(this, lt, null), q(this, At, null), q(this, or, (a) => Ze(this, null, function* () {
|
|
3978
3978
|
var i;
|
|
3979
3979
|
C(this, dt).reset();
|
|
3980
3980
|
const { body: o, redirected: c, status: u, headers: h } = a;
|
|
3981
3981
|
if (u === 204) {
|
|
3982
|
-
|
|
3982
|
+
Re(this, me, Ct).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
3983
3983
|
return;
|
|
3984
3984
|
}
|
|
3985
3985
|
if (c ? W(this, ut, new URL(a.url)) : W(this, ut, void 0), u !== 200) {
|
|
3986
|
-
|
|
3986
|
+
Re(this, me, Ct).call(this, `Non-200 status code (${u})`, u);
|
|
3987
3987
|
return;
|
|
3988
3988
|
}
|
|
3989
3989
|
if (!(h.get("content-type") || "").startsWith("text/event-stream")) {
|
|
3990
|
-
|
|
3990
|
+
Re(this, me, Ct).call(this, 'Invalid content type, expected "text/event-stream"', u);
|
|
3991
3991
|
return;
|
|
3992
3992
|
}
|
|
3993
3993
|
if (C(this, se) === this.CLOSED)
|
|
@@ -3995,35 +3995,35 @@ class dn extends EventTarget {
|
|
|
3995
3995
|
W(this, se, this.OPEN);
|
|
3996
3996
|
const p = new Event("open");
|
|
3997
3997
|
if ((i = C(this, At)) == null || i.call(this, p), this.dispatchEvent(p), typeof o != "object" || !o || !("getReader" in o)) {
|
|
3998
|
-
|
|
3998
|
+
Re(this, me, Ct).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
3999
3999
|
return;
|
|
4000
4000
|
}
|
|
4001
4001
|
const k = new TextDecoder(), v = o.getReader();
|
|
4002
4002
|
let b = !0;
|
|
4003
4003
|
do {
|
|
4004
4004
|
const { done: m, value: g } = yield v.read();
|
|
4005
|
-
g && C(this, dt).feed(k.decode(g, { stream: !m })), m && (b = !1, C(this, dt).reset(),
|
|
4005
|
+
g && C(this, dt).feed(k.decode(g, { stream: !m })), m && (b = !1, C(this, dt).reset(), Re(this, me, lr).call(this));
|
|
4006
4006
|
} while (b);
|
|
4007
4007
|
})), q(this, cr, (a) => {
|
|
4008
|
-
W(this,
|
|
4008
|
+
W(this, Le, void 0), !(a.name === "AbortError" || a.type === "aborted") && Re(this, me, lr).call(this, ar(a));
|
|
4009
4009
|
}), q(this, ur, (a) => {
|
|
4010
4010
|
typeof a.id == "string" && W(this, Rt, a.id);
|
|
4011
4011
|
const i = new MessageEvent(a.event || "message", {
|
|
4012
4012
|
data: a.data,
|
|
4013
|
-
origin: C(this, ut) ? C(this, ut).origin : C(this,
|
|
4013
|
+
origin: C(this, ut) ? C(this, ut).origin : C(this, Xe).origin,
|
|
4014
4014
|
lastEventId: a.id || ""
|
|
4015
4015
|
});
|
|
4016
4016
|
C(this, lt) && (!a.event || a.event === "message") && C(this, lt).call(this, i), this.dispatchEvent(i);
|
|
4017
4017
|
}), q(this, dr, (a) => {
|
|
4018
4018
|
W(this, Nt, a);
|
|
4019
4019
|
}), q(this, fr, () => {
|
|
4020
|
-
W(this, ft, void 0), C(this, se) === this.CONNECTING &&
|
|
4020
|
+
W(this, ft, void 0), C(this, se) === this.CONNECTING && Re(this, me, ir).call(this);
|
|
4021
4021
|
});
|
|
4022
4022
|
try {
|
|
4023
4023
|
if (e instanceof URL)
|
|
4024
|
-
W(this,
|
|
4024
|
+
W(this, Xe, e);
|
|
4025
4025
|
else if (typeof e == "string")
|
|
4026
|
-
W(this,
|
|
4026
|
+
W(this, Xe, new URL(e, Uo()));
|
|
4027
4027
|
else
|
|
4028
4028
|
throw new Error("Invalid URL");
|
|
4029
4029
|
} catch (a) {
|
|
@@ -4032,7 +4032,7 @@ class dn extends EventTarget {
|
|
|
4032
4032
|
W(this, dt, Fo({
|
|
4033
4033
|
onEvent: C(this, ur),
|
|
4034
4034
|
onRetry: C(this, dr)
|
|
4035
|
-
})), W(this, se, this.CONNECTING), W(this, Nt, 3e3), W(this, _n, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), W(this, un, (s = n == null ? void 0 : n.withCredentials) != null ? s : !1),
|
|
4035
|
+
})), W(this, se, this.CONNECTING), W(this, Nt, 3e3), W(this, _n, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), W(this, un, (s = n == null ? void 0 : n.withCredentials) != null ? s : !1), Re(this, me, ir).call(this);
|
|
4036
4036
|
}
|
|
4037
4037
|
/**
|
|
4038
4038
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -4055,7 +4055,7 @@ class dn extends EventTarget {
|
|
|
4055
4055
|
* @public
|
|
4056
4056
|
*/
|
|
4057
4057
|
get url() {
|
|
4058
|
-
return C(this,
|
|
4058
|
+
return C(this, Xe).href;
|
|
4059
4059
|
}
|
|
4060
4060
|
/**
|
|
4061
4061
|
* Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
|
|
@@ -4102,16 +4102,16 @@ class dn extends EventTarget {
|
|
|
4102
4102
|
* @public
|
|
4103
4103
|
*/
|
|
4104
4104
|
close() {
|
|
4105
|
-
C(this, ft) && clearTimeout(C(this, ft)), C(this, se) !== this.CLOSED && (C(this,
|
|
4105
|
+
C(this, ft) && clearTimeout(C(this, ft)), C(this, se) !== this.CLOSED && (C(this, Le) && C(this, Le).abort(), W(this, se, this.CLOSED), W(this, Le, void 0));
|
|
4106
4106
|
}
|
|
4107
4107
|
}
|
|
4108
|
-
se = /* @__PURE__ */ new WeakMap(),
|
|
4108
|
+
se = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), un = /* @__PURE__ */ new WeakMap(), _n = /* @__PURE__ */ new WeakMap(), Nt = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), Rt = /* @__PURE__ */ new WeakMap(), Le = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), me = /* @__PURE__ */ new WeakSet(), /**
|
|
4109
4109
|
* Connect to the given URL and start receiving events
|
|
4110
4110
|
*
|
|
4111
4111
|
* @internal
|
|
4112
4112
|
*/
|
|
4113
4113
|
ir = function() {
|
|
4114
|
-
W(this, se, this.CONNECTING), W(this,
|
|
4114
|
+
W(this, se, this.CONNECTING), W(this, Le, new AbortController()), C(this, _n)(C(this, Xe), Re(this, me, ds).call(this)).then(C(this, or)).catch(C(this, cr));
|
|
4115
4115
|
}, or = /* @__PURE__ */ new WeakMap(), cr = /* @__PURE__ */ new WeakMap(), /**
|
|
4116
4116
|
* Get request options for the `fetch()` request
|
|
4117
4117
|
*
|
|
@@ -4125,9 +4125,9 @@ ds = function() {
|
|
|
4125
4125
|
// [spec] …will have their mode set to "cors"…
|
|
4126
4126
|
mode: "cors",
|
|
4127
4127
|
redirect: "follow",
|
|
4128
|
-
headers:
|
|
4128
|
+
headers: Be({ Accept: "text/event-stream" }, C(this, Rt) ? { "Last-Event-ID": C(this, Rt) } : void 0),
|
|
4129
4129
|
cache: "no-store",
|
|
4130
|
-
signal: (t = C(this,
|
|
4130
|
+
signal: (t = C(this, Le)) == null ? void 0 : t.signal
|
|
4131
4131
|
};
|
|
4132
4132
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
4133
4133
|
}, ur = /* @__PURE__ */ new WeakMap(), dr = /* @__PURE__ */ new WeakMap(), /**
|
|
@@ -4220,9 +4220,9 @@ var _t = Object.getPrototypeOf;
|
|
|
4220
4220
|
function bt(t) {
|
|
4221
4221
|
return !!t && !!t[ce];
|
|
4222
4222
|
}
|
|
4223
|
-
function
|
|
4223
|
+
function nt(t) {
|
|
4224
4224
|
var e;
|
|
4225
|
-
return t ? Us(t) || Array.isArray(t) || !!t[ls] || !!((e = t.constructor) != null && e[ls]) ||
|
|
4225
|
+
return t ? Us(t) || Array.isArray(t) || !!t[ls] || !!((e = t.constructor) != null && e[ls]) || xn(t) || On(t) : !1;
|
|
4226
4226
|
}
|
|
4227
4227
|
var Ko = Object.prototype.constructor.toString();
|
|
4228
4228
|
function Us(t) {
|
|
@@ -4235,35 +4235,35 @@ function Us(t) {
|
|
|
4235
4235
|
return n === Object ? !0 : typeof n == "function" && Function.toString.call(n) === Ko;
|
|
4236
4236
|
}
|
|
4237
4237
|
function bn(t, e) {
|
|
4238
|
-
|
|
4238
|
+
Sn(t) === 0 ? Reflect.ownKeys(t).forEach((n) => {
|
|
4239
4239
|
e(n, t[n], t);
|
|
4240
4240
|
}) : t.forEach((n, r) => e(r, n, t));
|
|
4241
4241
|
}
|
|
4242
|
-
function
|
|
4242
|
+
function Sn(t) {
|
|
4243
4243
|
const e = t[ce];
|
|
4244
|
-
return e ? e.type_ : Array.isArray(t) ? 1 :
|
|
4244
|
+
return e ? e.type_ : Array.isArray(t) ? 1 : xn(t) ? 2 : On(t) ? 3 : 0;
|
|
4245
4245
|
}
|
|
4246
4246
|
function hr(t, e) {
|
|
4247
|
-
return
|
|
4247
|
+
return Sn(t) === 2 ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
4248
4248
|
}
|
|
4249
4249
|
function Vs(t, e, n) {
|
|
4250
|
-
const r =
|
|
4250
|
+
const r = Sn(t);
|
|
4251
4251
|
r === 2 ? t.set(e, n) : r === 3 ? t.add(n) : t[e] = n;
|
|
4252
4252
|
}
|
|
4253
4253
|
function Bo(t, e) {
|
|
4254
4254
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
4255
4255
|
}
|
|
4256
|
-
function
|
|
4256
|
+
function xn(t) {
|
|
4257
4257
|
return t instanceof Map;
|
|
4258
4258
|
}
|
|
4259
4259
|
function On(t) {
|
|
4260
4260
|
return t instanceof Set;
|
|
4261
4261
|
}
|
|
4262
|
-
function
|
|
4262
|
+
function He(t) {
|
|
4263
4263
|
return t.copy_ || t.base_;
|
|
4264
4264
|
}
|
|
4265
4265
|
function pr(t, e) {
|
|
4266
|
-
if (
|
|
4266
|
+
if (xn(t))
|
|
4267
4267
|
return new Map(t);
|
|
4268
4268
|
if (On(t))
|
|
4269
4269
|
return new Set(t);
|
|
@@ -4288,13 +4288,13 @@ function pr(t, e) {
|
|
|
4288
4288
|
} else {
|
|
4289
4289
|
const r = _t(t);
|
|
4290
4290
|
if (r !== null && n)
|
|
4291
|
-
return
|
|
4291
|
+
return Be({}, t);
|
|
4292
4292
|
const s = Object.create(r);
|
|
4293
4293
|
return Object.assign(s, t);
|
|
4294
4294
|
}
|
|
4295
4295
|
}
|
|
4296
4296
|
function Kt(t, e = !1) {
|
|
4297
|
-
return Tn(t) || bt(t) || !
|
|
4297
|
+
return Tn(t) || bt(t) || !nt(t) || (Sn(t) > 1 && (t.set = t.add = t.clear = t.delete = qo), Object.freeze(t), e && Object.entries(t).forEach(([n, r]) => Kt(r, !0))), t;
|
|
4298
4298
|
}
|
|
4299
4299
|
function qo() {
|
|
4300
4300
|
ae(2);
|
|
@@ -4303,7 +4303,7 @@ function Tn(t) {
|
|
|
4303
4303
|
return Object.isFrozen(t);
|
|
4304
4304
|
}
|
|
4305
4305
|
var Ho = {};
|
|
4306
|
-
function
|
|
4306
|
+
function rt(t) {
|
|
4307
4307
|
const e = Ho[t];
|
|
4308
4308
|
return e || ae(0, t), e;
|
|
4309
4309
|
}
|
|
@@ -4323,7 +4323,7 @@ function Go(t, e) {
|
|
|
4323
4323
|
};
|
|
4324
4324
|
}
|
|
4325
4325
|
function fs(t, e) {
|
|
4326
|
-
e && (
|
|
4326
|
+
e && (rt("Patches"), t.patches_ = [], t.inversePatches_ = [], t.patchListener_ = e);
|
|
4327
4327
|
}
|
|
4328
4328
|
function mr(t) {
|
|
4329
4329
|
yr(t), t.drafts_.forEach(Jo), t.drafts_ = null;
|
|
@@ -4341,7 +4341,7 @@ function Jo(t) {
|
|
|
4341
4341
|
function ps(t, e) {
|
|
4342
4342
|
e.unfinalizedDrafts_ = e.drafts_.length;
|
|
4343
4343
|
const n = e.drafts_[0];
|
|
4344
|
-
return t !== void 0 && t !== n ? (n[ce].modified_ && (mr(e), ae(4)),
|
|
4344
|
+
return t !== void 0 && t !== n ? (n[ce].modified_ && (mr(e), ae(4)), nt(t) && (t = wn(e, t), e.parent_ || kn(e, t)), e.patches_ && rt("Patches").generateReplacementPatches_(
|
|
4345
4345
|
n[ce].base_,
|
|
4346
4346
|
t,
|
|
4347
4347
|
e.patches_,
|
|
@@ -4368,7 +4368,7 @@ function wn(t, e, n) {
|
|
|
4368
4368
|
r.type_ === 3 && (a = new Set(s), s.clear(), i = !0), bn(
|
|
4369
4369
|
a,
|
|
4370
4370
|
(o, c) => ms(t, r, s, o, c, n, i)
|
|
4371
|
-
), kn(t, s, !1), n && t.patches_ &&
|
|
4371
|
+
), kn(t, s, !1), n && t.patches_ && rt("Patches").generatePatches_(
|
|
4372
4372
|
r,
|
|
4373
4373
|
n,
|
|
4374
4374
|
t.patches_,
|
|
@@ -4386,7 +4386,7 @@ function ms(t, e, n, r, s, a, i) {
|
|
|
4386
4386
|
else
|
|
4387
4387
|
return;
|
|
4388
4388
|
} else i && n.add(s);
|
|
4389
|
-
if (
|
|
4389
|
+
if (nt(s) && !Tn(s)) {
|
|
4390
4390
|
if (!t.immer_.autoFreeze_ && t.unfinalizedDrafts_ < 1)
|
|
4391
4391
|
return;
|
|
4392
4392
|
wn(t, s), (!e || !e.scope_.parent_) && typeof r != "symbol" && Object.prototype.propertyIsEnumerable.call(n, r) && kn(t, s);
|
|
@@ -4428,24 +4428,24 @@ var jr = {
|
|
|
4428
4428
|
get(t, e) {
|
|
4429
4429
|
if (e === ce)
|
|
4430
4430
|
return t;
|
|
4431
|
-
const n =
|
|
4431
|
+
const n = He(t);
|
|
4432
4432
|
if (!hr(n, e))
|
|
4433
4433
|
return Yo(t, n, e);
|
|
4434
4434
|
const r = n[e];
|
|
4435
|
-
return t.finalized_ || !
|
|
4435
|
+
return t.finalized_ || !nt(r) ? r : r === Dn(t.base_, e) ? (Mn(t), t.copy_[e] = vr(r, t)) : r;
|
|
4436
4436
|
},
|
|
4437
4437
|
has(t, e) {
|
|
4438
|
-
return e in
|
|
4438
|
+
return e in He(t);
|
|
4439
4439
|
},
|
|
4440
4440
|
ownKeys(t) {
|
|
4441
|
-
return Reflect.ownKeys(
|
|
4441
|
+
return Reflect.ownKeys(He(t));
|
|
4442
4442
|
},
|
|
4443
4443
|
set(t, e, n) {
|
|
4444
|
-
const r = Bs(
|
|
4444
|
+
const r = Bs(He(t), e);
|
|
4445
4445
|
if (r != null && r.set)
|
|
4446
4446
|
return r.set.call(t.draft_, n), !0;
|
|
4447
4447
|
if (!t.modified_) {
|
|
4448
|
-
const s = Dn(
|
|
4448
|
+
const s = Dn(He(t), e), a = s == null ? void 0 : s[ce];
|
|
4449
4449
|
if (a && a.base_ === n)
|
|
4450
4450
|
return t.copy_[e] = n, t.assigned_[e] = !1, !0;
|
|
4451
4451
|
if (Bo(n, s) && (n !== void 0 || hr(t.base_, e)))
|
|
@@ -4462,7 +4462,7 @@ var jr = {
|
|
|
4462
4462
|
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
4463
4463
|
// the same guarantee in ES5 mode.
|
|
4464
4464
|
getOwnPropertyDescriptor(t, e) {
|
|
4465
|
-
const n =
|
|
4465
|
+
const n = He(t), r = Reflect.getOwnPropertyDescriptor(n, e);
|
|
4466
4466
|
return r && {
|
|
4467
4467
|
writable: !0,
|
|
4468
4468
|
configurable: t.type_ !== 1 || e !== "length",
|
|
@@ -4493,7 +4493,7 @@ qt.set = function(t, e, n) {
|
|
|
4493
4493
|
};
|
|
4494
4494
|
function Dn(t, e) {
|
|
4495
4495
|
const n = t[ce];
|
|
4496
|
-
return (n ?
|
|
4496
|
+
return (n ? He(n) : t)[e];
|
|
4497
4497
|
}
|
|
4498
4498
|
function Yo(t, e, n) {
|
|
4499
4499
|
var s;
|
|
@@ -4537,7 +4537,7 @@ var Qo = class {
|
|
|
4537
4537
|
}
|
|
4538
4538
|
typeof n != "function" && ae(6), r !== void 0 && typeof r != "function" && ae(7);
|
|
4539
4539
|
let s;
|
|
4540
|
-
if (
|
|
4540
|
+
if (nt(e)) {
|
|
4541
4541
|
const a = hs(this), i = vr(e, void 0);
|
|
4542
4542
|
let o = !0;
|
|
4543
4543
|
try {
|
|
@@ -4549,7 +4549,7 @@ var Qo = class {
|
|
|
4549
4549
|
} else if (!e || typeof e != "object") {
|
|
4550
4550
|
if (s = n(e), s === void 0 && (s = e), s === zs && (s = void 0), this.autoFreeze_ && Kt(s, !0), r) {
|
|
4551
4551
|
const a = [], i = [];
|
|
4552
|
-
|
|
4552
|
+
rt("Patches").generateReplacementPatches_(e, s, a, i), r(a, i);
|
|
4553
4553
|
}
|
|
4554
4554
|
return s;
|
|
4555
4555
|
} else
|
|
@@ -4564,7 +4564,7 @@ var Qo = class {
|
|
|
4564
4564
|
}, typeof (t == null ? void 0 : t.autoFreeze) == "boolean" && this.setAutoFreeze(t.autoFreeze), typeof (t == null ? void 0 : t.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(t.useStrictShallowCopy);
|
|
4565
4565
|
}
|
|
4566
4566
|
createDraft(t) {
|
|
4567
|
-
|
|
4567
|
+
nt(t) || ae(8), bt(t) && (t = ec(t));
|
|
4568
4568
|
const e = hs(this), n = vr(t, void 0);
|
|
4569
4569
|
return n[ce].isManual_ = !0, yr(e), n;
|
|
4570
4570
|
}
|
|
@@ -4600,7 +4600,7 @@ var Qo = class {
|
|
|
4600
4600
|
}
|
|
4601
4601
|
}
|
|
4602
4602
|
n > -1 && (e = e.slice(n + 1));
|
|
4603
|
-
const r =
|
|
4603
|
+
const r = rt("Patches").applyPatches_;
|
|
4604
4604
|
return bt(t) ? r(t, e) : this.produce(
|
|
4605
4605
|
t,
|
|
4606
4606
|
(s) => r(s, e)
|
|
@@ -4608,14 +4608,14 @@ var Qo = class {
|
|
|
4608
4608
|
}
|
|
4609
4609
|
};
|
|
4610
4610
|
function vr(t, e) {
|
|
4611
|
-
const n =
|
|
4611
|
+
const n = xn(t) ? rt("MapSet").proxyMap_(t, e) : On(t) ? rt("MapSet").proxySet_(t, e) : Xo(t, e);
|
|
4612
4612
|
return (e ? e.scope_ : Ks()).drafts_.push(n), n;
|
|
4613
4613
|
}
|
|
4614
4614
|
function ec(t) {
|
|
4615
4615
|
return bt(t) || ae(10, t), qs(t);
|
|
4616
4616
|
}
|
|
4617
4617
|
function qs(t) {
|
|
4618
|
-
if (!
|
|
4618
|
+
if (!nt(t) || Tn(t))
|
|
4619
4619
|
return t;
|
|
4620
4620
|
const e = t[ce];
|
|
4621
4621
|
let n;
|
|
@@ -4671,7 +4671,7 @@ const ys = 10, gs = {
|
|
|
4671
4671
|
}) => {
|
|
4672
4672
|
const [n, r] = nc(gs);
|
|
4673
4673
|
return {
|
|
4674
|
-
getCode: (a) =>
|
|
4674
|
+
getCode: (a) => Ze(void 0, null, function* () {
|
|
4675
4675
|
var h, p, k;
|
|
4676
4676
|
r((v) => {
|
|
4677
4677
|
v.status = "pending", v.error = null, v.result = null, v.tasks = gs.tasks;
|
|
@@ -4688,7 +4688,7 @@ const ys = 10, gs = {
|
|
|
4688
4688
|
}
|
|
4689
4689
|
let o;
|
|
4690
4690
|
const c = new dn(t, {
|
|
4691
|
-
fetch: (v, b) => (o = fetch(v, Br(
|
|
4691
|
+
fetch: (v, b) => (o = fetch(v, Br(Be({}, b), {
|
|
4692
4692
|
method: e,
|
|
4693
4693
|
body: JSON.stringify(a)
|
|
4694
4694
|
})), o)
|
|
@@ -4765,8 +4765,8 @@ const ys = 10, gs = {
|
|
|
4765
4765
|
b.assets = l.payload.assets;
|
|
4766
4766
|
});
|
|
4767
4767
|
let m = 0;
|
|
4768
|
-
c.addEventListener("error", (g) =>
|
|
4769
|
-
var U, D, M;
|
|
4768
|
+
c.addEventListener("error", (g) => Ze(void 0, null, function* () {
|
|
4769
|
+
var U, D, M, de, L, Te;
|
|
4770
4770
|
console.warn(
|
|
4771
4771
|
`Experienced error during code generation (attempt ${m + 1} / ${ys})`,
|
|
4772
4772
|
g
|
|
@@ -4776,26 +4776,26 @@ const ys = 10, gs = {
|
|
|
4776
4776
|
if (g instanceof MessageEvent)
|
|
4777
4777
|
l = JSON.parse(g.data);
|
|
4778
4778
|
else {
|
|
4779
|
-
const
|
|
4780
|
-
O =
|
|
4779
|
+
const ne = yield o;
|
|
4780
|
+
O = ne.status;
|
|
4781
4781
|
try {
|
|
4782
|
-
l = yield
|
|
4783
|
-
} catch (
|
|
4782
|
+
l = yield ne.json();
|
|
4783
|
+
} catch (le) {
|
|
4784
4784
|
}
|
|
4785
4785
|
}
|
|
4786
|
-
(((U = l == null ? void 0 : l.payload) == null ? void 0 : U.name) === "Task Crashed" || O === 429) && (I = !0);
|
|
4787
|
-
} catch (
|
|
4786
|
+
(((U = l == null ? void 0 : l.payload) == null ? void 0 : U.name) === "Task Crashed" || ((D = l == null ? void 0 : l.payload) == null ? void 0 : D.name) === "TimeoutError" || ((M = l == null ? void 0 : l.payload) == null ? void 0 : M.name) === "Error" || ((de = l == null ? void 0 : l.payload) == null ? void 0 : de.name) === "Unknown error" || O === 429) && (I = !0);
|
|
4787
|
+
} catch (ne) {
|
|
4788
4788
|
}
|
|
4789
4789
|
const K = new Gr({
|
|
4790
|
-
name: (
|
|
4791
|
-
reason: (
|
|
4790
|
+
name: (L = l == null ? void 0 : l.payload.name) != null ? L : "Unknown error",
|
|
4791
|
+
reason: (Te = l == null ? void 0 : l.payload.message) != null ? Te : "Unknown",
|
|
4792
4792
|
status: l == null ? void 0 : l.payload.status,
|
|
4793
4793
|
detail: l == null ? void 0 : l.payload.detail
|
|
4794
4794
|
});
|
|
4795
4795
|
m++;
|
|
4796
4796
|
let Z = !1;
|
|
4797
|
-
m > ys ? (console.error("Experienced too many errors, terminating request"), Z = !0) : I && (console.error("Experienced unrecoverable error, terminating request"), Z = !0), Z && (r((
|
|
4798
|
-
|
|
4797
|
+
m > ys ? (console.error("Experienced too many errors, terminating request"), Z = !0) : I && (console.error("Experienced unrecoverable error, terminating request"), Z = !0), Z && (r((ne) => {
|
|
4798
|
+
ne.status = "error", ne.error = K;
|
|
4799
4799
|
}), v({
|
|
4800
4800
|
result: null,
|
|
4801
4801
|
error: K
|
|
@@ -4812,7 +4812,7 @@ const ys = 10, gs = {
|
|
|
4812
4812
|
if (((p = i.assetsStorage) == null ? void 0 : p.strategy) === "local" && ((k = m == null ? void 0 : m.assets) != null && k.length)) {
|
|
4813
4813
|
const { filePath: g } = vs(
|
|
4814
4814
|
i.assetsStorage
|
|
4815
|
-
), l = m.assets.map((I) =>
|
|
4815
|
+
), l = m.assets.map((I) => Ze(void 0, null, function* () {
|
|
4816
4816
|
const Z = yield (yield fetch(I.url)).arrayBuffer();
|
|
4817
4817
|
return {
|
|
4818
4818
|
assetName: I.name,
|
|
@@ -4966,7 +4966,7 @@ function ac() {
|
|
|
4966
4966
|
}
|
|
4967
4967
|
var ic = ac();
|
|
4968
4968
|
const Hs = 0, Gs = 1, Js = 2, ks = 3;
|
|
4969
|
-
var
|
|
4969
|
+
var Es = Object.prototype.hasOwnProperty;
|
|
4970
4970
|
function _r(t, e) {
|
|
4971
4971
|
var n, r;
|
|
4972
4972
|
if (t === e) return !0;
|
|
@@ -4981,18 +4981,18 @@ function _r(t, e) {
|
|
|
4981
4981
|
if (!n || typeof t == "object") {
|
|
4982
4982
|
r = 0;
|
|
4983
4983
|
for (n in t)
|
|
4984
|
-
if (
|
|
4984
|
+
if (Es.call(t, n) && ++r && !Es.call(e, n) || !(n in e) || !_r(t[n], e[n])) return !1;
|
|
4985
4985
|
return Object.keys(e).length === r;
|
|
4986
4986
|
}
|
|
4987
4987
|
}
|
|
4988
4988
|
return t !== t && e !== e;
|
|
4989
4989
|
}
|
|
4990
|
-
const
|
|
4991
|
-
},
|
|
4990
|
+
const Ie = /* @__PURE__ */ new WeakMap(), $e = () => {
|
|
4991
|
+
}, ee = (
|
|
4992
4992
|
/*#__NOINLINE__*/
|
|
4993
|
-
|
|
4994
|
-
), br = Object, R = (t) => t ===
|
|
4995
|
-
const n =
|
|
4993
|
+
$e()
|
|
4994
|
+
), br = Object, R = (t) => t === ee, ke = (t) => typeof t == "function", Ve = (t, e) => Be(Be({}, t), e), Xs = (t) => ke(t.then), Fn = {}, nn = {}, Ir = "undefined", Xt = typeof window != Ir, wr = typeof document != Ir, oc = Xt && "Deno" in window, cc = () => Xt && typeof window.requestAnimationFrame != Ir, Ys = (t, e) => {
|
|
4995
|
+
const n = Ie.get(t);
|
|
4996
4996
|
return [
|
|
4997
4997
|
// Getter
|
|
4998
4998
|
() => !R(e) && t.get(e) || Fn,
|
|
@@ -5000,7 +5000,7 @@ const Re = /* @__PURE__ */ new WeakMap(), Me = () => {
|
|
|
5000
5000
|
(r) => {
|
|
5001
5001
|
if (!R(e)) {
|
|
5002
5002
|
const s = t.get(e);
|
|
5003
|
-
e in nn || (nn[e] = s), n[5](e,
|
|
5003
|
+
e in nn || (nn[e] = s), n[5](e, Ve(s, r), s || Fn);
|
|
5004
5004
|
}
|
|
5005
5005
|
},
|
|
5006
5006
|
// Subscriber
|
|
@@ -5010,25 +5010,25 @@ const Re = /* @__PURE__ */ new WeakMap(), Me = () => {
|
|
|
5010
5010
|
];
|
|
5011
5011
|
};
|
|
5012
5012
|
let kr = !0;
|
|
5013
|
-
const uc = () => kr, [
|
|
5013
|
+
const uc = () => kr, [Er, Sr] = Xt && window.addEventListener ? [
|
|
5014
5014
|
window.addEventListener.bind(window),
|
|
5015
5015
|
window.removeEventListener.bind(window)
|
|
5016
5016
|
] : [
|
|
5017
|
-
|
|
5018
|
-
|
|
5017
|
+
$e,
|
|
5018
|
+
$e
|
|
5019
5019
|
], dc = () => {
|
|
5020
5020
|
const t = wr && document.visibilityState;
|
|
5021
5021
|
return R(t) || t !== "hidden";
|
|
5022
|
-
}, lc = (t) => (wr && document.addEventListener("visibilitychange", t),
|
|
5023
|
-
wr && document.removeEventListener("visibilitychange", t),
|
|
5022
|
+
}, lc = (t) => (wr && document.addEventListener("visibilitychange", t), Er("focus", t), () => {
|
|
5023
|
+
wr && document.removeEventListener("visibilitychange", t), Sr("focus", t);
|
|
5024
5024
|
}), fc = (t) => {
|
|
5025
5025
|
const e = () => {
|
|
5026
5026
|
kr = !0, t();
|
|
5027
5027
|
}, n = () => {
|
|
5028
5028
|
kr = !1;
|
|
5029
5029
|
};
|
|
5030
|
-
return
|
|
5031
|
-
|
|
5030
|
+
return Er("online", e), Er("offline", n), () => {
|
|
5031
|
+
Sr("online", e), Sr("offline", n);
|
|
5032
5032
|
};
|
|
5033
5033
|
}, hc = {
|
|
5034
5034
|
isOnline: uc,
|
|
@@ -5036,40 +5036,40 @@ const uc = () => kr, [Sr, xr] = Xt && window.addEventListener ? [
|
|
|
5036
5036
|
}, pc = {
|
|
5037
5037
|
initFocus: lc,
|
|
5038
5038
|
initReconnect: fc
|
|
5039
|
-
},
|
|
5039
|
+
}, Ss = !Gt.useId, Ht = !Xt || oc, mc = (t) => cc() ? window.requestAnimationFrame(t) : setTimeout(t, 1), Wn = Ht ? ha : pa, zn = typeof navigator != "undefined" && navigator.connection, xs = !Ht && zn && ([
|
|
5040
5040
|
"slow-2g",
|
|
5041
5041
|
"2g"
|
|
5042
5042
|
].includes(zn.effectiveType) || zn.saveData), rn = /* @__PURE__ */ new WeakMap(), Un = (t, e) => br.prototype.toString.call(t) === `[object ${e}]`;
|
|
5043
5043
|
let yc = 0;
|
|
5044
|
-
const
|
|
5044
|
+
const xr = (t) => {
|
|
5045
5045
|
const e = typeof t, n = Un(t, "Date"), r = Un(t, "RegExp"), s = Un(t, "Object");
|
|
5046
5046
|
let a, i;
|
|
5047
5047
|
if (br(t) === t && !n && !r) {
|
|
5048
5048
|
if (a = rn.get(t), a) return a;
|
|
5049
5049
|
if (a = ++yc + "~", rn.set(t, a), Array.isArray(t)) {
|
|
5050
5050
|
for (a = "@", i = 0; i < t.length; i++)
|
|
5051
|
-
a +=
|
|
5051
|
+
a += xr(t[i]) + ",";
|
|
5052
5052
|
rn.set(t, a);
|
|
5053
5053
|
}
|
|
5054
5054
|
if (s) {
|
|
5055
5055
|
a = "#";
|
|
5056
5056
|
const o = br.keys(t).sort();
|
|
5057
5057
|
for (; !R(i = o.pop()); )
|
|
5058
|
-
R(t[i]) || (a += i + ":" +
|
|
5058
|
+
R(t[i]) || (a += i + ":" + xr(t[i]) + ",");
|
|
5059
5059
|
rn.set(t, a);
|
|
5060
5060
|
}
|
|
5061
5061
|
} else
|
|
5062
5062
|
a = n ? t.toJSON() : e == "symbol" ? t.toString() : e == "string" ? JSON.stringify(t) : "" + t;
|
|
5063
5063
|
return a;
|
|
5064
5064
|
}, Pr = (t) => {
|
|
5065
|
-
if (
|
|
5065
|
+
if (ke(t))
|
|
5066
5066
|
try {
|
|
5067
5067
|
t = t();
|
|
5068
5068
|
} catch (n) {
|
|
5069
5069
|
t = "";
|
|
5070
5070
|
}
|
|
5071
5071
|
const e = t;
|
|
5072
|
-
return t = typeof t == "string" ? t : (Array.isArray(t) ? t.length : t) ?
|
|
5072
|
+
return t = typeof t == "string" ? t : (Array.isArray(t) ? t.length : t) ? xr(t) : "", [
|
|
5073
5073
|
t,
|
|
5074
5074
|
e
|
|
5075
5075
|
];
|
|
@@ -5077,8 +5077,8 @@ const Er = (t) => {
|
|
|
5077
5077
|
let gc = 0;
|
|
5078
5078
|
const Or = () => ++gc;
|
|
5079
5079
|
function Qs(...t) {
|
|
5080
|
-
return
|
|
5081
|
-
const [e, n, r, s] = t, a =
|
|
5080
|
+
return Ze(this, null, function* () {
|
|
5081
|
+
const [e, n, r, s] = t, a = Ve({
|
|
5082
5082
|
populateCache: !0,
|
|
5083
5083
|
throwOnError: !0
|
|
5084
5084
|
}, typeof s == "boolean" ? {
|
|
@@ -5088,7 +5088,7 @@ function Qs(...t) {
|
|
|
5088
5088
|
const o = a.rollbackOnError;
|
|
5089
5089
|
let c = a.optimisticData;
|
|
5090
5090
|
const u = (k) => typeof o == "function" ? o(k) : o !== !1, h = a.throwOnError;
|
|
5091
|
-
if (
|
|
5091
|
+
if (ke(n)) {
|
|
5092
5092
|
const k = n, v = [], b = e.keys();
|
|
5093
5093
|
for (const m of b)
|
|
5094
5094
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
@@ -5097,12 +5097,12 @@ function Qs(...t) {
|
|
|
5097
5097
|
}
|
|
5098
5098
|
return p(n);
|
|
5099
5099
|
function p(k) {
|
|
5100
|
-
return
|
|
5100
|
+
return Ze(this, null, function* () {
|
|
5101
5101
|
const [v] = Pr(k);
|
|
5102
5102
|
if (!v) return;
|
|
5103
|
-
const [b, m] = Ys(e, v), [g, l, O, I] =
|
|
5104
|
-
const
|
|
5105
|
-
return (
|
|
5103
|
+
const [b, m] = Ys(e, v), [g, l, O, I] = Ie.get(e), K = () => {
|
|
5104
|
+
const le = g[v];
|
|
5105
|
+
return (ke(a.revalidate) ? a.revalidate(b().data, k) : a.revalidate !== !1) && (delete O[v], delete I[v], le && le[0]) ? le[0](Js).then(() => b().data) : b().data;
|
|
5106
5106
|
};
|
|
5107
5107
|
if (t.length < 3)
|
|
5108
5108
|
return K();
|
|
@@ -5112,43 +5112,43 @@ function Qs(...t) {
|
|
|
5112
5112
|
D,
|
|
5113
5113
|
0
|
|
5114
5114
|
];
|
|
5115
|
-
const M = !R(c),
|
|
5116
|
-
if (M && (c =
|
|
5115
|
+
const M = !R(c), de = b(), L = de.data, Te = de._c, ne = R(Te) ? L : Te;
|
|
5116
|
+
if (M && (c = ke(c) ? c(ne, L) : c, m({
|
|
5117
5117
|
data: c,
|
|
5118
|
-
_c:
|
|
5119
|
-
})),
|
|
5118
|
+
_c: ne
|
|
5119
|
+
})), ke(Z))
|
|
5120
5120
|
try {
|
|
5121
|
-
Z = Z(
|
|
5122
|
-
} catch (
|
|
5123
|
-
U =
|
|
5121
|
+
Z = Z(ne);
|
|
5122
|
+
} catch (le) {
|
|
5123
|
+
U = le;
|
|
5124
5124
|
}
|
|
5125
5125
|
if (Z && Xs(Z))
|
|
5126
|
-
if (Z = yield Z.catch((
|
|
5127
|
-
U =
|
|
5126
|
+
if (Z = yield Z.catch((le) => {
|
|
5127
|
+
U = le;
|
|
5128
5128
|
}), D !== l[v][0]) {
|
|
5129
5129
|
if (U) throw U;
|
|
5130
5130
|
return Z;
|
|
5131
5131
|
} else U && M && u(U) && (i = !0, m({
|
|
5132
|
-
data:
|
|
5133
|
-
_c:
|
|
5132
|
+
data: ne,
|
|
5133
|
+
_c: ee
|
|
5134
5134
|
}));
|
|
5135
5135
|
if (i && !U)
|
|
5136
|
-
if (
|
|
5137
|
-
const
|
|
5136
|
+
if (ke(i)) {
|
|
5137
|
+
const le = i(Z, ne);
|
|
5138
5138
|
m({
|
|
5139
|
-
data:
|
|
5140
|
-
error:
|
|
5141
|
-
_c:
|
|
5139
|
+
data: le,
|
|
5140
|
+
error: ee,
|
|
5141
|
+
_c: ee
|
|
5142
5142
|
});
|
|
5143
5143
|
} else
|
|
5144
5144
|
m({
|
|
5145
5145
|
data: Z,
|
|
5146
|
-
error:
|
|
5147
|
-
_c:
|
|
5146
|
+
error: ee,
|
|
5147
|
+
_c: ee
|
|
5148
5148
|
});
|
|
5149
5149
|
if (l[v][1] = Or(), Promise.resolve(K()).then(() => {
|
|
5150
5150
|
m({
|
|
5151
|
-
_c:
|
|
5151
|
+
_c: ee
|
|
5152
5152
|
});
|
|
5153
5153
|
}), U) {
|
|
5154
5154
|
if (h) throw U;
|
|
@@ -5163,9 +5163,9 @@ const Os = (t, e) => {
|
|
|
5163
5163
|
for (const n in t)
|
|
5164
5164
|
t[n][0] && t[n][0](e);
|
|
5165
5165
|
}, vc = (t, e) => {
|
|
5166
|
-
if (!
|
|
5167
|
-
const n =
|
|
5168
|
-
let a =
|
|
5166
|
+
if (!Ie.has(t)) {
|
|
5167
|
+
const n = Ve(pc, e), r = /* @__PURE__ */ Object.create(null), s = Qs.bind(ee, t);
|
|
5168
|
+
let a = $e;
|
|
5169
5169
|
const i = /* @__PURE__ */ Object.create(null), o = (h, p) => {
|
|
5170
5170
|
const k = i[h] || [];
|
|
5171
5171
|
return i[h] = k, k.push(p), () => k.splice(k.indexOf(p), 1);
|
|
@@ -5176,7 +5176,7 @@ const Os = (t, e) => {
|
|
|
5176
5176
|
for (const b of v)
|
|
5177
5177
|
b(p, k);
|
|
5178
5178
|
}, u = () => {
|
|
5179
|
-
if (!
|
|
5179
|
+
if (!Ie.has(t) && (Ie.set(t, [
|
|
5180
5180
|
r,
|
|
5181
5181
|
/* @__PURE__ */ Object.create(null),
|
|
5182
5182
|
/* @__PURE__ */ Object.create(null),
|
|
@@ -5185,9 +5185,9 @@ const Os = (t, e) => {
|
|
|
5185
5185
|
c,
|
|
5186
5186
|
o
|
|
5187
5187
|
]), !Ht)) {
|
|
5188
|
-
const h = n.initFocus(setTimeout.bind(
|
|
5188
|
+
const h = n.initFocus(setTimeout.bind(ee, Os.bind(ee, r, Hs))), p = n.initReconnect(setTimeout.bind(ee, Os.bind(ee, r, Gs)));
|
|
5189
5189
|
a = () => {
|
|
5190
|
-
h && h(), p && p(),
|
|
5190
|
+
h && h(), p && p(), Ie.delete(t);
|
|
5191
5191
|
};
|
|
5192
5192
|
}
|
|
5193
5193
|
};
|
|
@@ -5200,29 +5200,29 @@ const Os = (t, e) => {
|
|
|
5200
5200
|
}
|
|
5201
5201
|
return [
|
|
5202
5202
|
t,
|
|
5203
|
-
|
|
5203
|
+
Ie.get(t)[4]
|
|
5204
5204
|
];
|
|
5205
5205
|
}, _c = (t, e, n, r, s) => {
|
|
5206
5206
|
const a = n.errorRetryCount, i = s.retryCount, o = ~~((Math.random() + 0.5) * (1 << (i < 8 ? i : 8))) * n.errorRetryInterval;
|
|
5207
5207
|
!R(a) && i > a || setTimeout(r, o, s);
|
|
5208
|
-
}, bc = _r, [ea, wc] = vc(/* @__PURE__ */ new Map()), kc =
|
|
5208
|
+
}, bc = _r, [ea, wc] = vc(/* @__PURE__ */ new Map()), kc = Ve(
|
|
5209
5209
|
{
|
|
5210
5210
|
// events
|
|
5211
|
-
onLoadingSlow:
|
|
5212
|
-
onSuccess:
|
|
5213
|
-
onError:
|
|
5211
|
+
onLoadingSlow: $e,
|
|
5212
|
+
onSuccess: $e,
|
|
5213
|
+
onError: $e,
|
|
5214
5214
|
onErrorRetry: _c,
|
|
5215
|
-
onDiscarded:
|
|
5215
|
+
onDiscarded: $e,
|
|
5216
5216
|
// switches
|
|
5217
5217
|
revalidateOnFocus: !0,
|
|
5218
5218
|
revalidateOnReconnect: !0,
|
|
5219
5219
|
revalidateIfStale: !0,
|
|
5220
5220
|
shouldRetryOnError: !0,
|
|
5221
5221
|
// timeouts
|
|
5222
|
-
errorRetryInterval:
|
|
5222
|
+
errorRetryInterval: xs ? 1e4 : 5e3,
|
|
5223
5223
|
focusThrottleInterval: 5 * 1e3,
|
|
5224
5224
|
dedupingInterval: 2 * 1e3,
|
|
5225
|
-
loadingTimeout:
|
|
5225
|
+
loadingTimeout: xs ? 5e3 : 3e3,
|
|
5226
5226
|
// providers
|
|
5227
5227
|
compare: bc,
|
|
5228
5228
|
isPaused: () => !1,
|
|
@@ -5232,16 +5232,16 @@ const Os = (t, e) => {
|
|
|
5232
5232
|
},
|
|
5233
5233
|
// use web preset by default
|
|
5234
5234
|
hc
|
|
5235
|
-
),
|
|
5236
|
-
const n =
|
|
5235
|
+
), Ec = (t, e) => {
|
|
5236
|
+
const n = Ve(t, e);
|
|
5237
5237
|
if (e) {
|
|
5238
5238
|
const { use: r, fallback: s } = t, { use: a, fallback: i } = e;
|
|
5239
|
-
r && a && (n.use = r.concat(a)), s && i && (n.fallback =
|
|
5239
|
+
r && a && (n.use = r.concat(a)), s && i && (n.fallback = Ve(s, i));
|
|
5240
5240
|
}
|
|
5241
5241
|
return n;
|
|
5242
|
-
},
|
|
5242
|
+
}, Sc = fa({}), xc = "$inf$", ta = Xt && window.__SWR_DEVTOOLS_USE__, Oc = ta ? window.__SWR_DEVTOOLS_USE__ : [], Tc = () => {
|
|
5243
5243
|
ta && (window.__SWR_DEVTOOLS_REACT__ = Gt);
|
|
5244
|
-
}, Ac = (t) =>
|
|
5244
|
+
}, Ac = (t) => ke(t[1]) ? [
|
|
5245
5245
|
t[0],
|
|
5246
5246
|
t[1],
|
|
5247
5247
|
t[2] || {}
|
|
@@ -5249,14 +5249,14 @@ const Os = (t, e) => {
|
|
|
5249
5249
|
t[0],
|
|
5250
5250
|
null,
|
|
5251
5251
|
(t[1] === null ? t[2] : t[1]) || {}
|
|
5252
|
-
], Cc = () =>
|
|
5253
|
-
const [i] = Pr(e), [, , , o] =
|
|
5254
|
-
if (i.startsWith(
|
|
5252
|
+
], Cc = () => Ve(kc, ma(Sc)), Nc = (t) => (e, n, r) => t(e, n && ((...a) => {
|
|
5253
|
+
const [i] = Pr(e), [, , , o] = Ie.get(ea);
|
|
5254
|
+
if (i.startsWith(xc))
|
|
5255
5255
|
return n(...a);
|
|
5256
5256
|
const c = o[i];
|
|
5257
5257
|
return R(c) ? n(...a) : (delete o[i], c);
|
|
5258
5258
|
}), r), Rc = Oc.concat(Nc), jc = (t) => function(...n) {
|
|
5259
|
-
const r = Cc(), [s, a, i] = Ac(n), o =
|
|
5259
|
+
const r = Cc(), [s, a, i] = Ac(n), o = Ec(r, i);
|
|
5260
5260
|
let c = t;
|
|
5261
5261
|
const { use: u } = o, h = (u || []).concat(Rc);
|
|
5262
5262
|
for (let p = h.length; p--; )
|
|
@@ -5292,29 +5292,29 @@ const Vn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5292
5292
|
}), Kn = {
|
|
5293
5293
|
dedupe: !0
|
|
5294
5294
|
}, Pc = (t, e, n) => {
|
|
5295
|
-
const { cache: r, compare: s, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale: c, refreshInterval: u, refreshWhenHidden: h, refreshWhenOffline: p, keepPreviousData: k } = n, [v, b, m, g] =
|
|
5296
|
-
for (const
|
|
5297
|
-
const V =
|
|
5295
|
+
const { cache: r, compare: s, suspense: a, fallbackData: i, revalidateOnMount: o, revalidateIfStale: c, refreshInterval: u, refreshWhenHidden: h, refreshWhenOffline: p, keepPreviousData: k } = n, [v, b, m, g] = Ie.get(r), [l, O] = Pr(t), I = qe(!1), K = qe(!1), Z = qe(l), U = qe(e), D = qe(n), M = () => D.current, de = () => M().isVisible() && M().isOnline(), [L, Te, ne, le] = Ys(r, l), st = qe({}).current, Yt = R(i) ? R(n.fallback) ? ee : n.fallback[l] : i, Zr = (F, $) => {
|
|
5296
|
+
for (const G in st) {
|
|
5297
|
+
const V = G;
|
|
5298
5298
|
if (V === "data") {
|
|
5299
|
-
if (!s(F[V],
|
|
5299
|
+
if (!s(F[V], $[V]) && (!R(F[V]) || !s(en, $[V])))
|
|
5300
5300
|
return !1;
|
|
5301
|
-
} else if (
|
|
5301
|
+
} else if ($[V] !== F[V])
|
|
5302
5302
|
return !1;
|
|
5303
5303
|
}
|
|
5304
5304
|
return !0;
|
|
5305
5305
|
}, Dr = ya(() => {
|
|
5306
|
-
const F = !l || !e ? !1 : R(o) ? M().isPaused() || a ? !1 : c !== !1 : o,
|
|
5307
|
-
const
|
|
5308
|
-
return delete
|
|
5306
|
+
const F = !l || !e ? !1 : R(o) ? M().isPaused() || a ? !1 : c !== !1 : o, $ = (Y) => {
|
|
5307
|
+
const Ae = Ve(Y);
|
|
5308
|
+
return delete Ae._k, F ? Be({
|
|
5309
5309
|
isValidating: !0,
|
|
5310
5310
|
isLoading: !0
|
|
5311
|
-
},
|
|
5312
|
-
},
|
|
5313
|
-
let H =
|
|
5311
|
+
}, Ae) : Ae;
|
|
5312
|
+
}, G = L(), V = le(), pe = $(G), ot = G === V ? pe : $(V);
|
|
5313
|
+
let H = pe;
|
|
5314
5314
|
return [
|
|
5315
5315
|
() => {
|
|
5316
|
-
const
|
|
5317
|
-
return Zr(
|
|
5316
|
+
const Y = $(L());
|
|
5317
|
+
return Zr(Y, H) ? (H.data = Y.data, H.isLoading = Y.isLoading, H.isValidating = Y.isValidating, H.error = Y.error, H) : (H = Y, Y);
|
|
5318
5318
|
},
|
|
5319
5319
|
() => ot
|
|
5320
5320
|
];
|
|
@@ -5322,53 +5322,53 @@ const Vn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5322
5322
|
r,
|
|
5323
5323
|
l
|
|
5324
5324
|
]), at = ic.useSyncExternalStore(sn(
|
|
5325
|
-
(F) =>
|
|
5326
|
-
Zr(
|
|
5325
|
+
(F) => ne(l, ($, G) => {
|
|
5326
|
+
Zr(G, $) || F();
|
|
5327
5327
|
}),
|
|
5328
5328
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5329
5329
|
[
|
|
5330
5330
|
r,
|
|
5331
5331
|
l
|
|
5332
5332
|
]
|
|
5333
|
-
), Dr[0], Dr[1]), Mr = !I.current, na = v[l] && v[l].length > 0, it = at.data,
|
|
5334
|
-
(F) =>
|
|
5335
|
-
const
|
|
5336
|
-
if (!l ||
|
|
5333
|
+
), Dr[0], Dr[1]), Mr = !I.current, na = v[l] && v[l].length > 0, it = at.data, Ke = R(it) ? Yt && Xs(Yt) ? Vn(Yt) : Yt : it, Qt = at.error, An = qe(Ke), en = k ? R(it) ? R(An.current) ? Ke : An.current : it : Ke, Lr = na && !R(Qt) ? !1 : Mr && !R(o) ? o : M().isPaused() ? !1 : a ? R(Ke) ? !1 : c : R(Ke) || c, $r = !!(l && e && Mr && Lr), ra = R(at.isValidating) ? $r : at.isValidating, sa = R(at.isLoading) ? $r : at.isLoading, wt = sn(
|
|
5334
|
+
(F) => Ze(void 0, null, function* () {
|
|
5335
|
+
const $ = U.current;
|
|
5336
|
+
if (!l || !$ || K.current || M().isPaused())
|
|
5337
5337
|
return !1;
|
|
5338
|
-
let
|
|
5339
|
-
const ot = F || {}, H = !m[l] || !ot.dedupe,
|
|
5338
|
+
let G, V, pe = !0;
|
|
5339
|
+
const ot = F || {}, H = !m[l] || !ot.dedupe, Y = () => Ss ? !K.current && l === Z.current && I.current : l === Z.current, Ae = {
|
|
5340
5340
|
isValidating: !1,
|
|
5341
5341
|
isLoading: !1
|
|
5342
5342
|
}, Wr = () => {
|
|
5343
|
-
|
|
5343
|
+
Te(Ae);
|
|
5344
5344
|
}, zr = () => {
|
|
5345
|
-
const
|
|
5346
|
-
|
|
5345
|
+
const fe = m[l];
|
|
5346
|
+
fe && fe[1] === V && delete m[l];
|
|
5347
5347
|
}, Ur = {
|
|
5348
5348
|
isValidating: !0
|
|
5349
5349
|
};
|
|
5350
|
-
R(
|
|
5350
|
+
R(L().data) && (Ur.isLoading = !0);
|
|
5351
5351
|
try {
|
|
5352
|
-
if (H && (
|
|
5353
|
-
|
|
5352
|
+
if (H && (Te(Ur), n.loadingTimeout && R(L().data) && setTimeout(() => {
|
|
5353
|
+
pe && Y() && M().onLoadingSlow(l, n);
|
|
5354
5354
|
}, n.loadingTimeout), m[l] = [
|
|
5355
|
-
|
|
5355
|
+
$(O),
|
|
5356
5356
|
Or()
|
|
5357
|
-
]), [
|
|
5358
|
-
return H &&
|
|
5359
|
-
|
|
5360
|
-
const
|
|
5361
|
-
if (!R(
|
|
5362
|
-
(V <=
|
|
5363
|
-
V <=
|
|
5364
|
-
|
|
5365
|
-
return Wr(), H &&
|
|
5366
|
-
const
|
|
5367
|
-
|
|
5368
|
-
} catch (
|
|
5357
|
+
]), [G, V] = m[l], G = yield G, H && setTimeout(zr, n.dedupingInterval), !m[l] || m[l][1] !== V)
|
|
5358
|
+
return H && Y() && M().onDiscarded(l), !1;
|
|
5359
|
+
Ae.error = ee;
|
|
5360
|
+
const fe = b[l];
|
|
5361
|
+
if (!R(fe) && // case 1
|
|
5362
|
+
(V <= fe[0] || // case 2
|
|
5363
|
+
V <= fe[1] || // case 3
|
|
5364
|
+
fe[1] === 0))
|
|
5365
|
+
return Wr(), H && Y() && M().onDiscarded(l), !1;
|
|
5366
|
+
const Ce = L().data;
|
|
5367
|
+
Ae.data = s(Ce, G) ? Ce : G, H && Y() && M().onSuccess(G, l, n);
|
|
5368
|
+
} catch (fe) {
|
|
5369
5369
|
zr();
|
|
5370
|
-
const
|
|
5371
|
-
|
|
5370
|
+
const Ce = M(), { shouldRetryOnError: Cn } = Ce;
|
|
5371
|
+
Ce.isPaused() || (Ae.error = fe, H && Y() && (Ce.onError(fe, l, Ce), (Cn === !0 || ke(Cn) && Cn(fe)) && (!M().revalidateOnFocus || !M().revalidateOnReconnect || de()) && Ce.onErrorRetry(fe, l, Ce, (aa) => {
|
|
5372
5372
|
const Nn = v[l];
|
|
5373
5373
|
Nn && Nn[0] && Nn[0](ks, aa);
|
|
5374
5374
|
}, {
|
|
@@ -5376,7 +5376,7 @@ const Vn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5376
5376
|
dedupe: !0
|
|
5377
5377
|
})));
|
|
5378
5378
|
}
|
|
5379
|
-
return
|
|
5379
|
+
return pe = !1, Wr(), !0;
|
|
5380
5380
|
}),
|
|
5381
5381
|
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
5382
5382
|
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
@@ -5403,39 +5403,39 @@ const Vn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5403
5403
|
U.current = e, D.current = n, R(it) || (An.current = it);
|
|
5404
5404
|
}), Wn(() => {
|
|
5405
5405
|
if (!l) return;
|
|
5406
|
-
const F = wt.bind(
|
|
5407
|
-
let
|
|
5408
|
-
M().revalidateOnFocus && (
|
|
5409
|
-
const V = Ic(l, v, (
|
|
5410
|
-
if (
|
|
5406
|
+
const F = wt.bind(ee, Kn);
|
|
5407
|
+
let $ = 0;
|
|
5408
|
+
M().revalidateOnFocus && ($ = Date.now() + M().focusThrottleInterval);
|
|
5409
|
+
const V = Ic(l, v, (pe, ot = {}) => {
|
|
5410
|
+
if (pe == Hs) {
|
|
5411
5411
|
const H = Date.now();
|
|
5412
|
-
M().revalidateOnFocus && H >
|
|
5413
|
-
} else if (
|
|
5414
|
-
M().revalidateOnReconnect &&
|
|
5412
|
+
M().revalidateOnFocus && H > $ && de() && ($ = H + M().focusThrottleInterval, F());
|
|
5413
|
+
} else if (pe == Gs)
|
|
5414
|
+
M().revalidateOnReconnect && de() && F();
|
|
5415
5415
|
else {
|
|
5416
|
-
if (
|
|
5416
|
+
if (pe == Js)
|
|
5417
5417
|
return wt();
|
|
5418
|
-
if (
|
|
5418
|
+
if (pe == ks)
|
|
5419
5419
|
return wt(ot);
|
|
5420
5420
|
}
|
|
5421
5421
|
});
|
|
5422
|
-
return K.current = !1, Z.current = l, I.current = !0,
|
|
5422
|
+
return K.current = !1, Z.current = l, I.current = !0, Te({
|
|
5423
5423
|
_k: O
|
|
5424
|
-
}), Lr && (R(
|
|
5424
|
+
}), Lr && (R(Ke) || Ht ? F() : mc(F)), () => {
|
|
5425
5425
|
K.current = !0, V();
|
|
5426
5426
|
};
|
|
5427
5427
|
}, [
|
|
5428
5428
|
l
|
|
5429
5429
|
]), Wn(() => {
|
|
5430
5430
|
let F;
|
|
5431
|
-
function
|
|
5432
|
-
const V =
|
|
5433
|
-
V && F !== -1 && (F = setTimeout(
|
|
5431
|
+
function $() {
|
|
5432
|
+
const V = ke(u) ? u(L().data) : u;
|
|
5433
|
+
V && F !== -1 && (F = setTimeout(G, V));
|
|
5434
5434
|
}
|
|
5435
|
-
function
|
|
5436
|
-
|
|
5435
|
+
function G() {
|
|
5436
|
+
!L().error && (h || M().isVisible()) && (p || M().isOnline()) ? wt(Kn).then($) : $();
|
|
5437
5437
|
}
|
|
5438
|
-
return
|
|
5438
|
+
return $(), () => {
|
|
5439
5439
|
F && (clearTimeout(F), F = -1);
|
|
5440
5440
|
};
|
|
5441
5441
|
}, [
|
|
@@ -5443,18 +5443,18 @@ const Vn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5443
5443
|
h,
|
|
5444
5444
|
p,
|
|
5445
5445
|
l
|
|
5446
|
-
]), ga(en), a && R(
|
|
5447
|
-
if (!
|
|
5446
|
+
]), ga(en), a && R(Ke) && l) {
|
|
5447
|
+
if (!Ss && Ht)
|
|
5448
5448
|
throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
5449
5449
|
U.current = e, D.current = n, K.current = !1;
|
|
5450
5450
|
const F = g[l];
|
|
5451
5451
|
if (!R(F)) {
|
|
5452
|
-
const
|
|
5453
|
-
Vn(
|
|
5452
|
+
const $ = Fr(F);
|
|
5453
|
+
Vn($);
|
|
5454
5454
|
}
|
|
5455
5455
|
if (R(Qt)) {
|
|
5456
|
-
const
|
|
5457
|
-
R(en) || (
|
|
5456
|
+
const $ = wt(Kn);
|
|
5457
|
+
R(en) || ($.status = "fulfilled", $.value = !0), Vn($);
|
|
5458
5458
|
} else
|
|
5459
5459
|
throw Qt;
|
|
5460
5460
|
}
|