@animaapp/anima-sdk-react 0.6.27 → 0.6.29
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 +586 -586
- 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)
|
|
@@ -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, Sa = 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
|
+
Sa.call(e, n) && Hr(t, n, e[n]);
|
|
43
43
|
return t;
|
|
44
|
-
},
|
|
44
|
+
}, x = (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
|
|
70
|
+
const xa = "Figma Token Issue";
|
|
71
71
|
class Ea extends Error {
|
|
72
72
|
constructor({
|
|
73
73
|
fileKey: e,
|
|
74
74
|
reason: n,
|
|
75
75
|
cause: r
|
|
76
76
|
}) {
|
|
77
|
-
super(
|
|
77
|
+
super(xa), this.fileKey = e, this.reason = n, this.cause = r;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
const Oa = "Rate Limit Exceeded";
|
|
@@ -122,14 +122,14 @@ const Pa = (t, e) => {
|
|
|
122
122
|
};
|
|
123
123
|
var Za = Object.defineProperty, Da = Object.defineProperties, Ma = Object.getOwnPropertyDescriptors, Jr = Object.getOwnPropertySymbols, La = Object.prototype.hasOwnProperty, $a = Object.prototype.propertyIsEnumerable, Xr = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), Ts = (t) => {
|
|
124
124
|
throw TypeError(t);
|
|
125
|
-
}, Yr = (t, e, n) => e in t ? Za(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n,
|
|
125
|
+
}, Yr = (t, e, n) => e in t ? Za(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, ae = (t, e) => {
|
|
126
126
|
for (var n in e || (e = {}))
|
|
127
127
|
La.call(e, n) && Yr(t, n, e[n]);
|
|
128
128
|
if (Jr)
|
|
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),
|
|
132
|
+
}, Tr = (t, e) => Da(t, Ma(e)), Ar = (t, e, n) => e.has(t) || Ts("Cannot " + n), Z = (t, e, n) => (Ar(t, e, "read from private field"), n ? n.call(t) : e.get(t)), le = (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), be = (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));
|
|
@@ -154,42 +154,42 @@ function Va() {
|
|
|
154
154
|
(function(n, r) {
|
|
155
155
|
t.exports = r();
|
|
156
156
|
})(Ua, function() {
|
|
157
|
-
var n = typeof Promise == "function", r = typeof self == "object" ? self : Wa, s = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", h = s && typeof Symbol.iterator != "undefined", p = s && typeof Symbol.toStringTag != "undefined", k = i && typeof Set.prototype.entries == "function", v = a && typeof Map.prototype.entries == "function", b = k && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), m = v && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), g = h && typeof Array.prototype[Symbol.iterator] == "function", l = g && Object.getPrototypeOf([][Symbol.iterator]()),
|
|
158
|
-
function U(
|
|
159
|
-
var
|
|
160
|
-
if (
|
|
161
|
-
return
|
|
162
|
-
if (
|
|
157
|
+
var n = typeof Promise == "function", r = typeof self == "object" ? self : Wa, s = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", h = s && typeof Symbol.iterator != "undefined", p = s && typeof Symbol.toStringTag != "undefined", k = i && typeof Set.prototype.entries == "function", v = a && typeof Map.prototype.entries == "function", b = k && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), m = v && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), g = h && typeof Array.prototype[Symbol.iterator] == "function", l = g && Object.getPrototypeOf([][Symbol.iterator]()), O = h && typeof String.prototype[Symbol.iterator] == "function", P = O && Object.getPrototypeOf(""[Symbol.iterator]()), K = 8, D = -1;
|
|
158
|
+
function U(M) {
|
|
159
|
+
var L = typeof M;
|
|
160
|
+
if (L !== "object")
|
|
161
|
+
return L;
|
|
162
|
+
if (M === null)
|
|
163
163
|
return "null";
|
|
164
|
-
if (
|
|
164
|
+
if (M === r)
|
|
165
165
|
return "global";
|
|
166
|
-
if (Array.isArray(
|
|
166
|
+
if (Array.isArray(M) && (p === !1 || !(Symbol.toStringTag in M)))
|
|
167
167
|
return "Array";
|
|
168
168
|
if (typeof window == "object" && window !== null) {
|
|
169
|
-
if (typeof window.location == "object" &&
|
|
169
|
+
if (typeof window.location == "object" && M === window.location)
|
|
170
170
|
return "Location";
|
|
171
|
-
if (typeof window.document == "object" &&
|
|
171
|
+
if (typeof window.document == "object" && M === window.document)
|
|
172
172
|
return "Document";
|
|
173
173
|
if (typeof window.navigator == "object") {
|
|
174
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
174
|
+
if (typeof window.navigator.mimeTypes == "object" && M === window.navigator.mimeTypes)
|
|
175
175
|
return "MimeTypeArray";
|
|
176
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
176
|
+
if (typeof window.navigator.plugins == "object" && M === window.navigator.plugins)
|
|
177
177
|
return "PluginArray";
|
|
178
178
|
}
|
|
179
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
180
|
-
if (
|
|
179
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && M instanceof window.HTMLElement) {
|
|
180
|
+
if (M.tagName === "BLOCKQUOTE")
|
|
181
181
|
return "HTMLQuoteElement";
|
|
182
|
-
if (
|
|
182
|
+
if (M.tagName === "TD")
|
|
183
183
|
return "HTMLTableDataCellElement";
|
|
184
|
-
if (
|
|
184
|
+
if (M.tagName === "TH")
|
|
185
185
|
return "HTMLTableHeaderCellElement";
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
var
|
|
189
|
-
if (typeof
|
|
190
|
-
return
|
|
191
|
-
var
|
|
192
|
-
return
|
|
188
|
+
var ue = p && M[Symbol.toStringTag];
|
|
189
|
+
if (typeof ue == "string")
|
|
190
|
+
return ue;
|
|
191
|
+
var j = Object.getPrototypeOf(M);
|
|
192
|
+
return j === RegExp.prototype ? "RegExp" : j === Date.prototype ? "Date" : n && j === Promise.prototype ? "Promise" : i && j === Set.prototype ? "Set" : a && j === Map.prototype ? "Map" : c && j === WeakSet.prototype ? "WeakSet" : o && j === WeakMap.prototype ? "WeakMap" : u && j === DataView.prototype ? "DataView" : a && j === m ? "Map Iterator" : i && j === b ? "Set Iterator" : g && j === l ? "Array Iterator" : O && j === P ? "String Iterator" : j === null ? "Object" : Object.prototype.toString.call(M).slice(K, D);
|
|
193
193
|
}
|
|
194
194
|
return U;
|
|
195
195
|
});
|
|
@@ -321,7 +321,7 @@ function ci(t) {
|
|
|
321
321
|
function Ae(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() {
|
|
@@ -358,23 +358,23 @@ const fi = /* @__PURE__ */ new Map([
|
|
|
358
358
|
["Uint8Array", Ae],
|
|
359
359
|
["Uint8ClampedArray", Ae],
|
|
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,17 +460,17 @@ 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
|
-
le(this, Jn), le(this, an), le(this,
|
|
466
|
+
le(this, Jn), le(this, an), le(this, Ge), le(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
|
-
return yield
|
|
471
|
+
return yield Z(this, on).call(this);
|
|
472
472
|
} catch (e) {
|
|
473
|
-
if (
|
|
473
|
+
if (J(this, Ge, Z(this, Ge) + 1), Z(this, Ge) > Z(this, an))
|
|
474
474
|
throw console.error("Max attempts reached"), e;
|
|
475
475
|
const n = be(this, Jn, As).call(this);
|
|
476
476
|
return yield pi(n), yield this.run();
|
|
@@ -478,8 +478,8 @@ class mi {
|
|
|
478
478
|
});
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
an = /* @__PURE__ */ new WeakMap(),
|
|
482
|
-
return
|
|
481
|
+
an = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap(), on = /* @__PURE__ */ new WeakMap(), Jn = /* @__PURE__ */ new WeakSet(), As = function() {
|
|
482
|
+
return Z(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 St 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, ne, ve, Yn, Qn, xt;
|
|
574
|
+
class Si {
|
|
575
575
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: n }) {
|
|
576
|
-
le(this, ve), le(this,
|
|
576
|
+
le(this, ve), le(this, Je), le(this, ne), this.baseAddress = n, J(this, Je, e), J(this, ne, {}), this.plugins = [];
|
|
577
577
|
}
|
|
578
578
|
get headers() {
|
|
579
579
|
throw new Error("Missing implementation");
|
|
@@ -585,49 +585,49 @@ class xi {
|
|
|
585
585
|
this.plugins = this.plugins.filter((n) => n.name !== e);
|
|
586
586
|
}
|
|
587
587
|
withOptions(e = {}) {
|
|
588
|
-
return
|
|
588
|
+
return J(this, ne, 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
|
-
const c = kt(
|
|
595
|
-
return
|
|
594
|
+
const c = kt(Z(this, ne));
|
|
595
|
+
return J(this, ne, {}), c.extraHeaders && (o = ae(ae({}, o), c.extraHeaders)), c.requestValidation && (o = Tr(ae({}, o), { "X-Request-Nonce": Cs(), "X-Request-Timestamp": Xn() })), c.async ? yield be(this, ve, Qn).call(this, `${i}${n}`, c.async, { headers: o }) : yield be(this, ve, 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
|
-
const i = kt(
|
|
601
|
-
return
|
|
600
|
+
const i = kt(Z(this, ne));
|
|
601
|
+
return J(this, ne, {}), be(this, ve, xt).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
|
-
const i = kt(
|
|
607
|
-
return
|
|
606
|
+
const i = kt(Z(this, ne));
|
|
607
|
+
return J(this, ne, {}), be(this, ve, xt).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
|
-
const i = kt(
|
|
613
|
-
return
|
|
612
|
+
const i = kt(Z(this, ne));
|
|
613
|
+
return J(this, ne, {}), be(this, ve, xt).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
|
-
const i = kt(
|
|
619
|
-
return
|
|
618
|
+
const i = kt(Z(this, ne));
|
|
619
|
+
return J(this, ne, {}), be(this, ve, xt).call(this, r, "PATCH", s, a, i);
|
|
620
620
|
});
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
|
-
|
|
623
|
+
Je = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), ve = /* @__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
|
|
628
|
+
return yield Z(this, Je).call(this, t, ae(ae({}, n), e.abortSignal && { signal: e.abortSignal }));
|
|
629
629
|
} catch (h) {
|
|
630
|
-
throw h instanceof Error && h.name === "AbortError" ? new
|
|
630
|
+
throw h instanceof Error && h.name === "AbortError" ? new St({ 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
|
|
688
|
+
p = yield Z(this, Je).call(this, u, ae(ae({}, n), i && { signal: i }));
|
|
689
689
|
} catch (b) {
|
|
690
|
-
throw b instanceof Error && b.name === "AbortError" ? new
|
|
690
|
+
throw b instanceof Error && b.name === "AbortError" ? new St({ 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();
|
|
@@ -706,40 +706,40 @@ Ge = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), ve = /*
|
|
|
706
706
|
return new Promise((b, m) => B(this, null, function* () {
|
|
707
707
|
const g = setTimeout(() => {
|
|
708
708
|
m(new Error("Job timed out"));
|
|
709
|
-
}, c), l = (
|
|
709
|
+
}, c), l = (O = 0) => B(this, null, function* () {
|
|
710
710
|
if (i != null && i.aborted) {
|
|
711
|
-
clearTimeout(g),
|
|
712
|
-
m(new
|
|
713
|
-
}).catch((
|
|
714
|
-
m(new
|
|
711
|
+
clearTimeout(g), Z(this, Je).call(this, `${h}/${v}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
712
|
+
m(new St({ canceled: !0 }));
|
|
713
|
+
}).catch((P) => {
|
|
714
|
+
m(new St({ canceled: !1 }));
|
|
715
715
|
});
|
|
716
716
|
return;
|
|
717
717
|
}
|
|
718
718
|
try {
|
|
719
|
-
const
|
|
720
|
-
if (
|
|
719
|
+
const P = yield (yield Z(this, Je).call(this, `${h}/${v}`, { headers: this.headers })).json();
|
|
720
|
+
if (P.status === "success") {
|
|
721
721
|
clearTimeout(g);
|
|
722
|
-
const K =
|
|
722
|
+
const K = P.response_json;
|
|
723
723
|
b(K);
|
|
724
|
-
} else if (
|
|
725
|
-
clearTimeout(g), m(new bi(
|
|
724
|
+
} else if (P.status === "failed")
|
|
725
|
+
clearTimeout(g), m(new bi(P.response_json));
|
|
726
726
|
else {
|
|
727
|
-
a && a(
|
|
728
|
-
const K = o(
|
|
729
|
-
setTimeout(() => l(
|
|
727
|
+
a && a(P.response_json);
|
|
728
|
+
const K = o(O);
|
|
729
|
+
setTimeout(() => l(O + 1), K);
|
|
730
730
|
}
|
|
731
|
-
} catch (
|
|
732
|
-
m(
|
|
731
|
+
} catch (P) {
|
|
732
|
+
m(P);
|
|
733
733
|
}
|
|
734
734
|
});
|
|
735
735
|
l();
|
|
736
736
|
}));
|
|
737
737
|
});
|
|
738
|
-
},
|
|
738
|
+
}, xt = 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
|
-
s.extraHeaders && (c =
|
|
742
|
+
s.extraHeaders && (c = ae(ae({}, c), s.extraHeaders)), s.requestValidation && (c = Tr(ae({}, c), { "X-Request-Nonce": Cs(), "X-Request-Timestamp": Xn() }));
|
|
743
743
|
let u = n;
|
|
744
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 be(this, ve, Qn).call(this, `${o}${t}`, s.async, {
|
|
745
745
|
method: e,
|
|
@@ -748,7 +748,7 @@ Ge = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), ve = /*
|
|
|
748
748
|
}) : yield be(this, ve, 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 St ? 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;
|
|
@@ -770,23 +770,23 @@ const rs = (t, e, n, r) => t instanceof xt ? t : new _i({ resource: e, api: Stri
|
|
|
770
770
|
}
|
|
771
771
|
});
|
|
772
772
|
var Et;
|
|
773
|
-
class
|
|
773
|
+
class xi {
|
|
774
774
|
constructor(e) {
|
|
775
|
-
le(this, Et), this.resourceName = "Files",
|
|
775
|
+
le(this, Et), this.resourceName = "Files", J(this, Et, e);
|
|
776
776
|
}
|
|
777
777
|
get(e) {
|
|
778
778
|
return B(this, arguments, function* ({ fileKey: n, params: r = {} }) {
|
|
779
|
-
const s = new URLSearchParams(
|
|
779
|
+
const s = new URLSearchParams(ae({
|
|
780
780
|
plugin_data: "857346721138427857"
|
|
781
781
|
}, r)).toString(), a = `v1/files/${n}?${s}`;
|
|
782
|
-
return yield
|
|
782
|
+
return yield Z(this, Et).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
|
|
789
|
+
return (s = (r = (yield Z(this, Et).get(a)).meta) == null ? void 0 : r.images) != null ? s : {};
|
|
790
790
|
});
|
|
791
791
|
}
|
|
792
792
|
}
|
|
@@ -798,7 +798,7 @@ const Ei = (t, e, n) => {
|
|
|
798
798
|
var _e, er, Ns;
|
|
799
799
|
class Ti {
|
|
800
800
|
constructor(e) {
|
|
801
|
-
le(this, er), le(this, _e), this.resourceName = "Images",
|
|
801
|
+
le(this, er), le(this, _e), this.resourceName = "Images", J(this, _e, 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 = Ei(n, r, s), o =
|
|
809
|
+
const i = Ei(n, r, s), o = Z(this, _e).cache.images.entries.get(i);
|
|
810
810
|
if (Oi(o))
|
|
811
811
|
return o.result;
|
|
812
|
-
o &&
|
|
813
|
-
const c =
|
|
812
|
+
o && Z(this, _e).cache.images.entries.delete(i);
|
|
813
|
+
const c = Z(this, _e).cache.images.pendingRequests.get(i);
|
|
814
814
|
if (c)
|
|
815
815
|
return c;
|
|
816
816
|
const u = be(this, er, Ns).call(this, i, n, r, s, a);
|
|
817
|
-
|
|
817
|
+
Z(this, _e).cache.images.pendingRequests.set(i, u);
|
|
818
818
|
try {
|
|
819
819
|
return yield u;
|
|
820
820
|
} finally {
|
|
821
|
-
|
|
821
|
+
Z(this, _e).cache.images.pendingRequests.delete(i);
|
|
822
822
|
}
|
|
823
823
|
});
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
826
|
_e = /* @__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
|
|
828
|
+
const a = yield Z(this, _e).get(
|
|
829
829
|
`v1/images/${e}?ids=${n}&format=${r}${s ? `&scale=${s}` : ""}`
|
|
830
830
|
);
|
|
831
|
-
return
|
|
831
|
+
return Z(this, _e).cache.images.entries.set(t, {
|
|
832
832
|
result: a,
|
|
833
833
|
ts: Date.now()
|
|
834
834
|
}), a;
|
|
@@ -837,22 +837,22 @@ _e = /* @__PURE__ */ new WeakMap(), er = /* @__PURE__ */ new WeakSet(), Ns = fun
|
|
|
837
837
|
var cn;
|
|
838
838
|
class Ai {
|
|
839
839
|
constructor(e) {
|
|
840
|
-
le(this, cn), this.resourceName = "Nodes",
|
|
840
|
+
le(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 = {} }) {
|
|
844
|
-
const a = Tr(
|
|
844
|
+
const a = Tr(ae({}, s), {
|
|
845
845
|
ids: r.join(",")
|
|
846
|
-
}), i = new URLSearchParams(
|
|
846
|
+
}), i = new URLSearchParams(ae({
|
|
847
847
|
plugin_data: "857346721138427857"
|
|
848
848
|
}, a)).toString(), o = `v1/files/${n}/nodes?${i}`;
|
|
849
|
-
return yield
|
|
849
|
+
return yield Z(this, cn).get(o);
|
|
850
850
|
});
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
853
|
cn = /* @__PURE__ */ new WeakMap();
|
|
854
854
|
var Pe;
|
|
855
|
-
class Ci extends
|
|
855
|
+
class Ci extends Si {
|
|
856
856
|
constructor({
|
|
857
857
|
baseAddress: e = "https://api.figma.com/",
|
|
858
858
|
fetch: n = globalThis.fetch.bind(globalThis)
|
|
@@ -862,25 +862,25 @@ class Ci extends xi {
|
|
|
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 xi(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, Pe, e);
|
|
871
871
|
}
|
|
872
872
|
get token() {
|
|
873
|
-
return
|
|
873
|
+
return Z(this, Pe);
|
|
874
874
|
}
|
|
875
875
|
get headers() {
|
|
876
876
|
const e = {
|
|
877
877
|
"Content-Type": "application/json"
|
|
878
878
|
};
|
|
879
|
-
return
|
|
879
|
+
return Z(this, Pe).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = Z(this, Pe) : Z(this, Pe).startsWith("figu_") && (e.Authorization = `Bearer ${Z(this, Pe)}`), e;
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
882
|
Pe = /* @__PURE__ */ new WeakMap();
|
|
883
|
-
const Ni = (t) =>
|
|
883
|
+
const Ni = (t) => Se(void 0, [t], function* ({
|
|
884
884
|
fileKey: e,
|
|
885
885
|
authToken: n,
|
|
886
886
|
figmaRestApi: r = new Ci(),
|
|
@@ -999,7 +999,7 @@ const _ = N.arrayToEnum([
|
|
|
999
999
|
"not_multiple_of",
|
|
1000
1000
|
"not_finite"
|
|
1001
1001
|
]), Ri = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
1002
|
-
class
|
|
1002
|
+
class ie extends Error {
|
|
1003
1003
|
get errors() {
|
|
1004
1004
|
return this.issues;
|
|
1005
1005
|
}
|
|
@@ -1036,7 +1036,7 @@ class oe extends Error {
|
|
|
1036
1036
|
return s(this), r;
|
|
1037
1037
|
}
|
|
1038
1038
|
static assert(e) {
|
|
1039
|
-
if (!(e instanceof
|
|
1039
|
+
if (!(e instanceof ie))
|
|
1040
1040
|
throw new Error(`Not a ZodError: ${e}`);
|
|
1041
1041
|
}
|
|
1042
1042
|
toString() {
|
|
@@ -1058,7 +1058,7 @@ class oe extends Error {
|
|
|
1058
1058
|
return this.flatten();
|
|
1059
1059
|
}
|
|
1060
1060
|
}
|
|
1061
|
-
|
|
1061
|
+
ie.create = (t) => new ie(t);
|
|
1062
1062
|
const yt = (t, e) => {
|
|
1063
1063
|
let n;
|
|
1064
1064
|
switch (t.code) {
|
|
@@ -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 = x(d({}, s), {
|
|
1127
1127
|
path: a
|
|
1128
1128
|
});
|
|
1129
1129
|
if (s.message !== void 0)
|
|
1130
|
-
return
|
|
1130
|
+
return x(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 x(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
|
}
|
|
@@ -1178,7 +1178,7 @@ class Y {
|
|
|
1178
1178
|
return { status: e.value, value: r };
|
|
1179
1179
|
}
|
|
1180
1180
|
static mergeObjectAsync(e, n) {
|
|
1181
|
-
return
|
|
1181
|
+
return Se(this, null, function* () {
|
|
1182
1182
|
const r = [];
|
|
1183
1183
|
for (const s of n) {
|
|
1184
1184
|
const a = yield s.key, i = yield s.value;
|
|
@@ -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) {
|
|
@@ -1203,7 +1203,7 @@ class Y {
|
|
|
1203
1203
|
}
|
|
1204
1204
|
const E = 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);
|
|
@@ -1217,7 +1217,7 @@ var w;
|
|
|
1217
1217
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
1218
1218
|
})(w || (w = {}));
|
|
1219
1219
|
var Ot, Tt;
|
|
1220
|
-
class
|
|
1220
|
+
class xe {
|
|
1221
1221
|
constructor(e, n, r, s) {
|
|
1222
1222
|
this._cachedPath = [], this.parent = e, this.data = n, this._path = r, this._key = s;
|
|
1223
1223
|
}
|
|
@@ -1226,7 +1226,7 @@ class Se {
|
|
|
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.");
|
|
@@ -1235,12 +1235,12 @@ const ss = (t, e) => {
|
|
|
1235
1235
|
get error() {
|
|
1236
1236
|
if (this._error)
|
|
1237
1237
|
return this._error;
|
|
1238
|
-
const n = new
|
|
1238
|
+
const n = new ie(t.common.issues);
|
|
1239
1239
|
return this._error = n, this._error;
|
|
1240
1240
|
}
|
|
1241
1241
|
};
|
|
1242
1242
|
};
|
|
1243
|
-
function
|
|
1243
|
+
function T(t) {
|
|
1244
1244
|
if (!t)
|
|
1245
1245
|
return {};
|
|
1246
1246
|
const { errorMap: e, invalid_type_error: n, required_error: r, description: s } = t;
|
|
@@ -1271,7 +1271,7 @@ 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,
|
|
@@ -1330,7 +1330,7 @@ class A {
|
|
|
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,14 +1341,14 @@ 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
|
|
1348
1348
|
});
|
|
1349
1349
|
}
|
|
1350
1350
|
parseAsync(e, n) {
|
|
1351
|
-
return
|
|
1351
|
+
return Se(this, null, function* () {
|
|
1352
1352
|
const r = yield this.safeParseAsync(e, n);
|
|
1353
1353
|
if (r.success)
|
|
1354
1354
|
return r.data;
|
|
@@ -1356,7 +1356,7 @@ class A {
|
|
|
1356
1356
|
});
|
|
1357
1357
|
}
|
|
1358
1358
|
safeParseAsync(e, n) {
|
|
1359
|
-
return
|
|
1359
|
+
return Se(this, null, function* () {
|
|
1360
1360
|
const r = {
|
|
1361
1361
|
common: {
|
|
1362
1362
|
issues: [],
|
|
@@ -1387,7 +1387,7 @@ class A {
|
|
|
1387
1387
|
_refinement(e) {
|
|
1388
1388
|
return new ge({
|
|
1389
1389
|
schema: this,
|
|
1390
|
-
typeName:
|
|
1390
|
+
typeName: S.ZodEffects,
|
|
1391
1391
|
effect: { type: "refinement", refinement: e }
|
|
1392
1392
|
});
|
|
1393
1393
|
}
|
|
@@ -1423,37 +1423,37 @@ class A {
|
|
|
1423
1423
|
return Mt.create(this, e, this._def);
|
|
1424
1424
|
}
|
|
1425
1425
|
transform(e) {
|
|
1426
|
-
return new ge(
|
|
1426
|
+
return new ge(x(d({}, T(this._def)), {
|
|
1427
1427
|
schema: this,
|
|
1428
|
-
typeName:
|
|
1428
|
+
typeName: S.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(x(d({}, T(this._def)), {
|
|
1435
1435
|
innerType: this,
|
|
1436
1436
|
defaultValue: n,
|
|
1437
|
-
typeName:
|
|
1437
|
+
typeName: S.ZodDefault
|
|
1438
1438
|
}));
|
|
1439
1439
|
}
|
|
1440
1440
|
brand() {
|
|
1441
1441
|
return new Nr(d({
|
|
1442
|
-
typeName:
|
|
1442
|
+
typeName: S.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(x(d({}, T(this._def)), {
|
|
1449
1449
|
innerType: this,
|
|
1450
1450
|
catchValue: n,
|
|
1451
|
-
typeName:
|
|
1451
|
+
typeName: S.ZodCatch
|
|
1452
1452
|
}));
|
|
1453
1453
|
}
|
|
1454
1454
|
describe(e) {
|
|
1455
1455
|
const n = this.constructor;
|
|
1456
|
-
return new n(
|
|
1456
|
+
return new n(x(d({}, this._def), {
|
|
1457
1457
|
description: e
|
|
1458
1458
|
}));
|
|
1459
1459
|
}
|
|
@@ -1511,7 +1511,7 @@ class me extends A {
|
|
|
1511
1511
|
received: s.parsedType
|
|
1512
1512
|
}), E;
|
|
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 me(
|
|
1666
|
+
return new me(x(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 me(
|
|
1792
|
+
return new me(x(d({}, this._def), {
|
|
1793
1793
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1794
1794
|
}));
|
|
1795
1795
|
}
|
|
1796
1796
|
toLowerCase() {
|
|
1797
|
-
return new me(
|
|
1797
|
+
return new me(x(d({}, this._def), {
|
|
1798
1798
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1799
1799
|
}));
|
|
1800
1800
|
}
|
|
1801
1801
|
toUpperCase() {
|
|
1802
|
-
return new me(
|
|
1802
|
+
return new me(x(d({}, this._def), {
|
|
1803
1803
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1804
1804
|
}));
|
|
1805
1805
|
}
|
|
@@ -1868,9 +1868,9 @@ me.create = (t) => {
|
|
|
1868
1868
|
var e;
|
|
1869
1869
|
return new me(d({
|
|
1870
1870
|
checks: [],
|
|
1871
|
-
typeName:
|
|
1871
|
+
typeName: S.ZodString,
|
|
1872
1872
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1
|
|
1873
|
-
},
|
|
1873
|
+
}, T(t)));
|
|
1874
1874
|
};
|
|
1875
1875
|
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(".", ""));
|
|
@@ -1890,7 +1890,7 @@ class Le extends A {
|
|
|
1890
1890
|
}), E;
|
|
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 Le(
|
|
1937
|
+
return new Le(x(d({}, this._def), {
|
|
1938
1938
|
checks: [
|
|
1939
1939
|
...this._def.checks,
|
|
1940
1940
|
{
|
|
@@ -1947,7 +1947,7 @@ class Le extends A {
|
|
|
1947
1947
|
}));
|
|
1948
1948
|
}
|
|
1949
1949
|
_addCheck(e) {
|
|
1950
|
-
return new Le(
|
|
1950
|
+
return new Le(x(d({}, this._def), {
|
|
1951
1951
|
checks: [...this._def.checks, e]
|
|
1952
1952
|
}));
|
|
1953
1953
|
}
|
|
@@ -2042,9 +2042,9 @@ class Le extends A {
|
|
|
2042
2042
|
}
|
|
2043
2043
|
Le.create = (t) => new Le(d({
|
|
2044
2044
|
checks: [],
|
|
2045
|
-
typeName:
|
|
2045
|
+
typeName: S.ZodNumber,
|
|
2046
2046
|
coerce: (t == null ? void 0 : t.coerce) || !1
|
|
2047
|
-
},
|
|
2047
|
+
}, T(t)));
|
|
2048
2048
|
class $e extends A {
|
|
2049
2049
|
constructor() {
|
|
2050
2050
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
@@ -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,
|
|
@@ -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 $e(
|
|
2104
|
+
return new $e(x(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 $e(
|
|
2117
|
+
return new $e(x(d({}, this._def), {
|
|
2118
2118
|
checks: [...this._def.checks, e]
|
|
2119
2119
|
}));
|
|
2120
2120
|
}
|
|
@@ -2174,9 +2174,9 @@ $e.create = (t) => {
|
|
|
2174
2174
|
var e;
|
|
2175
2175
|
return new $e(d({
|
|
2176
2176
|
checks: [],
|
|
2177
|
-
typeName:
|
|
2177
|
+
typeName: S.ZodBigInt,
|
|
2178
2178
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1
|
|
2179
|
-
},
|
|
2179
|
+
}, T(t)));
|
|
2180
2180
|
};
|
|
2181
2181
|
class It extends A {
|
|
2182
2182
|
_parse(e) {
|
|
@@ -2188,14 +2188,14 @@ class It extends A {
|
|
|
2188
2188
|
received: n.parsedType
|
|
2189
2189
|
}), E;
|
|
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: S.ZodBoolean,
|
|
2196
2196
|
coerce: (t == null ? void 0 : t.coerce) || !1
|
|
2197
|
-
},
|
|
2198
|
-
class
|
|
2197
|
+
}, T(t)));
|
|
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);
|
|
@@ -2211,7 +2211,7 @@ class Qe extends A {
|
|
|
2211
2211
|
code: f.invalid_date
|
|
2212
2212
|
}), E;
|
|
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(x(d({}, this._def), {
|
|
2239
2239
|
checks: [...this._def.checks, e]
|
|
2240
2240
|
}));
|
|
2241
2241
|
}
|
|
@@ -2266,11 +2266,11 @@ 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:
|
|
2273
|
-
},
|
|
2272
|
+
typeName: S.ZodDate
|
|
2273
|
+
}, T(t)));
|
|
2274
2274
|
class mn extends A {
|
|
2275
2275
|
_parse(e) {
|
|
2276
2276
|
if (this._getType(e) !== _.symbol) {
|
|
@@ -2281,12 +2281,12 @@ class mn extends A {
|
|
|
2281
2281
|
received: n.parsedType
|
|
2282
2282
|
}), E;
|
|
2283
2283
|
}
|
|
2284
|
-
return
|
|
2284
|
+
return te(e.data);
|
|
2285
2285
|
}
|
|
2286
2286
|
}
|
|
2287
2287
|
mn.create = (t) => new mn(d({
|
|
2288
|
-
typeName:
|
|
2289
|
-
},
|
|
2288
|
+
typeName: S.ZodSymbol
|
|
2289
|
+
}, T(t)));
|
|
2290
2290
|
class Pt extends A {
|
|
2291
2291
|
_parse(e) {
|
|
2292
2292
|
if (this._getType(e) !== _.undefined) {
|
|
@@ -2297,12 +2297,12 @@ class Pt extends A {
|
|
|
2297
2297
|
received: n.parsedType
|
|
2298
2298
|
}), E;
|
|
2299
2299
|
}
|
|
2300
|
-
return
|
|
2300
|
+
return te(e.data);
|
|
2301
2301
|
}
|
|
2302
2302
|
}
|
|
2303
2303
|
Pt.create = (t) => new Pt(d({
|
|
2304
|
-
typeName:
|
|
2305
|
-
},
|
|
2304
|
+
typeName: S.ZodUndefined
|
|
2305
|
+
}, T(t)));
|
|
2306
2306
|
class Zt extends A {
|
|
2307
2307
|
_parse(e) {
|
|
2308
2308
|
if (this._getType(e) !== _.null) {
|
|
@@ -2313,34 +2313,34 @@ class Zt extends A {
|
|
|
2313
2313
|
received: n.parsedType
|
|
2314
2314
|
}), E;
|
|
2315
2315
|
}
|
|
2316
|
-
return
|
|
2316
|
+
return te(e.data);
|
|
2317
2317
|
}
|
|
2318
2318
|
}
|
|
2319
2319
|
Zt.create = (t) => new Zt(d({
|
|
2320
|
-
typeName:
|
|
2321
|
-
},
|
|
2320
|
+
typeName: S.ZodNull
|
|
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:
|
|
2332
|
-
},
|
|
2333
|
-
class
|
|
2331
|
+
typeName: S.ZodAny
|
|
2332
|
+
}, T(t)));
|
|
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:
|
|
2343
|
-
},
|
|
2341
|
+
Ye.create = (t) => new Ye(d({
|
|
2342
|
+
typeName: S.ZodUnknown
|
|
2343
|
+
}, T(t)));
|
|
2344
2344
|
class je extends A {
|
|
2345
2345
|
_parse(e) {
|
|
2346
2346
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2352,8 +2352,8 @@ class je extends A {
|
|
|
2352
2352
|
}
|
|
2353
2353
|
}
|
|
2354
2354
|
je.create = (t) => new je(d({
|
|
2355
|
-
typeName:
|
|
2356
|
-
},
|
|
2355
|
+
typeName: S.ZodNever
|
|
2356
|
+
}, T(t)));
|
|
2357
2357
|
class yn extends A {
|
|
2358
2358
|
_parse(e) {
|
|
2359
2359
|
if (this._getType(e) !== _.undefined) {
|
|
@@ -2364,12 +2364,12 @@ class yn extends A {
|
|
|
2364
2364
|
received: n.parsedType
|
|
2365
2365
|
}), E;
|
|
2366
2366
|
}
|
|
2367
|
-
return
|
|
2367
|
+
return te(e.data);
|
|
2368
2368
|
}
|
|
2369
2369
|
}
|
|
2370
2370
|
yn.create = (t) => new yn(d({
|
|
2371
|
-
typeName:
|
|
2372
|
-
},
|
|
2371
|
+
typeName: S.ZodVoid
|
|
2372
|
+
}, T(t)));
|
|
2373
2373
|
class ye extends A {
|
|
2374
2374
|
_parse(e) {
|
|
2375
2375
|
const { ctx: n, status: r } = this._processInputParams(e), s = this._def;
|
|
@@ -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
|
|
2410
|
-
const a = [...n.data].map((i, o) => s.type._parseSync(new
|
|
2411
|
-
return
|
|
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
|
+
const a = [...n.data].map((i, o) => s.type._parseSync(new xe(n, i, n.path, o)));
|
|
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 ye(
|
|
2417
|
+
return new ye(x(d({}, this._def), {
|
|
2418
2418
|
minLength: { value: e, message: w.toString(n) }
|
|
2419
2419
|
}));
|
|
2420
2420
|
}
|
|
2421
2421
|
max(e, n) {
|
|
2422
|
-
return new ye(
|
|
2422
|
+
return new ye(x(d({}, this._def), {
|
|
2423
2423
|
maxLength: { value: e, message: w.toString(n) }
|
|
2424
2424
|
}));
|
|
2425
2425
|
}
|
|
2426
2426
|
length(e, n) {
|
|
2427
|
-
return new ye(
|
|
2427
|
+
return new ye(x(d({}, this._def), {
|
|
2428
2428
|
exactLength: { value: e, message: w.toString(n) }
|
|
2429
2429
|
}));
|
|
2430
2430
|
}
|
|
@@ -2437,8 +2437,8 @@ ye.create = (t, e) => new ye(d({
|
|
|
2437
2437
|
minLength: null,
|
|
2438
2438
|
maxLength: null,
|
|
2439
2439
|
exactLength: null,
|
|
2440
|
-
typeName:
|
|
2441
|
-
},
|
|
2440
|
+
typeName: S.ZodArray
|
|
2441
|
+
}, T(e)));
|
|
2442
2442
|
function ct(t) {
|
|
2443
2443
|
if (t instanceof z) {
|
|
2444
2444
|
const e = {};
|
|
@@ -2446,10 +2446,10 @@ function ct(t) {
|
|
|
2446
2446
|
const r = t.shape[n];
|
|
2447
2447
|
e[n] = ke.create(ct(r));
|
|
2448
2448
|
}
|
|
2449
|
-
return new z(
|
|
2449
|
+
return new z(x(d({}, t._def), {
|
|
2450
2450
|
shape: () => e
|
|
2451
2451
|
}));
|
|
2452
|
-
} else return t instanceof ye ? new ye(
|
|
2452
|
+
} else return t instanceof ye ? new ye(x(d({}, t._def), {
|
|
2453
2453
|
type: ct(t.element)
|
|
2454
2454
|
})) : t instanceof ke ? ke.create(ct(t.unwrap())) : t instanceof We ? We.create(ct(t.unwrap())) : t instanceof Ee ? Ee.create(t.items.map((e) => ct(e))) : t;
|
|
2455
2455
|
}
|
|
@@ -2481,7 +2481,7 @@ class z extends A {
|
|
|
2481
2481
|
const u = s[c], h = r.data[c];
|
|
2482
2482
|
o.push({
|
|
2483
2483
|
key: { status: "valid", value: c },
|
|
2484
|
-
value: u._parse(new
|
|
2484
|
+
value: u._parse(new xe(r, h, r.path, c)),
|
|
2485
2485
|
alwaysSet: c in r.data
|
|
2486
2486
|
});
|
|
2487
2487
|
}
|
|
@@ -2506,14 +2506,14 @@ class z extends A {
|
|
|
2506
2506
|
o.push({
|
|
2507
2507
|
key: { status: "valid", value: u },
|
|
2508
2508
|
value: c._parse(
|
|
2509
|
-
new
|
|
2509
|
+
new xe(r, h, r.path, u)
|
|
2510
2510
|
//, ctx.child(key), value, getParsedType(value)
|
|
2511
2511
|
),
|
|
2512
2512
|
alwaysSet: u in r.data
|
|
2513
2513
|
});
|
|
2514
2514
|
}
|
|
2515
2515
|
}
|
|
2516
|
-
return r.common.async ? Promise.resolve().then(() =>
|
|
2516
|
+
return r.common.async ? Promise.resolve().then(() => Se(this, null, function* () {
|
|
2517
2517
|
const c = [];
|
|
2518
2518
|
for (const u of o) {
|
|
2519
2519
|
const h = yield u.key, p = yield u.value;
|
|
@@ -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(x(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(x(d({}, this._def), {
|
|
2549
2549
|
unknownKeys: "strip"
|
|
2550
2550
|
}));
|
|
2551
2551
|
}
|
|
2552
2552
|
passthrough() {
|
|
2553
|
-
return new z(
|
|
2553
|
+
return new z(x(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(x(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: S.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(x(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(x(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(x(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(x(d({}, this._def), {
|
|
2684
2684
|
shape: () => n
|
|
2685
2685
|
}));
|
|
2686
2686
|
}
|
|
@@ -2695,7 +2695,7 @@ class z extends A {
|
|
|
2695
2695
|
s = s._def.innerType;
|
|
2696
2696
|
n[r] = s;
|
|
2697
2697
|
}
|
|
2698
|
-
}), new z(
|
|
2698
|
+
}), new z(x(d({}, this._def), {
|
|
2699
2699
|
shape: () => n
|
|
2700
2700
|
}));
|
|
2701
2701
|
}
|
|
@@ -2707,20 +2707,20 @@ z.create = (t, e) => new z(d({
|
|
|
2707
2707
|
shape: () => t,
|
|
2708
2708
|
unknownKeys: "strip",
|
|
2709
2709
|
catchall: je.create(),
|
|
2710
|
-
typeName:
|
|
2711
|
-
},
|
|
2710
|
+
typeName: S.ZodObject
|
|
2711
|
+
}, T(e)));
|
|
2712
2712
|
z.strictCreate = (t, e) => new z(d({
|
|
2713
2713
|
shape: () => t,
|
|
2714
2714
|
unknownKeys: "strict",
|
|
2715
2715
|
catchall: je.create(),
|
|
2716
|
-
typeName:
|
|
2717
|
-
},
|
|
2716
|
+
typeName: S.ZodObject
|
|
2717
|
+
}, T(e)));
|
|
2718
2718
|
z.lazycreate = (t, e) => new z(d({
|
|
2719
2719
|
shape: t,
|
|
2720
2720
|
unknownKeys: "strip",
|
|
2721
2721
|
catchall: je.create(),
|
|
2722
|
-
typeName:
|
|
2723
|
-
},
|
|
2722
|
+
typeName: S.ZodObject
|
|
2723
|
+
}, T(e)));
|
|
2724
2724
|
class Dt extends A {
|
|
2725
2725
|
_parse(e) {
|
|
2726
2726
|
const { ctx: n } = this._processInputParams(e), r = this._def.options;
|
|
@@ -2731,16 +2731,16 @@ class Dt extends A {
|
|
|
2731
2731
|
for (const o of a)
|
|
2732
2732
|
if (o.result.status === "dirty")
|
|
2733
2733
|
return n.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2734
|
-
const i = a.map((o) => new
|
|
2734
|
+
const i = a.map((o) => new ie(o.ctx.common.issues));
|
|
2735
2735
|
return y(n, {
|
|
2736
2736
|
code: f.invalid_union,
|
|
2737
2737
|
unionErrors: i
|
|
2738
2738
|
}), E;
|
|
2739
2739
|
}
|
|
2740
2740
|
if (n.common.async)
|
|
2741
|
-
return Promise.all(r.map((a) =>
|
|
2742
|
-
const i =
|
|
2743
|
-
common:
|
|
2741
|
+
return Promise.all(r.map((a) => Se(this, null, function* () {
|
|
2742
|
+
const i = x(d({}, n), {
|
|
2743
|
+
common: x(d({}, n.common), {
|
|
2744
2744
|
issues: []
|
|
2745
2745
|
}),
|
|
2746
2746
|
parent: null
|
|
@@ -2758,8 +2758,8 @@ class Dt extends A {
|
|
|
2758
2758
|
let a;
|
|
2759
2759
|
const i = [];
|
|
2760
2760
|
for (const c of r) {
|
|
2761
|
-
const u =
|
|
2762
|
-
common:
|
|
2761
|
+
const u = x(d({}, n), {
|
|
2762
|
+
common: x(d({}, n.common), {
|
|
2763
2763
|
issues: []
|
|
2764
2764
|
}),
|
|
2765
2765
|
parent: null
|
|
@@ -2774,7 +2774,7 @@ class Dt extends A {
|
|
|
2774
2774
|
}
|
|
2775
2775
|
if (a)
|
|
2776
2776
|
return n.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2777
|
-
const o = i.map((c) => new
|
|
2777
|
+
const o = i.map((c) => new ie(c));
|
|
2778
2778
|
return y(n, {
|
|
2779
2779
|
code: f.invalid_union,
|
|
2780
2780
|
unionErrors: o
|
|
@@ -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:
|
|
2791
|
-
},
|
|
2790
|
+
typeName: S.ZodUnion
|
|
2791
|
+
}, T(e)));
|
|
2792
2792
|
const Ze = (t) => t instanceof $t ? Ze(t.schema) : t instanceof ge ? Ze(t.innerType()) : t instanceof Ft ? [t.value] : t instanceof Fe ? t.options : t instanceof Wt ? N.objectValues(t.enum) : t instanceof zt ? Ze(t._def.innerType) : t instanceof Pt ? [void 0] : t instanceof Zt ? [null] : t instanceof ke ? [void 0, ...Ze(t.unwrap())] : t instanceof We ? [null, ...Ze(t.unwrap())] : t instanceof Nr || t instanceof Vt ? Ze(t.unwrap()) : t instanceof Ut ? Ze(t._def.innerType) : [];
|
|
2793
|
-
class
|
|
2793
|
+
class Sn extends A {
|
|
2794
2794
|
_parse(e) {
|
|
2795
2795
|
const { ctx: n } = this._processInputParams(e);
|
|
2796
2796
|
if (n.parsedType !== _.object)
|
|
@@ -2843,12 +2843,12 @@ class xn extends A {
|
|
|
2843
2843
|
s.set(o, a);
|
|
2844
2844
|
}
|
|
2845
2845
|
}
|
|
2846
|
-
return new
|
|
2847
|
-
typeName:
|
|
2846
|
+
return new Sn(d({
|
|
2847
|
+
typeName: S.ZodDiscriminatedUnion,
|
|
2848
2848
|
discriminator: e,
|
|
2849
2849
|
options: n,
|
|
2850
2850
|
optionsMap: s
|
|
2851
|
-
},
|
|
2851
|
+
}, T(r)));
|
|
2852
2852
|
}
|
|
2853
2853
|
}
|
|
2854
2854
|
function sr(t, e) {
|
|
@@ -2912,8 +2912,8 @@ class Mt extends A {
|
|
|
2912
2912
|
Mt.create = (t, e, n) => new Mt(d({
|
|
2913
2913
|
left: t,
|
|
2914
2914
|
right: e,
|
|
2915
|
-
typeName:
|
|
2916
|
-
},
|
|
2915
|
+
typeName: S.ZodIntersection
|
|
2916
|
+
}, T(n)));
|
|
2917
2917
|
class Ee extends A {
|
|
2918
2918
|
_parse(e) {
|
|
2919
2919
|
const { status: n, ctx: r } = this._processInputParams(e);
|
|
@@ -2940,15 +2940,15 @@ class Ee extends A {
|
|
|
2940
2940
|
}), n.dirty());
|
|
2941
2941
|
const s = [...r.data].map((a, i) => {
|
|
2942
2942
|
const o = this._def.items[i] || this._def.rest;
|
|
2943
|
-
return o ? o._parse(new
|
|
2943
|
+
return o ? o._parse(new 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 Ee(
|
|
2951
|
+
return new Ee(x(d({}, this._def), {
|
|
2952
2952
|
rest: e
|
|
2953
2953
|
}));
|
|
2954
2954
|
}
|
|
@@ -2958,9 +2958,9 @@ Ee.create = (t, e) => {
|
|
|
2958
2958
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2959
2959
|
return new Ee(d({
|
|
2960
2960
|
items: t,
|
|
2961
|
-
typeName:
|
|
2961
|
+
typeName: S.ZodTuple,
|
|
2962
2962
|
rest: null
|
|
2963
|
-
},
|
|
2963
|
+
}, T(e)));
|
|
2964
2964
|
};
|
|
2965
2965
|
class Lt extends A {
|
|
2966
2966
|
get keySchema() {
|
|
@@ -2980,11 +2980,11 @@ class Lt extends A {
|
|
|
2980
2980
|
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
2981
2981
|
for (const o in r.data)
|
|
2982
2982
|
s.push({
|
|
2983
|
-
key: a._parse(new
|
|
2984
|
-
value: i._parse(new
|
|
2983
|
+
key: a._parse(new xe(r, o, r.path, o)),
|
|
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,12 +2993,12 @@ class Lt extends A {
|
|
|
2993
2993
|
return n instanceof A ? new Lt(d({
|
|
2994
2994
|
keyType: e,
|
|
2995
2995
|
valueType: n,
|
|
2996
|
-
typeName:
|
|
2997
|
-
},
|
|
2996
|
+
typeName: S.ZodRecord
|
|
2997
|
+
}, T(r))) : new Lt(d({
|
|
2998
2998
|
keyType: me.create(),
|
|
2999
2999
|
valueType: e,
|
|
3000
|
-
typeName:
|
|
3001
|
-
},
|
|
3000
|
+
typeName: S.ZodRecord
|
|
3001
|
+
}, T(n)));
|
|
3002
3002
|
}
|
|
3003
3003
|
}
|
|
3004
3004
|
class gn extends A {
|
|
@@ -3017,12 +3017,12 @@ class gn extends A {
|
|
|
3017
3017
|
received: r.parsedType
|
|
3018
3018
|
}), E;
|
|
3019
3019
|
const s = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, c], u) => ({
|
|
3020
|
-
key: s._parse(new
|
|
3021
|
-
value: a._parse(new
|
|
3020
|
+
key: s._parse(new xe(r, o, r.path, [u, "key"])),
|
|
3021
|
+
value: a._parse(new xe(r, c, r.path, [u, "value"]))
|
|
3022
3022
|
}));
|
|
3023
3023
|
if (r.common.async) {
|
|
3024
3024
|
const o = /* @__PURE__ */ new Map();
|
|
3025
|
-
return Promise.resolve().then(() =>
|
|
3025
|
+
return Promise.resolve().then(() => Se(this, null, function* () {
|
|
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")
|
|
@@ -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:
|
|
3050
|
-
},
|
|
3051
|
-
class
|
|
3049
|
+
typeName: S.ZodMap
|
|
3050
|
+
}, T(n)));
|
|
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)
|
|
@@ -3083,16 +3083,16 @@ class et extends A {
|
|
|
3083
3083
|
}
|
|
3084
3084
|
return { status: n.value, value: u };
|
|
3085
3085
|
}
|
|
3086
|
-
const o = [...r.data.values()].map((c, u) => a._parse(new
|
|
3086
|
+
const o = [...r.data.values()].map((c, u) => a._parse(new xe(r, c, r.path, u)));
|
|
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(x(d({}, this._def), {
|
|
3091
3091
|
minSize: { value: e, message: w.toString(n) }
|
|
3092
3092
|
}));
|
|
3093
3093
|
}
|
|
3094
3094
|
max(e, n) {
|
|
3095
|
-
return new
|
|
3095
|
+
return new tt(x(d({}, this._def), {
|
|
3096
3096
|
maxSize: { value: e, message: w.toString(n) }
|
|
3097
3097
|
}));
|
|
3098
3098
|
}
|
|
@@ -3103,12 +3103,12 @@ 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:
|
|
3111
|
-
},
|
|
3110
|
+
typeName: S.ZodSet
|
|
3111
|
+
}, T(e)));
|
|
3112
3112
|
class ht extends A {
|
|
3113
3113
|
constructor() {
|
|
3114
3114
|
super(...arguments), this.validate = this.implement;
|
|
@@ -3156,9 +3156,9 @@ 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
|
|
3160
|
-
return
|
|
3161
|
-
const u = new
|
|
3159
|
+
return te(function(...c) {
|
|
3160
|
+
return Se(this, null, function* () {
|
|
3161
|
+
const u = new ie([]), h = yield o._def.args.parseAsync(c, a).catch((k) => {
|
|
3162
3162
|
throw u.addIssue(r(c, k)), u;
|
|
3163
3163
|
}), p = yield Reflect.apply(i, this, h);
|
|
3164
3164
|
return yield o._def.returns._def.type.parseAsync(p, a).catch((k) => {
|
|
@@ -3168,13 +3168,13 @@ 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
|
-
throw new
|
|
3174
|
+
throw new ie([r(c, u.error)]);
|
|
3175
3175
|
const h = Reflect.apply(i, this, u.data), p = o._def.returns.safeParse(h, a);
|
|
3176
3176
|
if (!p.success)
|
|
3177
|
-
throw new
|
|
3177
|
+
throw new ie([s(h, p.error)]);
|
|
3178
3178
|
return p.data;
|
|
3179
3179
|
});
|
|
3180
3180
|
}
|
|
@@ -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: Ee.create(e).rest(
|
|
3189
|
+
return new ht(x(d({}, this._def), {
|
|
3190
|
+
args: Ee.create(e).rest(Ye.create())
|
|
3191
3191
|
}));
|
|
3192
3192
|
}
|
|
3193
3193
|
returns(e) {
|
|
3194
|
-
return new ht(
|
|
3194
|
+
return new ht(x(d({}, this._def), {
|
|
3195
3195
|
returns: e
|
|
3196
3196
|
}));
|
|
3197
3197
|
}
|
|
@@ -3203,10 +3203,10 @@ class ht extends A {
|
|
|
3203
3203
|
}
|
|
3204
3204
|
static create(e, n, r) {
|
|
3205
3205
|
return new ht(d({
|
|
3206
|
-
args: e || Ee.create([]).rest(
|
|
3207
|
-
returns: n ||
|
|
3208
|
-
typeName:
|
|
3209
|
-
},
|
|
3206
|
+
args: e || Ee.create([]).rest(Ye.create()),
|
|
3207
|
+
returns: n || Ye.create(),
|
|
3208
|
+
typeName: S.ZodFunction
|
|
3209
|
+
}, T(r)));
|
|
3210
3210
|
}
|
|
3211
3211
|
}
|
|
3212
3212
|
class $t extends A {
|
|
@@ -3220,8 +3220,8 @@ class $t extends A {
|
|
|
3220
3220
|
}
|
|
3221
3221
|
$t.create = (t, e) => new $t(d({
|
|
3222
3222
|
getter: t,
|
|
3223
|
-
typeName:
|
|
3224
|
-
},
|
|
3223
|
+
typeName: S.ZodLazy
|
|
3224
|
+
}, T(e)));
|
|
3225
3225
|
class Ft extends A {
|
|
3226
3226
|
_parse(e) {
|
|
3227
3227
|
if (e.data !== this._def.value) {
|
|
@@ -3240,13 +3240,13 @@ class Ft extends A {
|
|
|
3240
3240
|
}
|
|
3241
3241
|
Ft.create = (t, e) => new Ft(d({
|
|
3242
3242
|
value: t,
|
|
3243
|
-
typeName:
|
|
3244
|
-
},
|
|
3243
|
+
typeName: S.ZodLiteral
|
|
3244
|
+
}, T(e)));
|
|
3245
3245
|
function Ds(t, e) {
|
|
3246
3246
|
return new Fe(d({
|
|
3247
3247
|
values: t,
|
|
3248
|
-
typeName:
|
|
3249
|
-
},
|
|
3248
|
+
typeName: S.ZodEnum
|
|
3249
|
+
}, T(e)));
|
|
3250
3250
|
}
|
|
3251
3251
|
class Fe extends A {
|
|
3252
3252
|
constructor() {
|
|
@@ -3269,7 +3269,7 @@ class Fe extends A {
|
|
|
3269
3269
|
options: r
|
|
3270
3270
|
}), E;
|
|
3271
3271
|
}
|
|
3272
|
-
return
|
|
3272
|
+
return te(e.data);
|
|
3273
3273
|
}
|
|
3274
3274
|
get options() {
|
|
3275
3275
|
return this._def.values;
|
|
@@ -3323,7 +3323,7 @@ class Wt extends A {
|
|
|
3323
3323
|
options: s
|
|
3324
3324
|
}), E;
|
|
3325
3325
|
}
|
|
3326
|
-
return
|
|
3326
|
+
return te(e.data);
|
|
3327
3327
|
}
|
|
3328
3328
|
get enum() {
|
|
3329
3329
|
return this._def.values;
|
|
@@ -3332,8 +3332,8 @@ 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:
|
|
3336
|
-
},
|
|
3335
|
+
typeName: S.ZodNativeEnum
|
|
3336
|
+
}, T(e)));
|
|
3337
3337
|
class vt extends A {
|
|
3338
3338
|
unwrap() {
|
|
3339
3339
|
return this._def.type;
|
|
@@ -3347,7 +3347,7 @@ class vt extends A {
|
|
|
3347
3347
|
received: n.parsedType
|
|
3348
3348
|
}), E;
|
|
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:
|
|
3359
|
-
},
|
|
3358
|
+
typeName: S.ZodPromise
|
|
3359
|
+
}, T(e)));
|
|
3360
3360
|
class ge 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 === S.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 = {
|
|
@@ -3376,7 +3376,7 @@ class ge extends A {
|
|
|
3376
3376
|
if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
|
|
3377
3377
|
const i = s.transform(r.data, a);
|
|
3378
3378
|
if (r.common.async)
|
|
3379
|
-
return Promise.resolve(i).then((o) =>
|
|
3379
|
+
return Promise.resolve(i).then((o) => Se(this, null, function* () {
|
|
3380
3380
|
if (n.value === "aborted")
|
|
3381
3381
|
return E;
|
|
3382
3382
|
const c = yield this._def.schema._parseAsync({
|
|
@@ -3423,30 +3423,30 @@ 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
|
ge.create = (t, e, n) => new ge(d({
|
|
3438
3438
|
schema: t,
|
|
3439
|
-
typeName:
|
|
3439
|
+
typeName: S.ZodEffects,
|
|
3440
3440
|
effect: e
|
|
3441
|
-
},
|
|
3441
|
+
}, T(n)));
|
|
3442
3442
|
ge.createWithPreprocess = (t, e, n) => new ge(d({
|
|
3443
3443
|
schema: e,
|
|
3444
3444
|
effect: { type: "preprocess", transform: t },
|
|
3445
|
-
typeName:
|
|
3446
|
-
},
|
|
3445
|
+
typeName: S.ZodEffects
|
|
3446
|
+
}, T(n)));
|
|
3447
3447
|
class ke 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;
|
|
@@ -3454,11 +3454,11 @@ class ke extends A {
|
|
|
3454
3454
|
}
|
|
3455
3455
|
ke.create = (t, e) => new ke(d({
|
|
3456
3456
|
innerType: t,
|
|
3457
|
-
typeName:
|
|
3458
|
-
},
|
|
3457
|
+
typeName: S.ZodOptional
|
|
3458
|
+
}, T(e)));
|
|
3459
3459
|
class We 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;
|
|
@@ -3466,8 +3466,8 @@ class We extends A {
|
|
|
3466
3466
|
}
|
|
3467
3467
|
We.create = (t, e) => new We(d({
|
|
3468
3468
|
innerType: t,
|
|
3469
|
-
typeName:
|
|
3470
|
-
},
|
|
3469
|
+
typeName: S.ZodNullable
|
|
3470
|
+
}, T(e)));
|
|
3471
3471
|
class zt extends A {
|
|
3472
3472
|
_parse(e) {
|
|
3473
3473
|
const { ctx: n } = this._processInputParams(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: S.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 = x(d({}, n), {
|
|
3493
|
+
common: x(d({}, n.common), {
|
|
3494
3494
|
issues: []
|
|
3495
3495
|
})
|
|
3496
3496
|
}), s = this._def.innerType._parse({
|
|
@@ -3502,7 +3502,7 @@ class Ut extends A {
|
|
|
3502
3502
|
status: "valid",
|
|
3503
3503
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
3504
3504
|
get error() {
|
|
3505
|
-
return new
|
|
3505
|
+
return new ie(r.common.issues);
|
|
3506
3506
|
},
|
|
3507
3507
|
input: r.data
|
|
3508
3508
|
})
|
|
@@ -3510,7 +3510,7 @@ class Ut extends A {
|
|
|
3510
3510
|
status: "valid",
|
|
3511
3511
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
3512
3512
|
get error() {
|
|
3513
|
-
return new
|
|
3513
|
+
return new ie(r.common.issues);
|
|
3514
3514
|
},
|
|
3515
3515
|
input: r.data
|
|
3516
3516
|
})
|
|
@@ -3522,9 +3522,9 @@ class Ut extends A {
|
|
|
3522
3522
|
}
|
|
3523
3523
|
Ut.create = (t, e) => new Ut(d({
|
|
3524
3524
|
innerType: t,
|
|
3525
|
-
typeName:
|
|
3525
|
+
typeName: S.ZodCatch,
|
|
3526
3526
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
|
|
3527
|
-
},
|
|
3527
|
+
}, T(e)));
|
|
3528
3528
|
class vn extends A {
|
|
3529
3529
|
_parse(e) {
|
|
3530
3530
|
if (this._getType(e) !== _.nan) {
|
|
@@ -3539,8 +3539,8 @@ class vn extends A {
|
|
|
3539
3539
|
}
|
|
3540
3540
|
}
|
|
3541
3541
|
vn.create = (t) => new vn(d({
|
|
3542
|
-
typeName:
|
|
3543
|
-
},
|
|
3542
|
+
typeName: S.ZodNaN
|
|
3543
|
+
}, T(t)));
|
|
3544
3544
|
const to = Symbol("zod_brand");
|
|
3545
3545
|
class Nr extends A {
|
|
3546
3546
|
_parse(e) {
|
|
@@ -3559,7 +3559,7 @@ class Jt extends A {
|
|
|
3559
3559
|
_parse(e) {
|
|
3560
3560
|
const { status: n, ctx: r } = this._processInputParams(e);
|
|
3561
3561
|
if (r.common.async)
|
|
3562
|
-
return
|
|
3562
|
+
return Se(this, null, function* () {
|
|
3563
3563
|
const s = yield this._def.in._parseAsync({
|
|
3564
3564
|
data: r.data,
|
|
3565
3565
|
path: r.path,
|
|
@@ -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: S.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,8 +3606,8 @@ class Vt extends A {
|
|
|
3606
3606
|
}
|
|
3607
3607
|
Vt.create = (t, e) => new Vt(d({
|
|
3608
3608
|
innerType: t,
|
|
3609
|
-
typeName:
|
|
3610
|
-
},
|
|
3609
|
+
typeName: S.ZodReadonly
|
|
3610
|
+
}, T(e)));
|
|
3611
3611
|
function as(t, e) {
|
|
3612
3612
|
const n = typeof t == "function" ? t(e) : typeof t == "string" ? { message: t } : t;
|
|
3613
3613
|
return typeof n == "string" ? { message: n } : n;
|
|
@@ -3621,34 +3621,34 @@ 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(x(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(x(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 S;
|
|
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
|
+
})(S || (S = {}));
|
|
3640
3640
|
const ro = (t, e = {
|
|
3641
3641
|
message: `Input not instance of ${t.name}`
|
|
3642
|
-
}) => Ms((n) => n instanceof t, e), Ls = me.create, $s = Le.create, so = vn.create, ao = $e.create, Fs = It.create, io =
|
|
3643
|
-
string: (t) => me.create(
|
|
3644
|
-
number: (t) => Le.create(
|
|
3645
|
-
boolean: (t) => It.create(
|
|
3642
|
+
}) => Ms((n) => n instanceof t, e), Ls = me.create, $s = Le.create, so = vn.create, ao = $e.create, Fs = It.create, io = et.create, oo = mn.create, co = Pt.create, uo = Zt.create, lo = gt.create, fo = Ye.create, ho = je.create, po = yn.create, mo = ye.create, yo = z.create, go = z.strictCreate, vo = Dt.create, _o = Sn.create, bo = Mt.create, wo = Ee.create, ko = Lt.create, So = gn.create, xo = tt.create, Eo = ht.create, Oo = $t.create, To = Ft.create, Ao = Fe.create, Co = Wt.create, No = vt.create, is = ge.create, Ro = ke.create, jo = We.create, Io = ge.createWithPreprocess, Po = Jt.create, Zo = () => Ls().optional(), Do = () => $s().optional(), Mo = () => Fs().optional(), Lo = {
|
|
3643
|
+
string: (t) => me.create(x(d({}, t), { coerce: !0 })),
|
|
3644
|
+
number: (t) => Le.create(x(d({}, t), { coerce: !0 })),
|
|
3645
|
+
boolean: (t) => It.create(x(d({}, t), {
|
|
3646
3646
|
coerce: !0
|
|
3647
3647
|
})),
|
|
3648
|
-
bigint: (t) => $e.create(
|
|
3649
|
-
date: (t) =>
|
|
3648
|
+
bigint: (t) => $e.create(x(d({}, t), { coerce: !0 })),
|
|
3649
|
+
date: (t) => et.create(x(d({}, t), { coerce: !0 }))
|
|
3650
3650
|
}, $o = E;
|
|
3651
|
-
var
|
|
3651
|
+
var I = /* @__PURE__ */ Object.freeze({
|
|
3652
3652
|
__proto__: null,
|
|
3653
3653
|
defaultErrorMap: yt,
|
|
3654
3654
|
setErrorMap: ji,
|
|
@@ -3656,13 +3656,13 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
3656
3656
|
makeIssue: fn,
|
|
3657
3657
|
EMPTY_PATH: Ii,
|
|
3658
3658
|
addIssueToContext: y,
|
|
3659
|
-
ParseStatus:
|
|
3659
|
+
ParseStatus: X,
|
|
3660
3660
|
INVALID: E,
|
|
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;
|
|
@@ -3678,23 +3678,23 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
3678
3678
|
ZodNumber: Le,
|
|
3679
3679
|
ZodBigInt: $e,
|
|
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:
|
|
3686
|
+
ZodUnknown: Ye,
|
|
3687
3687
|
ZodNever: je,
|
|
3688
3688
|
ZodVoid: yn,
|
|
3689
3689
|
ZodArray: ye,
|
|
3690
3690
|
ZodObject: z,
|
|
3691
3691
|
ZodUnion: Dt,
|
|
3692
|
-
ZodDiscriminatedUnion:
|
|
3692
|
+
ZodDiscriminatedUnion: Sn,
|
|
3693
3693
|
ZodIntersection: Mt,
|
|
3694
3694
|
ZodTuple: Ee,
|
|
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,
|
|
@@ -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 S;
|
|
3721
3721
|
},
|
|
3722
3722
|
coerce: Lo,
|
|
3723
3723
|
any: lo,
|
|
@@ -3733,7 +3733,7 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
3733
3733
|
intersection: bo,
|
|
3734
3734
|
lazy: Oo,
|
|
3735
3735
|
literal: To,
|
|
3736
|
-
map:
|
|
3736
|
+
map: So,
|
|
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: xo,
|
|
3753
3753
|
strictObject: go,
|
|
3754
3754
|
string: Ls,
|
|
3755
3755
|
symbol: oo,
|
|
@@ -3762,20 +3762,20 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
3762
3762
|
NEVER: $o,
|
|
3763
3763
|
ZodIssueCode: f,
|
|
3764
3764
|
quotelessJson: Ri,
|
|
3765
|
-
ZodError:
|
|
3765
|
+
ZodError: ie
|
|
3766
3766
|
});
|
|
3767
|
-
|
|
3768
|
-
language:
|
|
3769
|
-
disableMarkedForExport:
|
|
3770
|
-
allowAutoSelectFirstNode:
|
|
3771
|
-
enableDisplayDataId:
|
|
3772
|
-
enableDisplayDataName:
|
|
3767
|
+
I.object({
|
|
3768
|
+
language: I.enum(["typescript", "javascript"]).optional(),
|
|
3769
|
+
disableMarkedForExport: I.boolean().optional(),
|
|
3770
|
+
allowAutoSelectFirstNode: I.boolean().optional().default(!0),
|
|
3771
|
+
enableDisplayDataId: I.boolean().optional(),
|
|
3772
|
+
enableDisplayDataName: I.boolean().optional()
|
|
3773
3773
|
}).and(
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
framework:
|
|
3777
|
-
model:
|
|
3778
|
-
styling:
|
|
3774
|
+
I.union([
|
|
3775
|
+
I.object({
|
|
3776
|
+
framework: I.literal("react"),
|
|
3777
|
+
model: I.string().optional(),
|
|
3778
|
+
styling: I.enum([
|
|
3779
3779
|
"plain_css",
|
|
3780
3780
|
"css_modules",
|
|
3781
3781
|
"styled_components",
|
|
@@ -3784,27 +3784,27 @@ j.object({
|
|
|
3784
3784
|
"scss",
|
|
3785
3785
|
"inline_styles"
|
|
3786
3786
|
]),
|
|
3787
|
-
uiLibrary:
|
|
3788
|
-
responsivePages:
|
|
3789
|
-
|
|
3790
|
-
name:
|
|
3791
|
-
framesId:
|
|
3787
|
+
uiLibrary: I.enum(["mui", "antd", "radix", "shadcn", "clean_react"]).optional(),
|
|
3788
|
+
responsivePages: I.array(
|
|
3789
|
+
I.object({
|
|
3790
|
+
name: I.string(),
|
|
3791
|
+
framesId: I.array(I.string())
|
|
3792
3792
|
})
|
|
3793
3793
|
).optional(),
|
|
3794
|
-
enableUILibraryTheming:
|
|
3795
|
-
enableCompactStructure:
|
|
3796
|
-
enableDisplayScreenModelId:
|
|
3797
|
-
enableGeneratePackageLock:
|
|
3798
|
-
enableAnimationsPreset:
|
|
3799
|
-
enableAutoSplit:
|
|
3800
|
-
autoSplitThreshold:
|
|
3801
|
-
url:
|
|
3802
|
-
codegenSettings:
|
|
3794
|
+
enableUILibraryTheming: I.boolean().optional(),
|
|
3795
|
+
enableCompactStructure: I.boolean().optional(),
|
|
3796
|
+
enableDisplayScreenModelId: I.boolean().optional(),
|
|
3797
|
+
enableGeneratePackageLock: I.boolean().optional(),
|
|
3798
|
+
enableAnimationsPreset: I.boolean().optional(),
|
|
3799
|
+
enableAutoSplit: I.boolean().optional(),
|
|
3800
|
+
autoSplitThreshold: I.number().optional(),
|
|
3801
|
+
url: I.string().url().optional(),
|
|
3802
|
+
codegenSettings: I.record(I.unknown()).optional()
|
|
3803
3803
|
}),
|
|
3804
|
-
|
|
3805
|
-
framework:
|
|
3806
|
-
styling:
|
|
3807
|
-
enableTranslation:
|
|
3804
|
+
I.object({
|
|
3805
|
+
framework: I.literal("html"),
|
|
3806
|
+
styling: I.enum(["plain_css", "inline_styles", "tailwind"]),
|
|
3807
|
+
enableTranslation: I.boolean().optional()
|
|
3808
3808
|
})
|
|
3809
3809
|
])
|
|
3810
3810
|
);
|
|
@@ -3823,10 +3823,10 @@ function Fo(t) {
|
|
|
3823
3823
|
const { onEvent: e = Zn, onError: n = Zn, onRetry: r = Zn, onComment: s } = t;
|
|
3824
3824
|
let a = "", i = !0, o, c = "", u = "";
|
|
3825
3825
|
function h(m) {
|
|
3826
|
-
const g = i ? m.replace(/^\xEF\xBB\xBF/, "") : m, [l,
|
|
3827
|
-
for (const
|
|
3828
|
-
p(
|
|
3829
|
-
a =
|
|
3826
|
+
const g = i ? m.replace(/^\xEF\xBB\xBF/, "") : m, [l, O] = Wo(`${a}${g}`);
|
|
3827
|
+
for (const P of l)
|
|
3828
|
+
p(P);
|
|
3829
|
+
a = O, i = !1;
|
|
3830
3830
|
}
|
|
3831
3831
|
function p(m) {
|
|
3832
3832
|
if (m === "") {
|
|
@@ -3839,8 +3839,8 @@ function Fo(t) {
|
|
|
3839
3839
|
}
|
|
3840
3840
|
const g = m.indexOf(":");
|
|
3841
3841
|
if (g !== -1) {
|
|
3842
|
-
const l = m.slice(0, g),
|
|
3843
|
-
k(l,
|
|
3842
|
+
const l = m.slice(0, g), O = m[g + 1] === " " ? 2 : 1, P = m.slice(g + O);
|
|
3843
|
+
k(l, P, m);
|
|
3844
3844
|
return;
|
|
3845
3845
|
}
|
|
3846
3846
|
k(m, "", m);
|
|
@@ -3970,11 +3970,11 @@ 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), Ce = (t, e, n) => (Rr(t, e, "access private method"), 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), Ce = (t, e, n) => (Rr(t, e, "access private method"), n), re, Xe, ut, un, _n, Nt, ft, Rt, De, dt, pt, lt, At, pe, 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, pe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, q(this,
|
|
3977
|
+
super(), q(this, pe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, q(this, re), q(this, Xe), q(this, ut), q(this, un), q(this, _n), q(this, Nt), q(this, ft), q(this, Rt, null), q(this, De), q(this, dt), q(this, pt, null), q(this, lt, null), q(this, At, null), q(this, or, (a) => Ie(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;
|
|
@@ -3990,9 +3990,9 @@ class dn extends EventTarget {
|
|
|
3990
3990
|
Ce(this, pe, Ct).call(this, 'Invalid content type, expected "text/event-stream"', u);
|
|
3991
3991
|
return;
|
|
3992
3992
|
}
|
|
3993
|
-
if (C(this,
|
|
3993
|
+
if (C(this, re) === this.CLOSED)
|
|
3994
3994
|
return;
|
|
3995
|
-
W(this,
|
|
3995
|
+
W(this, re, 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
|
Ce(this, pe, Ct).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
@@ -4010,20 +4010,20 @@ class dn extends EventTarget {
|
|
|
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,
|
|
4020
|
+
W(this, ft, void 0), C(this, re) === this.CONNECTING && Ce(this, pe, 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,
|
|
4035
|
+
})), W(this, re, 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), Ce(this, pe, 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.
|
|
@@ -4045,7 +4045,7 @@ class dn extends EventTarget {
|
|
|
4045
4045
|
* @public
|
|
4046
4046
|
*/
|
|
4047
4047
|
get readyState() {
|
|
4048
|
-
return C(this,
|
|
4048
|
+
return C(this, re);
|
|
4049
4049
|
}
|
|
4050
4050
|
/**
|
|
4051
4051
|
* Returns the URL providing the event stream.
|
|
@@ -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,
|
|
4105
|
+
C(this, ft) && clearTimeout(C(this, ft)), C(this, re) !== this.CLOSED && (C(this, De) && C(this, De).abort(), W(this, re, this.CLOSED), W(this, De, void 0));
|
|
4106
4106
|
}
|
|
4107
4107
|
}
|
|
4108
|
-
|
|
4108
|
+
re = /* @__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(), De = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), pe = /* @__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,
|
|
4114
|
+
W(this, re, this.CONNECTING), W(this, De, new AbortController()), C(this, _n)(C(this, Xe), Ce(this, pe, 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,7 +4125,7 @@ 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
4130
|
signal: (t = C(this, De)) == null ? void 0 : t.signal
|
|
4131
4131
|
};
|
|
@@ -4139,7 +4139,7 @@ ds = function() {
|
|
|
4139
4139
|
*/
|
|
4140
4140
|
Ct = function(t, e) {
|
|
4141
4141
|
var n;
|
|
4142
|
-
C(this,
|
|
4142
|
+
C(this, re) !== this.CLOSED && W(this, re, this.CLOSED);
|
|
4143
4143
|
const r = new cs("error", { code: e, message: t });
|
|
4144
4144
|
(n = C(this, pt)) == null || n.call(this, r), this.dispatchEvent(r);
|
|
4145
4145
|
}, /**
|
|
@@ -4151,9 +4151,9 @@ Ct = function(t, e) {
|
|
|
4151
4151
|
*/
|
|
4152
4152
|
lr = function(t, e) {
|
|
4153
4153
|
var n;
|
|
4154
|
-
if (C(this,
|
|
4154
|
+
if (C(this, re) === this.CLOSED)
|
|
4155
4155
|
return;
|
|
4156
|
-
W(this,
|
|
4156
|
+
W(this, re, this.CONNECTING);
|
|
4157
4157
|
const r = new cs("error", { code: e, message: t });
|
|
4158
4158
|
(n = C(this, pt)) == null || n.call(this, r), this.dispatchEvent(r), W(this, ft, setTimeout(C(this, fr), C(this, Nt)));
|
|
4159
4159
|
}, fr = /* @__PURE__ */ new WeakMap(), /**
|
|
@@ -4176,7 +4176,7 @@ function Uo() {
|
|
|
4176
4176
|
const t = "document" in globalThis ? globalThis.document : void 0;
|
|
4177
4177
|
return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
|
|
4178
4178
|
}
|
|
4179
|
-
var zs = Symbol.for("immer-nothing"), ls = Symbol.for("immer-draftable"),
|
|
4179
|
+
var zs = Symbol.for("immer-nothing"), ls = Symbol.for("immer-draftable"), oe = Symbol.for("immer-state"), Vo = process.env.NODE_ENV !== "production" ? [
|
|
4180
4180
|
// All error codes, starting by 0:
|
|
4181
4181
|
function(t) {
|
|
4182
4182
|
return `The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`;
|
|
@@ -4207,7 +4207,7 @@ var zs = Symbol.for("immer-nothing"), ls = Symbol.for("immer-draftable"), ce = S
|
|
|
4207
4207
|
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
4208
4208
|
// See Patches.ts for additional errors
|
|
4209
4209
|
] : [];
|
|
4210
|
-
function
|
|
4210
|
+
function se(t, ...e) {
|
|
4211
4211
|
if (process.env.NODE_ENV !== "production") {
|
|
4212
4212
|
const n = Vo[t], r = typeof n == "function" ? n.apply(null, e) : n;
|
|
4213
4213
|
throw new Error(`[Immer] ${r}`);
|
|
@@ -4218,9 +4218,9 @@ function ae(t, ...e) {
|
|
|
4218
4218
|
}
|
|
4219
4219
|
var _t = Object.getPrototypeOf;
|
|
4220
4220
|
function bt(t) {
|
|
4221
|
-
return !!t && !!t[
|
|
4221
|
+
return !!t && !!t[oe];
|
|
4222
4222
|
}
|
|
4223
|
-
function
|
|
4223
|
+
function nt(t) {
|
|
4224
4224
|
var e;
|
|
4225
4225
|
return t ? Us(t) || Array.isArray(t) || !!t[ls] || !!((e = t.constructor) != null && e[ls]) || En(t) || On(t) : !1;
|
|
4226
4226
|
}
|
|
@@ -4235,19 +4235,19 @@ 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
|
+
xn(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
|
|
4243
|
-
const e = t[
|
|
4242
|
+
function xn(t) {
|
|
4243
|
+
const e = t[oe];
|
|
4244
4244
|
return e ? e.type_ : Array.isArray(t) ? 1 : En(t) ? 2 : On(t) ? 3 : 0;
|
|
4245
4245
|
}
|
|
4246
4246
|
function hr(t, e) {
|
|
4247
|
-
return
|
|
4247
|
+
return xn(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 = xn(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) {
|
|
@@ -4259,7 +4259,7 @@ function En(t) {
|
|
|
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) {
|
|
@@ -4272,7 +4272,7 @@ function pr(t, e) {
|
|
|
4272
4272
|
const n = Us(t);
|
|
4273
4273
|
if (e === !0 || e === "class_only" && !n) {
|
|
4274
4274
|
const r = Object.getOwnPropertyDescriptors(t);
|
|
4275
|
-
delete r[
|
|
4275
|
+
delete r[oe];
|
|
4276
4276
|
let s = Reflect.ownKeys(r);
|
|
4277
4277
|
for (let a = 0; a < s.length; a++) {
|
|
4278
4278
|
const i = s[a], o = r[i];
|
|
@@ -4288,24 +4288,24 @@ 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) || (xn(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
|
+
se(2);
|
|
4301
4301
|
}
|
|
4302
4302
|
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
|
-
return e ||
|
|
4308
|
+
return e || se(0, t), e;
|
|
4309
4309
|
}
|
|
4310
4310
|
var Bt;
|
|
4311
4311
|
function Ks() {
|
|
@@ -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;
|
|
@@ -4335,14 +4335,14 @@ function hs(t) {
|
|
|
4335
4335
|
return Bt = Go(Bt, t);
|
|
4336
4336
|
}
|
|
4337
4337
|
function Jo(t) {
|
|
4338
|
-
const e = t[
|
|
4338
|
+
const e = t[oe];
|
|
4339
4339
|
e.type_ === 0 || e.type_ === 1 ? e.revoke_() : e.revoked_ = !0;
|
|
4340
4340
|
}
|
|
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[
|
|
4345
|
-
n[
|
|
4344
|
+
return t !== void 0 && t !== n ? (n[oe].modified_ && (mr(e), se(4)), nt(t) && (t = wn(e, t), e.parent_ || kn(e, t)), e.patches_ && rt("Patches").generateReplacementPatches_(
|
|
4345
|
+
n[oe].base_,
|
|
4346
4346
|
t,
|
|
4347
4347
|
e.patches_,
|
|
4348
4348
|
e.inversePatches_
|
|
@@ -4351,7 +4351,7 @@ function ps(t, e) {
|
|
|
4351
4351
|
function wn(t, e, n) {
|
|
4352
4352
|
if (Tn(e))
|
|
4353
4353
|
return e;
|
|
4354
|
-
const r = e[
|
|
4354
|
+
const r = e[oe];
|
|
4355
4355
|
if (!r)
|
|
4356
4356
|
return bn(
|
|
4357
4357
|
e,
|
|
@@ -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_,
|
|
@@ -4378,7 +4378,7 @@ function wn(t, e, n) {
|
|
|
4378
4378
|
return r.copy_;
|
|
4379
4379
|
}
|
|
4380
4380
|
function ms(t, e, n, r, s, a, i) {
|
|
4381
|
-
if (process.env.NODE_ENV !== "production" && s === n &&
|
|
4381
|
+
if (process.env.NODE_ENV !== "production" && s === n && se(5), bt(s)) {
|
|
4382
4382
|
const o = a && e && e.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
4383
4383
|
!hr(e.assigned_, r) ? a.concat(r) : void 0, c = wn(t, s, o);
|
|
4384
4384
|
if (Vs(n, r, c), bt(c))
|
|
@@ -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);
|
|
@@ -4426,26 +4426,26 @@ function Xo(t, e) {
|
|
|
4426
4426
|
}
|
|
4427
4427
|
var jr = {
|
|
4428
4428
|
get(t, e) {
|
|
4429
|
-
if (e ===
|
|
4429
|
+
if (e === oe)
|
|
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[oe];
|
|
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",
|
|
@@ -4471,13 +4471,13 @@ var jr = {
|
|
|
4471
4471
|
};
|
|
4472
4472
|
},
|
|
4473
4473
|
defineProperty() {
|
|
4474
|
-
|
|
4474
|
+
se(11);
|
|
4475
4475
|
},
|
|
4476
4476
|
getPrototypeOf(t) {
|
|
4477
4477
|
return _t(t.base_);
|
|
4478
4478
|
},
|
|
4479
4479
|
setPrototypeOf() {
|
|
4480
|
-
|
|
4480
|
+
se(12);
|
|
4481
4481
|
}
|
|
4482
4482
|
}, qt = {};
|
|
4483
4483
|
bn(jr, (t, e) => {
|
|
@@ -4486,14 +4486,14 @@ bn(jr, (t, e) => {
|
|
|
4486
4486
|
};
|
|
4487
4487
|
});
|
|
4488
4488
|
qt.deleteProperty = function(t, e) {
|
|
4489
|
-
return process.env.NODE_ENV !== "production" && isNaN(parseInt(e)) &&
|
|
4489
|
+
return process.env.NODE_ENV !== "production" && isNaN(parseInt(e)) && se(13), qt.set.call(this, t, e, void 0);
|
|
4490
4490
|
};
|
|
4491
4491
|
qt.set = function(t, e, n) {
|
|
4492
|
-
return process.env.NODE_ENV !== "production" && e !== "length" && isNaN(parseInt(e)) &&
|
|
4492
|
+
return process.env.NODE_ENV !== "production" && e !== "length" && isNaN(parseInt(e)) && se(14), jr.set.call(this, t[0], e, n, t[0]);
|
|
4493
4493
|
};
|
|
4494
4494
|
function Dn(t, e) {
|
|
4495
|
-
const n = t[
|
|
4496
|
-
return (n ?
|
|
4495
|
+
const n = t[oe];
|
|
4496
|
+
return (n ? He(n) : t)[e];
|
|
4497
4497
|
}
|
|
4498
4498
|
function Yo(t, e, n) {
|
|
4499
4499
|
var s;
|
|
@@ -4535,9 +4535,9 @@ var Qo = class {
|
|
|
4535
4535
|
return i.produce(c, (h) => n.call(this, h, ...u));
|
|
4536
4536
|
};
|
|
4537
4537
|
}
|
|
4538
|
-
typeof n != "function" &&
|
|
4538
|
+
typeof n != "function" && se(6), r !== void 0 && typeof r != "function" && se(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,11 +4549,11 @@ 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
|
|
4556
|
-
|
|
4556
|
+
se(1, e);
|
|
4557
4557
|
}, this.produceWithPatches = (e, n) => {
|
|
4558
4558
|
if (typeof e == "function")
|
|
4559
4559
|
return (i, ...o) => this.produceWithPatches(i, (c) => e(c, ...o));
|
|
@@ -4564,13 +4564,13 @@ 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) || se(8), bt(t) && (t = ec(t));
|
|
4568
4568
|
const e = hs(this), n = vr(t, void 0);
|
|
4569
|
-
return n[
|
|
4569
|
+
return n[oe].isManual_ = !0, yr(e), n;
|
|
4570
4570
|
}
|
|
4571
4571
|
finishDraft(t, e) {
|
|
4572
|
-
const n = t && t[
|
|
4573
|
-
(!n || !n.isManual_) &&
|
|
4572
|
+
const n = t && t[oe];
|
|
4573
|
+
(!n || !n.isManual_) && se(9);
|
|
4574
4574
|
const { scope_: r } = n;
|
|
4575
4575
|
return fs(r, e), ps(void 0, r);
|
|
4576
4576
|
}
|
|
@@ -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,16 +4608,16 @@ var Qo = class {
|
|
|
4608
4608
|
}
|
|
4609
4609
|
};
|
|
4610
4610
|
function vr(t, e) {
|
|
4611
|
-
const n = En(t) ?
|
|
4611
|
+
const n = En(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
|
-
return bt(t) ||
|
|
4615
|
+
return bt(t) || se(10, t), qs(t);
|
|
4616
4616
|
}
|
|
4617
4617
|
function qs(t) {
|
|
4618
|
-
if (!
|
|
4618
|
+
if (!nt(t) || Tn(t))
|
|
4619
4619
|
return t;
|
|
4620
|
-
const e = t[
|
|
4620
|
+
const e = t[oe];
|
|
4621
4621
|
let n;
|
|
4622
4622
|
if (e) {
|
|
4623
4623
|
if (!e.modified_)
|
|
@@ -4629,15 +4629,15 @@ function qs(t) {
|
|
|
4629
4629
|
Vs(n, r, qs(s));
|
|
4630
4630
|
}), e && (e.finalized_ = !1), n;
|
|
4631
4631
|
}
|
|
4632
|
-
var
|
|
4633
|
-
|
|
4634
|
-
|
|
4632
|
+
var ce = new Qo(), tc = ce.produce;
|
|
4633
|
+
ce.produceWithPatches.bind(
|
|
4634
|
+
ce
|
|
4635
4635
|
);
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4636
|
+
ce.setAutoFreeze.bind(ce);
|
|
4637
|
+
ce.setUseStrictShallowCopy.bind(ce);
|
|
4638
|
+
ce.applyPatches.bind(ce);
|
|
4639
|
+
ce.createDraft.bind(ce);
|
|
4640
|
+
ce.finishDraft.bind(ce);
|
|
4641
4641
|
function nc(t) {
|
|
4642
4642
|
var e = la(function() {
|
|
4643
4643
|
return Kt(typeof t == "function" ? t() : t, !0);
|
|
@@ -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)
|
|
@@ -4696,21 +4696,21 @@ const ys = 10, gs = {
|
|
|
4696
4696
|
const b = {};
|
|
4697
4697
|
c.addEventListener("start", (g) => {
|
|
4698
4698
|
const l = JSON.parse(g.data);
|
|
4699
|
-
b.sessionId = l.sessionId, r((
|
|
4700
|
-
|
|
4699
|
+
b.sessionId = l.sessionId, r((O) => {
|
|
4700
|
+
O.tasks.fetchDesign.status = "running", O.jobSessionId = l.sessionId;
|
|
4701
4701
|
});
|
|
4702
4702
|
}), c.addEventListener("queueing", (g) => {
|
|
4703
4703
|
const l = JSON.parse(
|
|
4704
4704
|
g.data
|
|
4705
4705
|
);
|
|
4706
|
-
r((
|
|
4707
|
-
|
|
4706
|
+
r((O) => {
|
|
4707
|
+
O.jobSessionId = l.payload.sessionId;
|
|
4708
4708
|
});
|
|
4709
4709
|
}), c.addEventListener("pre_codegen", (g) => {
|
|
4710
4710
|
JSON.parse(
|
|
4711
4711
|
g.data
|
|
4712
|
-
).message === "Anima model built" && r((
|
|
4713
|
-
|
|
4712
|
+
).message === "Anima model built" && r((O) => {
|
|
4713
|
+
O.tasks.fetchDesign.status = "finished", O.tasks.codeGeneration.status = "running", O.tasks.uploadAssets.status = "running";
|
|
4714
4714
|
});
|
|
4715
4715
|
}), c.addEventListener("figma_metadata", (g) => {
|
|
4716
4716
|
const l = JSON.parse(
|
|
@@ -4729,22 +4729,22 @@ const ys = 10, gs = {
|
|
|
4729
4729
|
const l = JSON.parse(
|
|
4730
4730
|
g.data
|
|
4731
4731
|
);
|
|
4732
|
-
l.payload.status === "success" && (b.files = l.payload.files), r((
|
|
4733
|
-
|
|
4732
|
+
l.payload.status === "success" && (b.files = l.payload.files), r((O) => {
|
|
4733
|
+
O.tasks.codeGeneration.progress = l.payload.progress, O.tasks.codeGeneration.status = "running";
|
|
4734
4734
|
});
|
|
4735
4735
|
}), c.addEventListener("progress_messages_updated", (g) => {
|
|
4736
4736
|
const l = JSON.parse(
|
|
4737
4737
|
g.data
|
|
4738
4738
|
);
|
|
4739
|
-
r((
|
|
4740
|
-
|
|
4739
|
+
r((O) => {
|
|
4740
|
+
O.progressMessages = l.payload.progressMessages;
|
|
4741
4741
|
});
|
|
4742
4742
|
}), c.addEventListener("job_status_updated", (g) => {
|
|
4743
4743
|
const l = JSON.parse(
|
|
4744
4744
|
g.data
|
|
4745
4745
|
);
|
|
4746
|
-
r((
|
|
4747
|
-
|
|
4746
|
+
r((O) => {
|
|
4747
|
+
O.jobStatus = l.payload.jobStatus;
|
|
4748
4748
|
});
|
|
4749
4749
|
}), c.addEventListener("codegen_completed", () => {
|
|
4750
4750
|
r((g) => {
|
|
@@ -4766,44 +4766,44 @@ const ys = 10, gs = {
|
|
|
4766
4766
|
});
|
|
4767
4767
|
let m = 0;
|
|
4768
4768
|
c.addEventListener("error", (g) => Ie(void 0, null, function* () {
|
|
4769
|
-
var U,
|
|
4769
|
+
var U, M, L, ue;
|
|
4770
4770
|
console.warn(
|
|
4771
4771
|
`Experienced error during code generation (attempt ${m + 1} / ${ys})`,
|
|
4772
4772
|
g
|
|
4773
4773
|
);
|
|
4774
|
-
let l,
|
|
4774
|
+
let l, O, P = !1;
|
|
4775
4775
|
try {
|
|
4776
4776
|
if (g instanceof MessageEvent)
|
|
4777
4777
|
l = JSON.parse(g.data);
|
|
4778
4778
|
else {
|
|
4779
|
-
const
|
|
4780
|
-
|
|
4779
|
+
const j = yield o;
|
|
4780
|
+
O = j.status;
|
|
4781
4781
|
try {
|
|
4782
|
-
l = yield
|
|
4783
|
-
} catch (
|
|
4782
|
+
l = yield j.json();
|
|
4783
|
+
} catch (Ue) {
|
|
4784
4784
|
}
|
|
4785
4785
|
}
|
|
4786
|
-
(((U = l == null ? void 0 : l.payload) == null ? void 0 : U.name) === "Task Crashed" ||
|
|
4787
|
-
} catch (
|
|
4786
|
+
(((U = l == null ? void 0 : l.payload) == null ? void 0 : U.name) === "Task Crashed" || ((M = l == null ? void 0 : l.payload) == null ? void 0 : M.name) === "TimeoutError" || O === 429) && (P = !0);
|
|
4787
|
+
} catch (j) {
|
|
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: (ue = l == null ? void 0 : l.payload.message) != null ? ue : "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
|
-
let
|
|
4797
|
-
m > ys ? (console.error("Experienced too many errors, terminating request"),
|
|
4798
|
-
|
|
4796
|
+
let D = !1;
|
|
4797
|
+
m > ys ? (console.error("Experienced too many errors, terminating request"), D = !0) : P && (console.error("Experienced unrecoverable error, terminating request"), D = !0), D && (r((j) => {
|
|
4798
|
+
j.status = "error", j.error = K;
|
|
4799
4799
|
}), v({
|
|
4800
4800
|
result: null,
|
|
4801
4801
|
error: K
|
|
4802
4802
|
}));
|
|
4803
4803
|
})), c.addEventListener("done", (g) => {
|
|
4804
4804
|
const l = JSON.parse(g.data);
|
|
4805
|
-
b.tokenUsage = l.payload.tokenUsage, b.sessionId = l.payload.sessionId, r((
|
|
4806
|
-
|
|
4805
|
+
b.tokenUsage = l.payload.tokenUsage, b.sessionId = l.payload.sessionId, r((O) => {
|
|
4806
|
+
O.status = "success", O.result = b;
|
|
4807
4807
|
}), v({ result: b, error: null });
|
|
4808
4808
|
});
|
|
4809
4809
|
});
|
|
@@ -4812,20 +4812,20 @@ 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((
|
|
4816
|
-
const
|
|
4815
|
+
), l = m.assets.map((P) => Ie(void 0, null, function* () {
|
|
4816
|
+
const D = yield (yield fetch(P.url)).arrayBuffer();
|
|
4817
4817
|
return {
|
|
4818
|
-
assetName:
|
|
4819
|
-
base64: va(
|
|
4818
|
+
assetName: P.name,
|
|
4819
|
+
base64: va(D)
|
|
4820
4820
|
};
|
|
4821
|
-
})),
|
|
4822
|
-
for (const
|
|
4821
|
+
})), O = yield Promise.allSettled(l);
|
|
4822
|
+
for (const P of O) {
|
|
4823
4823
|
const K = {};
|
|
4824
|
-
if (
|
|
4825
|
-
const { assetName:
|
|
4826
|
-
K[
|
|
4827
|
-
const
|
|
4828
|
-
m.files[
|
|
4824
|
+
if (P.status === "fulfilled") {
|
|
4825
|
+
const { assetName: D, base64: U } = P.value;
|
|
4826
|
+
K[D] = U;
|
|
4827
|
+
const M = g ? `${g}/${D}` : D;
|
|
4828
|
+
m.files[M] = {
|
|
4829
4829
|
content: U,
|
|
4830
4830
|
isBinary: !0
|
|
4831
4831
|
};
|
|
@@ -4927,16 +4927,16 @@ function sc() {
|
|
|
4927
4927
|
g = i({
|
|
4928
4928
|
inst: { value: m, getSnapshot: b }
|
|
4929
4929
|
});
|
|
4930
|
-
var l = g[0].inst,
|
|
4930
|
+
var l = g[0].inst, O = g[1];
|
|
4931
4931
|
return c(
|
|
4932
4932
|
function() {
|
|
4933
|
-
l.value = m, l.getSnapshot = b, n(l) &&
|
|
4933
|
+
l.value = m, l.getSnapshot = b, n(l) && O({ inst: l });
|
|
4934
4934
|
},
|
|
4935
4935
|
[v, m, b]
|
|
4936
4936
|
), o(
|
|
4937
4937
|
function() {
|
|
4938
|
-
return n(l) &&
|
|
4939
|
-
n(l) &&
|
|
4938
|
+
return n(l) && O({ inst: l }), v(function() {
|
|
4939
|
+
n(l) && O({ inst: l });
|
|
4940
4940
|
});
|
|
4941
4941
|
},
|
|
4942
4942
|
[v]
|
|
@@ -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 Ss = Object.prototype.hasOwnProperty;
|
|
4970
4970
|
function _r(t, e) {
|
|
4971
4971
|
var n, r;
|
|
4972
4972
|
if (t === e) return !0;
|
|
@@ -4981,17 +4981,17 @@ 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 (Ss.call(t, n) && ++r && !Ss.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
4990
|
const Re = /* @__PURE__ */ new WeakMap(), Me = () => {
|
|
4991
|
-
},
|
|
4991
|
+
}, ee = (
|
|
4992
4992
|
/*#__NOINLINE__*/
|
|
4993
4993
|
Me()
|
|
4994
|
-
), br = Object, R = (t) => t ===
|
|
4994
|
+
), br = Object, R = (t) => t === ee, we = (t) => typeof t == "function", ze = (t, e) => Be(Be({}, t), e), Xs = (t) => we(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
4995
|
const n = Re.get(t);
|
|
4996
4996
|
return [
|
|
4997
4997
|
// Getter
|
|
@@ -5010,7 +5010,7 @@ const Re = /* @__PURE__ */ new WeakMap(), Me = () => {
|
|
|
5010
5010
|
];
|
|
5011
5011
|
};
|
|
5012
5012
|
let kr = !0;
|
|
5013
|
-
const uc = () => kr, [
|
|
5013
|
+
const uc = () => kr, [Sr, xr] = Xt && window.addEventListener ? [
|
|
5014
5014
|
window.addEventListener.bind(window),
|
|
5015
5015
|
window.removeEventListener.bind(window)
|
|
5016
5016
|
] : [
|
|
@@ -5019,16 +5019,16 @@ const uc = () => kr, [xr, Sr] = Xt && window.addEventListener ? [
|
|
|
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), Sr("focus", t), () => {
|
|
5023
|
+
wr && document.removeEventListener("visibilitychange", t), xr("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 Sr("online", e), Sr("offline", n), () => {
|
|
5031
|
+
xr("online", e), xr("offline", n);
|
|
5032
5032
|
};
|
|
5033
5033
|
}, hc = {
|
|
5034
5034
|
isOnline: uc,
|
|
@@ -5036,7 +5036,7 @@ const uc = () => kr, [xr, Sr] = Xt && window.addEventListener ? [
|
|
|
5036
5036
|
}, pc = {
|
|
5037
5037
|
initFocus: lc,
|
|
5038
5038
|
initReconnect: fc
|
|
5039
|
-
},
|
|
5039
|
+
}, xs = !Gt.useId, Ht = !Xt || oc, mc = (t) => cc() ? window.requestAnimationFrame(t) : setTimeout(t, 1), Wn = Ht ? ha : pa, zn = typeof navigator != "undefined" && navigator.connection, Es = !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}]`;
|
|
@@ -5100,61 +5100,61 @@ function Qs(...t) {
|
|
|
5100
5100
|
return Ie(this, null, function* () {
|
|
5101
5101
|
const [v] = Pr(k);
|
|
5102
5102
|
if (!v) return;
|
|
5103
|
-
const [b, m] = Ys(e, v), [g, l,
|
|
5103
|
+
const [b, m] = Ys(e, v), [g, l, O, P] = Re.get(e), K = () => {
|
|
5104
5104
|
const fe = g[v];
|
|
5105
|
-
return (we(a.revalidate) ? a.revalidate(b().data, k) : a.revalidate !== !1) && (delete
|
|
5105
|
+
return (we(a.revalidate) ? a.revalidate(b().data, k) : a.revalidate !== !1) && (delete O[v], delete P[v], fe && fe[0]) ? fe[0](Js).then(() => b().data) : b().data;
|
|
5106
5106
|
};
|
|
5107
5107
|
if (t.length < 3)
|
|
5108
5108
|
return K();
|
|
5109
|
-
let
|
|
5110
|
-
const
|
|
5109
|
+
let D = r, U;
|
|
5110
|
+
const M = Or();
|
|
5111
5111
|
l[v] = [
|
|
5112
|
-
|
|
5112
|
+
M,
|
|
5113
5113
|
0
|
|
5114
5114
|
];
|
|
5115
|
-
const
|
|
5116
|
-
if (
|
|
5115
|
+
const L = !R(c), ue = b(), j = ue.data, Ue = ue._c, Ve = R(Ue) ? j : Ue;
|
|
5116
|
+
if (L && (c = we(c) ? c(Ve, j) : c, m({
|
|
5117
5117
|
data: c,
|
|
5118
|
-
_c:
|
|
5119
|
-
})), we(
|
|
5118
|
+
_c: Ve
|
|
5119
|
+
})), we(D))
|
|
5120
5120
|
try {
|
|
5121
|
-
|
|
5121
|
+
D = D(Ve);
|
|
5122
5122
|
} catch (fe) {
|
|
5123
5123
|
U = fe;
|
|
5124
5124
|
}
|
|
5125
|
-
if (
|
|
5126
|
-
if (
|
|
5125
|
+
if (D && Xs(D))
|
|
5126
|
+
if (D = yield D.catch((fe) => {
|
|
5127
5127
|
U = fe;
|
|
5128
|
-
}),
|
|
5128
|
+
}), M !== l[v][0]) {
|
|
5129
5129
|
if (U) throw U;
|
|
5130
|
-
return
|
|
5131
|
-
} else U &&
|
|
5132
|
-
data:
|
|
5133
|
-
_c:
|
|
5130
|
+
return D;
|
|
5131
|
+
} else U && L && u(U) && (i = !0, m({
|
|
5132
|
+
data: Ve,
|
|
5133
|
+
_c: ee
|
|
5134
5134
|
}));
|
|
5135
5135
|
if (i && !U)
|
|
5136
5136
|
if (we(i)) {
|
|
5137
|
-
const fe = i(
|
|
5137
|
+
const fe = i(D, Ve);
|
|
5138
5138
|
m({
|
|
5139
5139
|
data: fe,
|
|
5140
|
-
error:
|
|
5141
|
-
_c:
|
|
5140
|
+
error: ee,
|
|
5141
|
+
_c: ee
|
|
5142
5142
|
});
|
|
5143
5143
|
} else
|
|
5144
5144
|
m({
|
|
5145
|
-
data:
|
|
5146
|
-
error:
|
|
5147
|
-
_c:
|
|
5145
|
+
data: D,
|
|
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;
|
|
5155
5155
|
return;
|
|
5156
5156
|
}
|
|
5157
|
-
return
|
|
5157
|
+
return D;
|
|
5158
5158
|
});
|
|
5159
5159
|
}
|
|
5160
5160
|
});
|
|
@@ -5164,7 +5164,7 @@ const Os = (t, e) => {
|
|
|
5164
5164
|
t[n][0] && t[n][0](e);
|
|
5165
5165
|
}, vc = (t, e) => {
|
|
5166
5166
|
if (!Re.has(t)) {
|
|
5167
|
-
const n = ze(pc, e), r = /* @__PURE__ */ Object.create(null), s = Qs.bind(
|
|
5167
|
+
const n = ze(pc, e), r = /* @__PURE__ */ Object.create(null), s = Qs.bind(ee, t);
|
|
5168
5168
|
let a = Me;
|
|
5169
5169
|
const i = /* @__PURE__ */ Object.create(null), o = (h, p) => {
|
|
5170
5170
|
const k = i[h] || [];
|
|
@@ -5185,7 +5185,7 @@ 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
5190
|
h && h(), p && p(), Re.delete(t);
|
|
5191
5191
|
};
|
|
@@ -5232,14 +5232,14 @@ const Os = (t, e) => {
|
|
|
5232
5232
|
},
|
|
5233
5233
|
// use web preset by default
|
|
5234
5234
|
hc
|
|
5235
|
-
),
|
|
5235
|
+
), Sc = (t, e) => {
|
|
5236
5236
|
const n = ze(t, e);
|
|
5237
5237
|
if (e) {
|
|
5238
5238
|
const { use: r, fallback: s } = t, { use: a, fallback: i } = e;
|
|
5239
5239
|
r && a && (n.use = r.concat(a)), s && i && (n.fallback = ze(s, i));
|
|
5240
5240
|
}
|
|
5241
5241
|
return n;
|
|
5242
|
-
},
|
|
5242
|
+
}, xc = fa({}), Ec = "$inf$", ta = Xt && window.__SWR_DEVTOOLS_USE__, Oc = ta ? window.__SWR_DEVTOOLS_USE__ : [], Tc = () => {
|
|
5243
5243
|
ta && (window.__SWR_DEVTOOLS_REACT__ = Gt);
|
|
5244
5244
|
}, Ac = (t) => we(t[1]) ? [
|
|
5245
5245
|
t[0],
|
|
@@ -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 = () => ze(kc, ma(
|
|
5252
|
+
], Cc = () => ze(kc, ma(xc)), Nc = (t) => (e, n, r) => t(e, n && ((...a) => {
|
|
5253
5253
|
const [i] = Pr(e), [, , , o] = Re.get(ea);
|
|
5254
5254
|
if (i.startsWith(Ec))
|
|
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 = Sc(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] = Re.get(r), [l,
|
|
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] = Re.get(r), [l, O] = Pr(t), P = qe(!1), K = qe(!1), D = qe(l), U = qe(e), M = qe(n), L = () => M.current, ue = () => L().isVisible() && L().isOnline(), [j, Ue, Ve, fe] = 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) ?
|
|
5307
|
-
const Oe = ze(
|
|
5308
|
-
return delete Oe._k, F ?
|
|
5306
|
+
const F = !l || !e ? !1 : R(o) ? L().isPaused() || a ? !1 : c !== !1 : o, $ = (Y) => {
|
|
5307
|
+
const Oe = ze(Y);
|
|
5308
|
+
return delete Oe._k, F ? Be({
|
|
5309
5309
|
isValidating: !0,
|
|
5310
5310
|
isLoading: !0
|
|
5311
5311
|
}, Oe) : Oe;
|
|
5312
|
-
},
|
|
5312
|
+
}, G = j(), V = fe(), he = $(G), ot = G === V ? he : $(V);
|
|
5313
5313
|
let H = he;
|
|
5314
5314
|
return [
|
|
5315
5315
|
() => {
|
|
5316
|
-
const
|
|
5317
|
-
return Zr(
|
|
5316
|
+
const Y = $(j());
|
|
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) => Ve(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 = !
|
|
5333
|
+
), Dr[0], Dr[1]), Mr = !P.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 : L().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
5334
|
(F) => Ie(void 0, null, function* () {
|
|
5335
|
-
const
|
|
5336
|
-
if (!l ||
|
|
5335
|
+
const $ = U.current;
|
|
5336
|
+
if (!l || !$ || K.current || L().isPaused())
|
|
5337
5337
|
return !1;
|
|
5338
|
-
let
|
|
5339
|
-
const ot = F || {}, H = !m[l] || !ot.dedupe,
|
|
5338
|
+
let G, V, he = !0;
|
|
5339
|
+
const ot = F || {}, H = !m[l] || !ot.dedupe, Y = () => xs ? !K.current && l === D.current && P.current : l === D.current, Oe = {
|
|
5340
5340
|
isValidating: !1,
|
|
5341
5341
|
isLoading: !1
|
|
5342
5342
|
}, Wr = () => {
|
|
5343
|
-
|
|
5343
|
+
Ue(Oe);
|
|
5344
5344
|
}, zr = () => {
|
|
5345
5345
|
const de = m[l];
|
|
5346
5346
|
de && de[1] === V && delete m[l];
|
|
5347
5347
|
}, Ur = {
|
|
5348
5348
|
isValidating: !0
|
|
5349
5349
|
};
|
|
5350
|
-
R(
|
|
5350
|
+
R(j().data) && (Ur.isLoading = !0);
|
|
5351
5351
|
try {
|
|
5352
|
-
if (H && (
|
|
5353
|
-
he &&
|
|
5352
|
+
if (H && (Ue(Ur), n.loadingTimeout && R(j().data) && setTimeout(() => {
|
|
5353
|
+
he && Y() && L().onLoadingSlow(l, n);
|
|
5354
5354
|
}, n.loadingTimeout), m[l] = [
|
|
5355
|
-
|
|
5355
|
+
$(O),
|
|
5356
5356
|
Or()
|
|
5357
|
-
]), [
|
|
5358
|
-
return H &&
|
|
5359
|
-
Oe.error =
|
|
5357
|
+
]), [G, V] = m[l], G = yield G, H && setTimeout(zr, n.dedupingInterval), !m[l] || m[l][1] !== V)
|
|
5358
|
+
return H && Y() && L().onDiscarded(l), !1;
|
|
5359
|
+
Oe.error = ee;
|
|
5360
5360
|
const de = b[l];
|
|
5361
5361
|
if (!R(de) && // case 1
|
|
5362
5362
|
(V <= de[0] || // case 2
|
|
5363
5363
|
V <= de[1] || // case 3
|
|
5364
5364
|
de[1] === 0))
|
|
5365
|
-
return Wr(), H &&
|
|
5366
|
-
const Te =
|
|
5367
|
-
Oe.data = s(Te,
|
|
5365
|
+
return Wr(), H && Y() && L().onDiscarded(l), !1;
|
|
5366
|
+
const Te = j().data;
|
|
5367
|
+
Oe.data = s(Te, G) ? Te : G, H && Y() && L().onSuccess(G, l, n);
|
|
5368
5368
|
} catch (de) {
|
|
5369
5369
|
zr();
|
|
5370
|
-
const Te =
|
|
5371
|
-
Te.isPaused() || (Oe.error = de, H &&
|
|
5370
|
+
const Te = L(), { shouldRetryOnError: Cn } = Te;
|
|
5371
|
+
Te.isPaused() || (Oe.error = de, H && Y() && (Te.onError(de, l, Te), (Cn === !0 || we(Cn) && Cn(de)) && (!L().revalidateOnFocus || !L().revalidateOnReconnect || ue()) && Te.onErrorRetry(de, l, Te, (aa) => {
|
|
5372
5372
|
const Nn = v[l];
|
|
5373
5373
|
Nn && Nn[0] && Nn[0](ks, aa);
|
|
5374
5374
|
}, {
|
|
@@ -5395,23 +5395,23 @@ const Vn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5395
5395
|
]
|
|
5396
5396
|
), Fr = sn(
|
|
5397
5397
|
// Use callback to make sure `keyRef.current` returns latest result every time
|
|
5398
|
-
(...F) => Qs(r,
|
|
5398
|
+
(...F) => Qs(r, D.current, ...F),
|
|
5399
5399
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5400
5400
|
[]
|
|
5401
5401
|
);
|
|
5402
5402
|
if (Wn(() => {
|
|
5403
|
-
U.current = e,
|
|
5403
|
+
U.current = e, M.current = n, R(it) || (An.current = it);
|
|
5404
5404
|
}), Wn(() => {
|
|
5405
5405
|
if (!l) return;
|
|
5406
|
-
const F = wt.bind(
|
|
5407
|
-
let
|
|
5408
|
-
|
|
5406
|
+
const F = wt.bind(ee, Kn);
|
|
5407
|
+
let $ = 0;
|
|
5408
|
+
L().revalidateOnFocus && ($ = Date.now() + L().focusThrottleInterval);
|
|
5409
5409
|
const V = Ic(l, v, (he, ot = {}) => {
|
|
5410
5410
|
if (he == Hs) {
|
|
5411
5411
|
const H = Date.now();
|
|
5412
|
-
|
|
5412
|
+
L().revalidateOnFocus && H > $ && ue() && ($ = H + L().focusThrottleInterval, F());
|
|
5413
5413
|
} else if (he == Gs)
|
|
5414
|
-
|
|
5414
|
+
L().revalidateOnReconnect && ue() && F();
|
|
5415
5415
|
else {
|
|
5416
5416
|
if (he == Js)
|
|
5417
5417
|
return wt();
|
|
@@ -5419,23 +5419,23 @@ const Vn = Gt.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
5419
5419
|
return wt(ot);
|
|
5420
5420
|
}
|
|
5421
5421
|
});
|
|
5422
|
-
return K.current = !1,
|
|
5423
|
-
_k:
|
|
5424
|
-
}), Lr && (R(
|
|
5422
|
+
return K.current = !1, D.current = l, P.current = !0, Ue({
|
|
5423
|
+
_k: O
|
|
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 = we(u) ? u(
|
|
5433
|
-
V && F !== -1 && (F = setTimeout(
|
|
5431
|
+
function $() {
|
|
5432
|
+
const V = we(u) ? u(j().data) : u;
|
|
5433
|
+
V && F !== -1 && (F = setTimeout(G, V));
|
|
5434
5434
|
}
|
|
5435
|
-
function
|
|
5436
|
-
|
|
5435
|
+
function G() {
|
|
5436
|
+
!j().error && (h || L().isVisible()) && (p || L().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 (!xs && Ht)
|
|
5448
5448
|
throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
5449
|
-
U.current = e,
|
|
5449
|
+
U.current = e, M.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
|
}
|